Description
Description of the problem
I notice running many different applications using opencv libraries are showing very significant performance difference when using the upstream python bindings vs. opencv-python. I verified this on Red Hat 7 and Fedora 30 / 31 Linux distributions. Fedora provides opencv python packages (3.4 series) which I also adapted to work on Red Hat Linux (modifying the RPM spec file to disable a couple of components not available in Red Hat).
When running the same code / applications slowdown is significant. Depending on the application it can take 3 to more than 10 longers. One of the tested application is: DeepLabCut. Switching only the opencv package and keeping the rest of the environment exactly the same, tripled the performance of our analysis time.
I tried to recompile the opencv-python locally using the setup.py and gcc-8 on CentOS 7, but it didn't make a big difference (there was a 10-20% improvement, but still very far away from the 300% observed with upstream build).
Looking at the cmake arguments in the RPM spec file and comparing it to the one in setup.py I cannot see anything that could explain the problem. I can see the Fedora RPM forces the use of OPENMP rather than using pthreads (and I understand opencv-python uses pthreads instead), not sure if this could be the primary cause of the issue. Sounds strange if it is though. I ran out of ideas and thought about opening this issue.
Expected behaviour
Same or close to same performance as upstream python bindings
Actual behaviour
Not entirely sure, but multiple applications are showing significant slowdowns when using this opencv-python rather than the upstream python binding
Steps to reproduce
- https://github.com/AlexEMG/DeepLabCut / any 3D reconstruction demo from the opencv example code should also work
- CentOS 7 / Fedora 30 - 31
- x86_64
- opencv-python both 29 and 30 (so opencv 3.4 and 4.2) seems to be affected
Thank your for any help.