Hello,
l lunched ResNet-152 to extract features from UCF-101 dataset which has 13.000 videos. It has more than 2 millions frames. l lunched it on GPU 1 week ago as follow and up to now is still running. Is there any way to accelerate the extraction ?
Here is my code :

import cv2, subprocess
import numpy as np
import os, sys, collections, random, string
from scipy import ndimage
import matplotlib.pyplot as plt
import glob
from datetime import datetime
import torch
import numpy as np
import torch.nn as nn
import torchvision.models as models
from torch.autograd import Variable
from torchvision.transforms import ToTensor
from PIL import Image
import glob as glob
import pickle
from numpy import genfromtxt



resnet152 = models.resnet152(pretrained=True)
modules = list(resnet152.children())[:-1]
resnet152 = nn.Sequential(*modules)
frames = []
labels = []
for root, dirs, files in os.walk("/UCF/tmp_frames/test", topdown=False):
    
    for name in files:

        open_img = Image.open(os.path.join(root, name))
        image = ToTensor()(open_img).unsqueeze(0)
        img_var = Variable(image)
        features_var = resnet152(img_var)
        features = features_var.data
        features = features.numpy()
        features = features.ravel()
        frames.append(features)
        
        label = name.split('.')[0]
        labels.append(label)

dataset = dict(zip(labels, frames))


Any suggestion , to optimize the process of feautre extraction ?
for 26.000 frames it took 4 hourrs and half
Thank you