Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
5765 Discussions

Problem with Windows 10 + OpenCV + Python and NCS2

RarDay
Beginner
803 Views

I read this community.intel.com/t5/Intel-Distribution-of-OpenVINO/Problem-with-Windows-10-OpenCV-Python-and-NCS2...

And my python can not find opencv:
When i install OpenVINO, i set in windows path:
C:\Program Files (x86)\Intel\openvino_2019.3.334\opencv\bin
C:\Program Files (x86)\Intel\openvino_2019.3.334\python\python3.7

but in console Python 3.7.8:

>>> import cv2
ModuleNotFoundError: No module named 'cv2'

 What i must do? what exactly should the environment variables be?

0 Kudos
13 Replies
Iffa_Intel
Moderator
748 Views

Greetings,


Try to run the command:

pip3 install opencv-python


Then try to import & check the version again.

For OpenVINO usage, make sure to run setupvars beforehand.


Sincerely,

Iffa


RarDay
Beginner
746 Views

@Iffa_Intel hmm but i do this, its wrong?

pip3 uninstall opencv-python
pip3 uninstall opencv-contrib-python
pip3 install opencv-python-inference-engine

 

and i have two setupvars, where it place

Iffa_Intel
Moderator
746 Views

Are you able to import the opencv after trying to install that again?


For OpenVINO usage I recommend you to go through this guide as there are other pre-requisite that is compulsory to have: https://docs.openvinotoolkit.org/latest/installation_guides.html


OR you could follow the installation guide directly as the OpenVINO installation package does include OpenCV package together. Make sure you carefully follow the guide.



Sincerely,

Iffa


RarDay
Beginner
736 Views

@Iffa_Intel i can install openvino on Jetson Nano? pip install write "not for arm"

Iffa_Intel
Moderator
725 Views

pip is basic python package installer: https://pypi.org/project/pip/

If you can install python means you can use pip.


Raspberry pi is also an arm-based controller that can use python and thus pip.


Try to study Python and it's packages functionality: https://pypi.org/project/opencv-python/


Although Jetson Nano does not officially validated to work with OpenVINO there are some other customers that attempt to do so: https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Installing-Openvino-Security-Barrier-C...


Please hellp to install according to your OS:https://docs.openvinotoolkit.org/latest/installation_guides.html


FYI, I don't think you will be able to use NCS2 without installing OpenVINO toolkit since you need the NCS2 plugin that came with the tookit.


Sincerely,

Iffa




RarDay
Beginner
711 Views

@Iffa_Intel 
Question:
How can I run my Python script using NCS2 after installing OpenVINO? What should I import into the IDE which libraries?

 

P.S. Below is not important information

This is just unbelievable, I just want to run face recognition in Python, I've spent a million hours and nothing works, why is everything so complicated
Let's start from the beginning
I opened a website docs.openvinotoolkit.org/2019_R2/_docs_install_guides_installing_openvino_windows.html
I performed all the actions without errors, reached the point I needed " Run the Sample Application"
I launch the item " For VPU (Intel Movidius NCS and Intel ® NCS2)" "classification_sample.exe -i "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\demo\car.png" -m "C:\Users<username>\Documents\squeezenet1.1_FP16\squeezenet1.1.xml" -d MYRIAD"
But I don't have a **bleep**ing "classification_sample" where I should get it
There is a "classification_sample_async" that cannot be started due to the lack of a million dlls such as tbb, inference_engine and others

All I could do was run the sample " demo_security_barrier_camera. bat"

 

Iffa_Intel
Moderator
704 Views

Greetings,

It would be piece of cake if you followed the setup as the guide I provided before.

https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_windows.htm...

I recommend you use the latest OpenVINO which is 2021.2

  1. Install the Intel® Distribution of OpenVINO™ toolkit core components
  2. Install the dependencies:
  3. Set Environment Variables
  4. Configure the Model Optimizer
  5. Install the drivers and software for the Intel® Vision Accelerator Design with Intel® Movidius™ VPUs

Once you got these right, RUN the verification script (navigate to verification script section): 

https://docs.openvinotoolkit.org/2020.3/_docs_install_guides_installing_openvino_windows.html

 

After you've got these right, then only you could proceed to more complex implementation.

Please note that, if you fail to do this, it means you did not setup OpenVINO properly, and you won't be able to move further.

 

For face recognition sample application, you will need to use model_downloader to download models required by the sample application to run.

 

in cmd, run setupvars in <openvino location>\bin

Next, cd <openvino location>\deployment_tools\tools\model_downloader

download the models:

1.Python downloader.py --name face-detection-0200

2.Python downloader.py --name facial-landmark-35-adas-0002

3.Python downloader.py --name head-pose-estimation-adas-0002

4.Python downloader.py --name age-gender-recognition-retail-0013

 

Then, use them with interactive_face_detection_demo.

Please help to refer to this video for clearer steps:

https://www.youtube.com/watch?v=HEntm0TUqM8

 

NOTE: to run the sample application with NCS2, change the -d CPU to -d MYRIAD when running the sample. Make sure you had followed the additional steps to setup vpu or also known as NCS2. I did mention it above.

 

You need to take the food on the spoon, otherwise, there's no point in explaining detailed steps.

 

Sincerely,

Iffa

 

 

 

RarDay
Beginner
695 Views

@Iffa_Intel 
I talked to MartyG-RealSense from Intel and he advised me to use 2019.
"This particular example program was most recently tested with OpenVINO 2019 R3 in late 2019."

Okay i install last version

p.s. i have CMake 3.19, Visual Studio 2019, Python 3.8 and set Environment Variables and install the Intel Distribution of OpenVINO toolkit

Iffa_Intel
Moderator
676 Views

Let me know if you need further help.

I recommend the latest OpenVINO because certain known bugs previously found were fixed in this latest version.


Plus, the version of model that you are using with the sample application(face detection demo, etc) need to be the same version as the OpenVINO toolkit you have in your system. Hence, if you are trying to use older version, you need to download them manually: https://download.01.org/opencv/2019/open_model_zoo/R3/20190905_163000_models_bin/


The model_downloader generally download the latest version model.



Sincerely,

Iffa




RarDay
Beginner
673 Views
RarDay
Beginner
660 Views

@Iffa_Intel i install last version and run .\demo_security_barrier_camera.bat -d GPU
and it give me 66 fps
then i run .\demo_security_barrier_camera.bat -d MYRIAD and have 25fps

 

[ INFO ] InferenceEngine: API version ......... 2.1 Build ........... 2021.2.0
[ INFO ] Loading device MYRIAD
[ INFO ] MYRIAD myriadPlugin version ......... 2.1
[ INFO ] Loading detection model to the MYRIAD plugin
[ INFO ] Loading Vehicle Attribs model to the MYRIAD plugin
[ INFO ] Loading Licence Plate Recognition (LPR) model to the MYRIAD plugin
[ INFO ] Number of InferRequests: 1 (detection), 3 (classification), 3 (recognition)
[ INFO ] Display resolution: 1920x1080
[ INFO ] Number of allocated frames: 3

 

I pulled NCS2 from the USB and the program did not start, respectively, he sees it and everything is installed correctly

Q: Is fps supposed to decrease when using NCS2? Or am I still doing something wrong?

Iffa_Intel
Moderator
641 Views

Hi,

Good Job!

You are now having the correct setup of OpenVINO.


That behaviour of NCS2/MYRIAD is expected since this is an accelerator device. Hence it does not have a powerful computing power as CPU. That is why you are getting less FPS in NCS2.


You need to make sure the NCS2 keep attached to the USB port as long as the inferencing is happening.

Remember, when you define -d MYRIAD, you are using the NCS2 as processing hardware. If it's unplugged, the program would not start or it would stopped.


Change to -d CPU or -d GPU if you decide to not using NCS2.



Sincerely,

Iffa



Iffa_Intel
Moderator
593 Views

Greetings,


Intel will no longer monitor this thread since we have provided a solution. If you need any additional information from Intel, please submit a new question. 



Sincerely,

Iffa


Reply