我已经在colab上训练了yolo-tiny-v4,并且在colab上的检测效果很好。 然后,我尝试通过这种方式将yolo-tiny-v4加载到与Gazebo / ROS集成的Visual Studio中:
没有错误出现,但是检测失败(未检测到对象,检测的输出是Nan的向量)。 我在Visual Studio中使用的是OpenCV版本:4.2.0和Python 2.7.17。
有什么主意吗?
答案 0 :(得分:0)
尝试从源代码编译OpenCV >= v4.5.0
。
从源代码编译版本4.5.0在Python 3中为我解决了这个问题,我检查了它在Python 2.7中也可以使用。
最初,我在Raspberry Pi 4和Windows 7上都遇到了Yolo Tiny v4和Python 3.7的相同问题,并通过pip install opencv-contrib-python
安装了OpenCV(似乎不适用于Python 2.7吗?)。
我反复尝试了不同的版本,这些版本是从pip
获取的,或者是从源代码重新编译的(Raspbian上通过pip
提供的最新版本是4.1.0.25):
opencv-contrib-python==3.4.10.37 no detections (tested on Windows)
opencv-contrib-python==4.1.0.25: no detections (tested on Rasbian Buster and Windows)
opencv-contrib-python==4.2.0.34: no detections (tested on Windows)
opencv-contrib-python==4.3.0.38: no detections (tested on Windows)
opencv 4.4.0 compiled from sources: no detections (tested on Rasbian Buster)
opencv-contrib-python==4.4.0.40: ok (tested on Windows)
opencv-contrib-python==4.4.0.46: ok (testd on Windows)
opencv 4.5.0 compiled from sources: ok (tested on Rasbian Buster)
opencv-contrib-python == 4.4.0.40之后的版本似乎可行,因此当时Raspbian上可用的“下一个”版本是v4.5.0(来源)。