Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

OpenVINO OpenCV Python bindings

Wu__Haoyu
Beginner
2,191 Views

Hi, I am trying to use Python 3.6+ with OpenVINO on Ubuntu 16.04 (which comes with Python3.5 in default). I installed OpenVINO 2019R1.1 using install_gui.sh. I noticed that in the folder /opt/intel/openvino_2019.1.144/python/python3.7, there is no cv2-cpython-xxx.so file. The only available binding so file is in python3.5 folder. Is there a way to create a binding with python and OpenCV optimized by OpenVINO?

Thanks!

0 Kudos
6 Replies
Maksim_S_Intel
Employee
2,191 Views

You should build OpenCV yourself with Python 3.7. However, you can try to copy cv2*.so from python3.5 to python3.7 directory and rename it correspondingly.

0 Kudos
Shubha_R_Intel
Employee
2,191 Views

Dear Wu, Haoyu,

OpenCV questions are best addressed here:

https://answers.opencv.org/questions/

Thanks !

Shubha

0 Kudos
s_3
Beginner
2,191 Views

I am facing this error when i try to import opencv after copying the /home/pi/openvino/inference_engine_vpu_arm/python/python3.5/cv2.cpython-35m-arm-linux-gnueabihf.so file to my python3.7/site-packages. The file exists and the name used to import is correct.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: libinference_engine.so: cannot open shared object file: No such file or directory

0 Kudos
s_3
Beginner
2,191 Views

Solution:- Have to add the path for the file libinference_engine.so as /home/pi/openvino/inference_engine_vpu_arm/inference_engine/lib/armv7l/ 

in the file /etc/ld.so.conf.d/arm-linux-gnueabihf.conf of Raspbian Buster OS and run the command sudo ldconfig , now the cv2.cpython-35m-arm-linux-gnueabihf.so file can be imported as OpenCV to python site-packages.

0 Kudos
YuHwan__Park
Beginner
2,191 Views

Hi saineni, sreekar,

I'm solving the same problem about "ImportError: libinference_engine.so: cannot open shared object file: No such file or directory"

how to solve this problem?

could you tell me the solution in detail?

0 Kudos
Barauna__Guilherme
2,191 Views

saineni, sreekar wrote:

Solution:- Have to add the path for the file libinference_engine.so as /home/pi/openvino/inference_engine_vpu_arm/inference_engine/lib/armv7l/ 

in the file /etc/ld.so.conf.d/arm-linux-gnueabihf.conf of Raspbian Buster OS and run the command sudo ldconfig , now the cv2.cpython-35m-arm-linux-gnueabihf.so file can be imported as OpenCV to python site-packages.

In my installation the path to libinference_engine.so was slightly different, so I added this line:

~/openvino/inference_engine_vpu_arm/inference_engine/lib/raspbian_9/armv7l

to my ld.so.conf.d/arm-linux-gnueabihf.conf file. This solved the libinference_engine.so import error, but now raises a different import error:

libopencv_ml.so.4.0: cannot open shared object file

So, in the same spirit, I tried adding another line to the .conf file: 

~/openvino/inference_engine_vpu_arm/opencv/lib 

and ran sudo ldconfig once more. Now I'm back to having the original libinference_engine.so error as before :( Any ideas as to what I'm missing?

For context, I'm running raspbian buster on a RPi 4B 4GB, and I installed python 3.5.2 from a tar.gz download. My cv2.so is a symbolic link in the venv/lib/python3.5/site-packages pointing to ~/openvino/inference_engine_vpu_arm/inference_engine/python/python3.5/cv2.cpython-35m-arm-linux-gnueabihf.so

0 Kudos
Reply