Tiny yolo v4 dnn module opencv no detection

Viewed 1918

I'have trained yolo-tiny-v4 on colab and the detection works well on colab. Then I've tried to load the yolo-tiny-v4 in this way on visual studio integrated with Gazebo/ROS:

enter image description here

No error appears, but the detection fails (no object detected, the output of the detection is a vector of Nan). I'm using OpenCV Version: 4.2.0 and Python 2.7.17 in visual studio.

Any idea?

1 Answers

Try compiling OpenCV >= v4.5.0 from sources.

Compiling version 4.5.0 from sources solved the issue for me in Python 3 and I checked it also works in Python 2.7.

I initially got the same issue with Yolo Tiny v4 and Python 3.7, both on Raspberry Pi 4 and Windows 7, with OpenCV installed via pip install opencv-contrib-python (seems not available for Python 2.7 ?). I tried different versions iteratively, got from pip or recompiled from sources (latest version available via pip on Raspbian was 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)

Versions a little after opencv-contrib-python==4.4.0.40 seemed to works, so the "next" version available on Raspbian at the time was v4.5.0 from sources.

Related