Open apatsekin opened 1 year ago
As I figured, PyPi's wheel has all 3rd party libs (including openblas) stuffed in, they are unpacked to opencv_contrib_python_headless.libs
during pip install
. I'm not getting the same result when following this build instruction. The resulting wheel doesn't unpack opencv_contrib_python_headless.libs
when installed. I guess that's where this issue comes from - discrepancy in usage of BLAS libs or sth like that.
Yes, the PyPI wheels are self-contained and include all the dependencies. This is achieved with auditwheel
tool which modifies the wheel after the build. It will bundle the dependencies into the wheel package.
As you wrote, your local build is most likely using different versions of 3rd party libraries. To replicate the CI environment that is used to build the PyPI wheels, you can use the Dockerfiles provided here: https://github.com/opencv/opencv-python/tree/4.x/docker/manylinux2014
System Information
OpenCV version: 4.6.0 Operating System / Platform: Ubuntu 20.04 Python 3.8.10 (default, Jun 22 2022, 20:18:18)
Detailed description
cv2.readNet().forward()
produces wrong results using manually built OpenCV compared to the wheel published on PyPi - opencv-contrib-python-headless.The output of .forward() is off by few pixels (5-10), confidence is off, sometimes significantly.
Concerns YOLOv5 (default model) converted to ONNX using their converting script.
When it produces correct results:
opencv-contrib-python-headless
from PyPiopencv-contrib-python-headless
When results are wrong:
opencv-contrib-python-headless
So apparently my manual built is not using some BLAS/CPU library that official build is using? Still looks like a bug, given that inference does work and it does produce results that look sane (but in reality are off).
Steps to reproduce
export.py
net.forward()
will be wrong, while it's right with opencv binaries from pypi.Build details:
Issue submission checklist