python - 无法通过 OpenCV dnn 模块显示 YOLO 结果

标签 python opencv object-detection yolo dotnetnuke

我正在尝试通过暗网(AlexeyABpjreddie)训练 YOLO 对象检测,它非常适合通过

显示对象

./darknet detector test cfg/obj.data cfg/yolo-obj.cfg yolo.weights data/test.jpg

我使用 160*30 的图像进行训练和测试。我还通过 Tiny-YOLOv2 和另一个模型做到了,它可以检测图像中的所有数字。

但是当我想显示训练重量的结果和如下所示的特定图像时,并且通过使用 Opencv dnn 模块,我无法正确显示所有对象(数字)。

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

但是当我检查它以获得更大的图像(1280 * 760)时,它可以显示结果。

Input Image

板检测的正确输出: 3

最佳答案

我解决了。当我们想要使用 OpenCV 和 DNN 模块显示结果时,我们必须考虑原始图像的缩放比例。例如,当我有一个 160*30 输入图像时,首先我将其转换为 416*78(将宽度或高度之一调整为 416)。现在为了显示结果,我通过将高度乘以 416/78

来调整高度

关于python - 无法通过 OpenCV dnn 模块显示 YOLO 结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57337565/

相关文章:

python - Keras:当将相同的输入传递给两个函数时,为什么 train_on_batch() 和 test_on_batch() 的损失不同?

python - 我如何在具有不同 django 类的两个字段之间建立关系?

python-weka-wrapper3 M5P 返回 Java 错误

python - OpenCV Python : Detecting lines only in ROI

c++ - OpenCV - 分配运算符 "not working"?

java - Android Studio 中的 ndk.dir 错误

opencv - 匹配不同图像中同一对象的两个轮廓

python - 在python中动态创建变量

python - 从 tensorflow Object Detection API 返回 Json 或一些漂亮的东西

machine-learning - 需要有关实时视频上的对象检测和运动分类的建议