Breakthrough / DVR-Scan

:vhs: Tool for extracting scenes with motion from videos (e.g. security camera or DVR footage). Written in Python, uses OpenCV.
http://www.dvr-scan.com/
Other
362 stars 47 forks source link

MOG2_CUDA mode speed is same as MOG2 #122

Closed dassio closed 1 year ago

dassio commented 1 year ago

Bug/Issue Description: enable MOG2_CUDA mode , the speed is still the same

Required Information:

dvr-scan -m ffmpeg -b MOG2_CUDA --verbosity debug -i 2022-05-14.mp4

Expected Behavior: the speed should be faster than MOG2 mode

Computing Environment:

Additional Information: with mog2 mode

danny@home:~/Videos/2022-05$ dvr-scan -m ffmpeg --verbosity debug  -i 2022-05-14.mp4
INFO: controller._init_dvr_scan(): DVR-Scan v1.5.1
DEBUG: controller._init_dvr_scan(): User config file not found.
DEBUG: controller._init_dvr_scan(): Parsing program options.
INFO: scanner.__init__(): Initializing scan context...
INFO: video_joiner._load_input_videos(): Opened video 2022-05-14.mp4 (1920 x 1080 at 14.932 FPS).
DEBUG: scanner.scan_motion(): Using detector MOG2 with params: kernel_size = 7
INFO: scanner.scan_motion(): Scanning input video for motion events...
Detected: 0 | Progress:   0%|                                                              | 172/1281164 [00:02<4:58:45, 71.46 frames/s]

with mog2_cuda mode

dvr-scan -m ffmpeg -b MOG2_CUDA --verbosity debug  -i 2022-05-14.mp4
INFO: controller._init_dvr_scan(): DVR-Scan v1.5.1
DEBUG: controller._init_dvr_scan(): User config file not found.
DEBUG: controller._init_dvr_scan(): Parsing program options.
INFO: scanner.__init__(): Initializing scan context...
INFO: video_joiner._load_input_videos(): Opened video 2022-05-14.mp4 (1920 x 1080 at 14.932 FPS).
DEBUG: scanner.scan_motion(): Using detector MOG2_CUDA with params: kernel_size = 7
INFO: scanner.scan_motion(): Scanning input video for motion events...
Detected: 1 | Progress:   0%|▏                                                            | 3101/1281164 [00:45<5:12:50, 68.09 frames/s]

i think this indicates gpu is being used(the python3 process)

danny@home:~/Videos/2022-05$ ps -aux | grep dvr-scan 
danny      36176  158  2.1 50259816 707524 pts/1 RLl+ 21:48   0:19 /usr/bin/python3 /home/danny/.local/bin/dvr-scan -m ffmpeg -b MOG2_CUDA --verbosity debug -i 2022-05-14.mp4
danny@home:~/Videos/2022-05$ nvidia-smi                                                                                                 
Fri Oct 14 21:42:20 2022                                                                                                                
+-----------------------------------------------------------------------------+                                                         
| NVIDIA-SMI 515.76       Driver Version: 515.76       CUDA Version: 11.7     |                                                         
|-------------------------------+----------------------+----------------------+                                                         
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |                                                         
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |                                                         
|                               |                      |               MIG M. |                                                         
|===============================+======================+======================|                                                         
|   0  NVIDIA GeForce ...  Off  | 00000000:26:00.0  On |                  N/A |                                                         
| 29%   50C    P2    60W / 120W |    623MiB /  2048MiB |     92%      Default |                                                         
|                               |                      |                  N/A |                                                         
+-------------------------------+----------------------+----------------------+                                                         

+-----------------------------------------------------------------------------+                                                         
| Processes:                                                                  |                                                         
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |                                                         
|        ID   ID                                                   Usage      |                                                         
|=============================================================================|                                                         
|    0   N/A  N/A      2609      G   /usr/lib/xorg/Xorg                111MiB |                                                         
|    0   N/A  N/A      2805      G   /usr/bin/gnome-shell               92MiB |                                                         
|    0   N/A  N/A      7731      G   ...3/usr/lib/firefox/firefox      168MiB |                                                         
|    0   N/A  N/A     36176      C   /usr/bin/python3                  244MiB |                                                         
+-----------------------------------------------------------------------------+      

Edit: add the scan only -so parameter got the same result

Breakthrough commented 1 year ago

Closing as duplicate of #109 but I've updated the title to better reflect what you've said here. Thanks for the report.