- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Keep getting the error when trying to read openvino ir :
import cv2 as cv
net = cv.dnn.readNet(XML, BIN)
cv2.error: OpenCV(4.5.2-openvino) /home/pi/opencv/modules/dnn/src/dnn.cpp:3901: error: (-2:Unspecified error) Build OpenCV with Inference Engine to enable loading models from Model Optimizer. in function 'readFromModelOptimizer'
I did install openvino and run the initialization script on my raspberry pi4b ( with MYRIAD ) as per instructions in:
https://www.intel.com/content/www/us/en/support/articles/000057005/boards-and-kits.html
The initialization command is:
source /home/pi/openvino_dist/bin/setupvars.sh
How can I use cv.dnn.readNet without the error ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Farhad,
OpenCV 4.5.2-openvino does not mean OpenCV is built with OpenVINO Inference Engine. This denotes that OpenVINO 4.5.2 support a certain version of OpenVINO, in this case, it is OpenVINO 2021.3 release.
The instructions in the article provide a simple way to build a minimal OpenCV used by OpenVINO. The usage of OpenCV in Open Model Zoo demo is to load image or video using cv2.imread(). The model is loaded using OpenVINO Inference Engine.
ie = IECore()
net = ie.read_network(model=model)
To run models in OpenVINO IR format via OpenCV DNN API, you need to build OpenCV with OpenVINO Inference Engine (OpenVINO backend) as described in this WIKI. For OpenCV compiled with OpenVINO Inference Engine, if you check with cv2.getBuildInformation(), it should look as below:
In summary, to build OpenCV with OpenVINO Inference Engine, you must have OpenVINO Inference Engine first and then build together with OpenCV. But in the shared article, we showed instructions on building OpenVINO Inference Engine from open source. And before building OpenVINO Inference Engine, we build OpenCV first but with the minimal option as we only use the basic OpenCV functionality.
Regards,
Peh
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Farhad,
This is due to the OpenCV does not build with OpenVINO support.
If you want to run models in OpenVINO IR format via OpenCV DNN API, you can install OpenVINO™ toolkit for Raspbian OS (l_openvino_toolkit_runtime_raspbian_p_2021.3.394.tgz
) and use OpenCV from OpenVINO. It's already compiled with Intel's Inference Engine.
Regards,
Peh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
As you can see in my comment, I did install openvino 2021.3 from this page:
https://www.intel.com/content/www/us/en/support/articles/000057005/boards-and-kits.html
And when I get the following commands the following on my raspberry pi 4b :
>>> cv2.__version__
'4.5.2-openvino'
So this means I have openvino opencv, correct?
But nevertheless I get the cv2 error. Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Farhad,
Yes, you are right. You have built the OpenCV but that OpenCV does not build with Inference Engine support. Meaning that the OpenCV is built with minimal options which can be used in running Open Model Zoo demos (read and load image/video). However, using this built OpenCV is unable to run models in OpenVINO IR format via OpenCV DNN API.
You can run the following code to check the built OpenCV information.
import cv2
print(cv2.getBuildInformation())
Regards,
Peh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
1. Running that command gives:
>>> print(cv2.getBuildInformation())
General configuration for OpenCV 4.5.2-openvino =====================================
Version control: 4.5.2-openvino
....
Do you need the rest of the output?
This showed that the OpenCV is the openvino version, which is what i showed before.
Please let me know how to make this work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again Peh:
This link:
( https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/OpenVino-2022-on-Raspberry-PI4-x64-with-Intel-Movidius-Neural/m-p/1374799 )
is to an answer you gave to a user earlier this year. I use your instruction there to install openvino on my raspberry pi4b
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Farhad,
OpenCV 4.5.2-openvino does not mean OpenCV is built with OpenVINO Inference Engine. This denotes that OpenVINO 4.5.2 support a certain version of OpenVINO, in this case, it is OpenVINO 2021.3 release.
The instructions in the article provide a simple way to build a minimal OpenCV used by OpenVINO. The usage of OpenCV in Open Model Zoo demo is to load image or video using cv2.imread(). The model is loaded using OpenVINO Inference Engine.
ie = IECore()
net = ie.read_network(model=model)
To run models in OpenVINO IR format via OpenCV DNN API, you need to build OpenCV with OpenVINO Inference Engine (OpenVINO backend) as described in this WIKI. For OpenCV compiled with OpenVINO Inference Engine, if you check with cv2.getBuildInformation(), it should look as below:
In summary, to build OpenCV with OpenVINO Inference Engine, you must have OpenVINO Inference Engine first and then build together with OpenCV. But in the shared article, we showed instructions on building OpenVINO Inference Engine from open source. And before building OpenVINO Inference Engine, we build OpenCV first but with the minimal option as we only use the basic OpenCV functionality.
Regards,
Peh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Farhad,
This thread will no longer be monitored since we have answered your question. If you need any additional information from Intel, please submit a new question.
Regards,
Peh
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page