BarzanHayati
BarzanHayati

Reputation: 941

Couldn't display YOLO result via OpenCV dnn module

I'm trying to train YOLO object detection via darknet(AlexeyAB or pjreddie) 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 training and testing. 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(numbers) 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

correct output for plate detection: 3

Upvotes: 2

Views: 1219

Answers (1)

BarzanHayati
BarzanHayati

Reputation: 941

I solved it. When we want to show the result using OpenCV and DNN module, we must consider the resizing ratio of the original image. For example when I have an 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

Upvotes: 1

Related Questions