qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.44k forks source link

Why `python yolo_video.py --gpu_num 1` does not use GPU? #654

Closed zeyuyang closed 4 years ago

zeyuyang commented 4 years ago

First of all, I want to say that the GPU, CUDA and cuDNN is all right because I can use GPU rightly in other code.

When it comes to keras-yolo3. Even I appointed the GPU like python yolo_video.py --gpu_num 1, the running code is still as slow as CPU. I saw the GPU status by nvidia-smi, and it seems the model does not use GPU.

+-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 1614 C python 145MiB | | 0 23952 C ...ualenvironment/mxnet-python3/bin/python 145MiB | | 1 1614 C python 145MiB | | 1 23952 C ...ualenvironment/mxnet-python3/bin/python 145MiB | +-----------------------------------------------------------------------------+

Does anyone know how it comes, and how to fix this bug?

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

UPDATE - I have checked the log and find that not the reason as following:

I use yolo_video.py to process mp4. Maybe the slow running is because the code logic. The detecting function is in yolo.py. During the mp4 video processing, the code need load h5 model file in each loop for every fps, .i.e., I need load model file in the loop of processing every fps or picture of the video.