Hi all. Does anyone have experience in classifying videos using deep learning with pytorch? I’m having a bottleneck in reading videos with the dataloader. The videos are stored in mp4 format and I use the OpenCV library.
I have tried to increase the batch size but it doesn’t improve the speed, it even seems to slow down.
Can anyone tell me how to improve the reading speed?
Here is the part of the code where I read the videos.
frames = []
v_cap = cv2.VideoCapture(filename)
start_frame_number = frame_list[0]
last_frame_number = frame_list[-1]
v_cap.set(cv2.CAP_PROP_POS_FRAMES, start_frame_number)
for fn in range(start_frame_number, last_frame_number + 1):
success, frame = v_cap.read()
if fn in frame_list:
frame = Image.fromarray(frame)
img_tens = transform(frame)
frames.append(img_tens)
v_cap.release()