This is my first project involving feature extraction from videos. From my research, YOLO seems to be one of the lightest models to use, but the extraction process is taking a very long time, and Google Colab occasionally crashes. Could anyone advise me on how to improve performance or optimise my workflow? I am doing this project as a learning experience, so any guidance will be greatly appreciated.
I will share my guide with you shortly. But I believe first step would be using the onnx version or tensorRT. Speeds up inference upto 5 times
Skipping many of the frames(using a very low frame rate) and using the A100 GPU helped speed up my feature extraction process.
For me - skipping frames, and extracting in features parallel (limited by GPU memory) - have to make sure that each process has its own instance of the model.
You can use something similar to below to speed up model.track() significantly, you'll loose some tracking results for faster moving cars because of frame skipping, but I believe it can work very well in feature engineering pipelines.
cap = cv2.VideoCapture(video_path) original_fps = cap.get(cv2.CAP_PROP_FPS) print(original_fps) cap.release() # 1 FPS vid_stride = 20 # 2 FPS vid_stride = 10 desired_fps = 4 vid_stride = original_fps / desired_fps print(vid_stride) results = model.track( source=video_path, save=True, save_txt=True, verbose=False, batch=32, vid_stride=int(vid_stride) # <-- 1 FPS (use 10 for 2 FPS) )Skipping many of the frames(using a very low frame rate) and using the A100 GPU helped speed up my feature extraction process. google
https://www.google.com
--- HTML ---
google' rel='noopener noreferrer nofollow' target='_blank'>https://www.google.com">google
--- BBCODE ---
[URL=https://www.google.com]google[/URL]
[url=https://www.google.com]google[/url]
[url=https://www.google.com]google[/url]
--- RARE ---
[link=https://www.google.com]google[/link]
[link name=google]https://www.google.com[/link]
((https://www.google.com))
((https://www.google.com))
[https://www.google.com]
[[https://www.google.com]]
[L=google]https://www.google.com[/L]
"google":https://www.google.com