Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Please add more details when you refer a public models. I've found at least 3 YOLOv2 at https://pjreddie.com/darknet/yolo/ and they aren't similar. I hope YOLOv2 trained on COCO dataset with input size 608x608 is used. Am I right? OpenCV's sample works with 416x416 images for now so you need to modify a source code a bit:

from

Mat inputBlob = blobFromImage(frame, 1 / 255.F, Size(416, 416), Scalar(), true, false);

to

Mat inputBlob = blobFromImage(frame, 1 / 255.F, Size(608, 608), Scalar(), true, false);

One more thing that corresponding .cfg file has a confidence threshold inside:

thresh = .6

I don't know why Darknet ignore it but OpenCV consider this value to threshold detections with a low confidence. So you have to modify it too. In example,

thresh = .1

The result:

image description

Hidden objects has confidences about 0.4, 0.29, 0.37.