Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't display YOLO result via OpenCV dnn module #3705

Closed
barzan-hayati opened this issue Aug 3, 2019 · 4 comments
Closed

Couldn't display YOLO result via OpenCV dnn module #3705

barzan-hayati opened this issue Aug 3, 2019 · 4 comments

Comments

@barzan-hayati
Copy link

@AlexeyAB
I'm trying to train YOLO object detection via darknet and it was great for showing object via ./darknet detector test cfg/obj.data cfg/yolo-obj.cfg yolo.weights data/test.jpg
I used 160*30 images for train and test. Also I did it via Tiny-YOLOv2 and another model and it could detect all numbers in the images.

But when I want to showing result for trained weight and a specific image like bellow, and by using Opencv dnn modules, I could not display all objects correctly.

YOLO Object Detection with OpenCV and Python
Deep Learning based Object Detection using YOLOv3 with OpenCV ( Python / C++)
YOLO object detection with OpenCV
YOLO object detection using OpenCV and Python
Exploring OpenCV’s Deep Learning Object Detection Library

But when I check it for a bigger image(1280*760), It could show results.

Input Image

@barzan-hayati
Copy link
Author

Correct output:
Correct Output

@barzan-hayati
Copy link
Author

correct output for plate detection:
3

@AlexeyAB
Copy link
Owner

AlexeyAB commented Aug 3, 2019

There are different approaches of resizing in Darknet and OpenCV-dnn: #232 (comment)

Try to Request feature, to use simple Resizing or Letter_box in the OpenCV-dnn module, there: https://github.com/opencv/opencv/issues

@barzan-hayati
Copy link
Author

@AlexeyAB Thanks for your respond.
I solved it. When we want to showing result using opencv and dnn module, we must consider ratio of resizing of original image. For example when I have a 160*30 input image, at first I convert it to 416*78(resizing one of the width or height to 416). Now for showing results, I resize height by multiplying it to 416/78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants