AlexeyAB / darknet

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

Single Class Lightweight Architecture #2251

Open deimsdeutsch opened 5 years ago

deimsdeutsch commented 5 years ago

Yolo is heavy and designed to detect multiple objects. But if we want a lightweight single class object detector i don't think we would need so many layers. Can you guide and discuss regarding the implementation for the same as it is a requirement shared by many.

https://towardsdatascience.com/faced-cpu-real-time-face-detection-using-deep-learning-1488681c1602

AlexeyAB commented 5 years ago

@deimsdeutsch You can use yolov3-tiny.cfg realtime on CPU by using OpenCV-Yolov2/v3 implementation in the OpenCV-dnn module:

I had built Yolo into OpenCV, so you can use Yolov2/v3 on CPU with OpenCV and without Darknet: https://github.com/opencv/opencv/pull/9705 This Yolo v2/v3 implementation is much more faster than Darknet on CPU.

deimsdeutsch commented 5 years ago

@AlexeyAB I would like to make the following points:

  1. Yolo is designed to detect multiple objects and i think we can improve the detection speed by having a separate classifier for a single class and optimize the grid size and filters to make it work only on single class. The reason is that majority of the deployment is happen for Face Recognition, Person Detection. So having a single class object detection makes a lot of sense.

  2. The CPU implementation does not use OpenBlas/Intel MKL libraries and it can further improve the inference to make it work with 25 FPS on > 700 resolution.

  3. FP 16/FP 8 options are not available in Yolo and SSD/SSDLite already has those options so no point in using yolo unless these options are not available. I would prefer Tensorflow as it has low CPU consumption than Yolo now.

I am not in favor of doing inference on GPU as i have seen others using CPU in real time for the same.

deimsdeutsch commented 5 years ago

Can you tag this as enhancement ?

haoxuhao commented 5 years ago

@AlexeyAB Hi AlexeyAB, I used opencv4.0 to run the yolov3-tiny network, but the resulting box is different from the original darknet, the accuracy of the box is very poor, and even lost. I want to know if this is caused by too much optimization in dnn.

AlexeyAB commented 5 years ago

@haoxuhao Hi,

I don't know. @dkurt added test for yolov3.cfg, but didn't add test for yolov3-tiny.cfg: https://github.com/opencv/opencv/blob/master/modules/dnn/test/test_darknet_importer.cpp#L345-L386

Try to ask him why: https://github.com/opencv/opencv/pull/11322

haoxuhao commented 5 years ago

@AlexeyAB Thank you for your prompt reply. This issue appears because I don't use a square image as input. I have found out the bug in opencv4.0, and the bug is also been fixed one month ago in the latest version of OpenCV. The commit is here: https://github.com/opencv/opencv/commit/8b52eabd48195c42b12062735b1ffb0e911d389b