darknet icon indicating copy to clipboard operation
darknet copied to clipboard

Darknet Yolo v2 is added to the OpenCV

Open AlexeyAB opened this issue 6 years ago • 16 comments

Now Darknet Yolo v2 is added to the OpenCV: https://github.com/opencv/opencv/pull/9705 You can use it from master-branch or since OpenCV 3.4.0 will be released. There is example how to use Yolo v2: https://github.com/opencv/opencv/blob/master/samples/dnn/yolo_object_detection.cpp For now it CPU-only (~5-10 times faster than original) and can be used on mobile devices, but in the future GPU will be supported.

If there will be many upvotes, perhaps I will add support for Yolo 9000: https://github.com/opencv/opencv/pull/9705 Don't write anything there, just upvote :)

yolo

AlexeyAB avatar Oct 10 '17 12:10 AlexeyAB

video capture next, please?:)

MakerVisioneer avatar Oct 26 '17 18:10 MakerVisioneer

@AlexeyAB I saw the issue in the OpenCV repository, but it's not clear if also the "GPU version" of YOLO will be available.

Myzhar avatar Dec 07 '17 09:12 Myzhar

@AlexeyAB, I'm using your windows port of Darknet and I would like to use darknet with OpenCV. Do you think you can add GPU support ? And Yolo 9000 support of course :). It would be great !

Many Thanks for your valuable work !

bretzel59 avatar Mar 04 '18 09:03 bretzel59

@AlexeyAB actually i am using three versions of darknet, (yolo_v2 with opencv, yolo_v2 with cuda and yolo_v3 with cuda) now i am trying to get yolo_v3 working with opencv but the "shortcut" layer is not implemented, (i think is similar as the "route" layer from v2.. ) i dont know how i can put the "activation=linear" option on the opencv so i cannot read it, i was trying to create my own reader-function modifying the .src files but no success, do you have any ideas how this can be solved? or if there is any plan on adding support for yolo_v3 on opencv? thanks!

richipower avatar Apr 09 '18 09:04 richipower

@AlexeyAB I am writing code to use yolo_v2 with OpenCV in python but I am not getting correct detections. can you please tell me how to parse the output detections. means how to get box coordinates and how to get class with class score.

Thanks in advance!

Ratnadeep22 avatar Apr 24 '18 07:04 Ratnadeep22

@AlexeyAB can you explain about activation= linear and activation= leaky

abdulkalam1233 avatar Jun 18 '18 16:06 abdulkalam1233

@abdulkalam1233

  • linear is Identity-activation: y = x https://github.com/pjreddie/darknet/blob/f6d861736038da22c9eb0739dca84003c5a5e275/src/activations.h#L31

  • leaky is Leaky ReLU-activation: if(x<0) { y=x*0.01; } else { y = x; } https://github.com/pjreddie/darknet/blob/f6d861736038da22c9eb0739dca84003c5a5e275/src/activations.h#L38

About Leaky rectified linear unit (Leaky ReLU): https://en.wikipedia.org/wiki/Activation_function#Comparison_of_activation_functions

AlexeyAB avatar Jun 18 '18 18:06 AlexeyAB

Yolo v3 is added to the OpenCV too: https://github.com/opencv/opencv/pull/11322

AlexeyAB avatar Jun 18 '18 18:06 AlexeyAB

@AlexeyAB Thanks man. You are awesome

abdulkalam1233 avatar Jun 19 '18 09:06 abdulkalam1233

is yolo9000 planned to be integrated? If not, what does it take to do this?

streamnsight avatar Oct 13 '18 22:10 streamnsight

@streamnsight Yolo9000 isn't planned to be integrated (should be implemented softmax-tree in the region_layer.cpp) May be better to use Yolov3 multilabel training instead of Yolo9000: https://arxiv.org/pdf/1804.02767v1.pdf

AlexeyAB avatar Oct 13 '18 23:10 AlexeyAB

@AlexeyAB thanks for the note I'm looking to use a trained model. Is there weight files available for more than 80 classes that work with the current OpenCV implementation?

streamnsight avatar Oct 15 '18 17:10 streamnsight

@streamnsight

yolov3-openimages.cfg is for 601 classes.

https://github.com/AlexeyAB/darknet#pre-trained-models-for-different-cfg-files-can-be-downloaded-from-smaller---faster--lower-quality

yolov3-openimages.cfg (247 MB COCO Yolo v3) - requires 4 GB GPU-RAM: https://pjreddie.com/media/files/yolov3-openimages.weights

AlexeyAB avatar Oct 15 '18 17:10 AlexeyAB

@AlexeyAB Thanks for the help. Sorry I'm kind new at this and having issues:

I got the cfg from https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov3-openimages.cfg the class names from https://github.com/AlexeyAB/darknet/blob/master/data/openimages.names and the weights from your link above https://pjreddie.com/media/files/yolov3-openimages.weights, but i get very poor results. I have to drop the confidence down to 5% to get anything and then results are very generic (like 'Animal' for a 'bear', or another where yolov3 gives me 'diningtable', 'bottle', 'wine glass', 'knife', returns just 'Tool')

Using the same exact code to load and eval the model. Am I missing something?

streamnsight avatar Oct 16 '18 03:10 streamnsight

@AlexeyAB Can you also add support for yolo9000 please?

pratikbhave2 avatar Apr 26 '19 18:04 pratikbhave2

@AlexeyAB @pjreddie Can you please provide more information/support on yolo9000? How the data is prepared in a tree structure? How it is used for the model training?

kulkarnikeerti avatar Jul 28 '22 13:07 kulkarnikeerti