AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

How to reach 30FPS? #8169

Open sharmin-sultana-sheuly opened 2 years ago

sharmin-sultana-sheuly commented 2 years ago

Hello

My system configurations are:

Windows 10 GPU0:Intel(R) HD Graphics 630(16GB) GPU1:NVIDIA Quadro M1200 (4GB) OpenCV version: 4.5.3 CUDA-version: 11040

When I run the command darknet.exe detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights Car_moving.mp4 it shows CUDA-version: 11040 (11040), cuDNN: 8.2.4, GPU count: 1 OpenCV version: 4.5.3 Demo 0 : compute_capability = 500, cudnn_half = 0, GPU: Quadro M1200 net.optimized_memory = 0

Question 1: I have two GPUS, it uses only one. why? Question 2: I can achieve FPS=7 but I need more at least 20FPS. My video resolution is width:1920 height:1080 Question 3: in task manager it shows I am using only 10% of GPUs. is it normal?

Please help me. Regards Sharmin

stephanecharette commented 2 years ago

Darknet can only use CUDA-supported GPUs. Your Intel GPU cannot be used by Darknet. Your video resolution is only a small part of the equation. What config file are you using? What dimensions does your network use?

Please see: https://www.ccoderun.ca/programming/darknet_faq/#fps

sharmin-sultana-sheuly commented 2 years ago

Hi @stephanecharette Thanks. I am using pre-trained network weights. Following your suggestion, I am using the yolov4-tiny-3l.cfg which uses only 3 YOLO layers. And I ran the command darknet.exe detector demo cfg/coco.data cfg/yolov4-tiny-3l.cfg yolov4.weights Car_moving.mp4 It increased the FPS to 17. However, Now the detected object in the video is not showing with a bounding box. Also no detected objects in command prompt (see attached file for command prompt output) Error_yolov4.docx

Tried to use yolov4-tiny.weights but darknet.exe stops responding in this case.

//Sharmin

sharmin-sultana-sheuly commented 2 years ago

Hello

I used the command darknet.exe detector demo cfg/coco.data cfg/yolov4-tiny.cfg yolov4-tiny.weights Car_moving.mp4 Now the bounding box is showing with the detected object name. The FPS is 30. It looks like the problem is solved. However, In AlexyAB/darknet it is written we can reach 100FPS. How can we do that? Also, I was looking for a file where the result of object detection is saved. Any help?

//Sharmin

stephanecharette commented 2 years ago

However, In AlexyAB/darknet it is written we can reach 100FPS. How can we do that?

See: https://www.ccoderun.ca/programming/darknet_faq/#fps

Also, I was looking for a file where the result of object detection is saved. Any help?

See: https://www.ccoderun.ca/darkhelp/api/Server.html

sharmin-sultana-sheuly commented 2 years ago

Hi @stephanecharette

Thanks, I did not want to use C++API DarkHelp. Also the video in DarkHelp shows that images are being classified and results are being saved in another folder. However, In My case I have video stream either through webcam or separate camera. My target is to detect a specific class in a video for generating alarms. For this, I need the result file. @AlexeyAB , @cenit any comment?

Additionally, Do I need GeForce RTX 2080 Ti GPU to reach 100FPS? I already have NVIDIA GPU,CUDA, OpenCV

stephanecharette commented 2 years ago

Also the video in DarkHelp shows that images are being classified and results are being saved in another folder.

DarkHelp has always had support for videos and webcam streams as well as images. The results are stored in JSON files.

Additionally, Do I need GeForce RTX 2080 Ti GPU to reach 100FPS? I already have NVIDIA GPU,CUDA, OpenCV

You don't say what config file you are using, what network dimensions you are using or what video dimensions you are using. I have a post where I talk about all these things, and how to get > 200 FPS, and how the config and dimensions can bring that down from 200 FPS to less than 50 FPS if you don't set things up correctly. If interested, I have that here: https://www.ccoderun.ca/programming/2021-10-16_darknet_fps/

sharmin-sultana-sheuly commented 2 years ago

@stephanecharette I dont know what is meant by " network dimensions you are using or what video dimensions" Cause I wrote the information in my comment already. The configuration file is yolov4-tiny.cfg, you can find the network dimension there. video dimension(as I already wrote )width:1920 height:1080

Another question: Can I use https://github.com/AlexeyAB/Yolo_mark for the annotation of YOLOV4 custom model? Or should I use Roboflow?any help from anybody will be highly appreciated.

stephanecharette commented 2 years ago

I don't know why you're being so rude.

The network dimensions are the width and height you decided to use in the [net] section of your network. I don't have your .cfg file, so I don't know the dimensions. The default is 416x416, and if you are using those dimensions, then great, all you had to say is you haven't changed them to match your video dimensions.

Which brings up my comment about if your network dimensions and your video dimensions don't match, then your FPS will suffer. And not just a little bit, but lots. I already linked above to the post I made with that information.

The best annotation tool for video that I know about is DarkMark. I've written several features to make annotating videos easier. If you don't want to use it, that is your choice. Yesterday you incorrectly commented that DarkHelp didn't support videos!

I find it funny you keep asking for "help from anybody" but yet you keep ignoring the person who writes the most tools for working with Darknet/YOLO, and who takes the time to reply to you.

sharmin-sultana-sheuly commented 2 years ago

@stephanecharette I am sorry if Comments sounds rude. I wrote "help from anybody" so that I get the maximum comment (not only limited to you). The Link you shared states using yolov4-tiny-3l.cfg , which did not work for my setup (as I already commented- But did not get any solution). Thats why I wanted more comments from other people. I solved my problem with the trial and error method (yolov4-tiny.cfg). I wrote DarkHelp didn't support videos, which may be wrong. But it is not stated in GitHub to not write comments based on your knowledge. And thanks for replying.

kadirnar commented 2 years ago

@sharmin-sultana-sheuly

Have you tried using TensorRT on your model? RTX 2080Ti (CUDA 10.2, TensorRT 7.0.0, Cudnn 7.6.5):

model precision batch avg (ms) min (ms) max(ms) avg FPS
YoloV4-Tiny fp32 1 1,64185 1,57668 1,71029 609,068
YoloV4-Tiny fp32 4 1,0385 1,03024 1,08981 962,926
YoloV4-Tiny fp16 1 1,26474 0,90607 1,4321 790,677
YoloV4-Tiny fp16 4 0,563628 0,556467 0,620871 1774,22
YoloV4-Tiny int8 1 1,03339 0,728739 1,16966 967,69
YoloV4-Tiny int8 4 0,474048 0,467551 0,506916 2109,49