- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I am currently trying to get an NCS2 to run on a Windows 10 computer with Python and OpenCV. I did it under Rasperry and now I wanted to run the same network + Python script on the Windows 10 PC. Unfortunately, nothing works. Have already changed the environment variables etc. and reinstalled everything.
I'm now testing with Python versions 3.7 and 3.6. Not that this would have worked.
I always get this message:
error: (-215:Assertion failed) preferableBackend != DNN_BACKEND_OPENCV || preferableTarget == DNN_TARGET_CPU || preferableTarget == DNN_TARGET_OPENCL || preferableTarget == DNN_TARGET_OPENCL_FP16 in function 'cv::dnn::dnn4_v20190902::Net::Impl::setUpNet'
or
Build OpenCV with Inference Engine to enable loading models from Model Optimizer. in function 'cv::dnn::dnn4_v20190902::Net::readFromModelOptimizer'
And the version print from Python for OpenCV is always 4.1.2 (without OpenVino)
Can someone give me a tip, or does Python and the stick only work under Linux?
Thanks a lot
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are using OpenCV from system (or pip). To enable OpenCV from OpenVINO you should prepend directory "<openvino>/python/python3" to the PYTHONPATH. "print(cv2.__version__)" should output something like "4.1.2-openvino". Perhaps you've disabled OpenCV component during OpenVINO installation.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you run setupvars.bat before executing the script? What had it print? Check contents of PYTHONPATH environment variable: "echo %PYTHONPATH%"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
yes I have executed the batch.
With thtis command I get the following feedback:
C:\Program Files (x86)\IntelSWTools\openvino\python\python3.7
UPDATE:
It's this correct?
import cv2 as cv print(cv.__file__) >>> C:\Python\Python37\lib\site-packages\cv2\cv2.cp37-win_amd64.pyd
And this fond i in the Python Shell in the Path Browser
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are using OpenCV from system (or pip). To enable OpenCV from OpenVINO you should prepend directory "<openvino>/python/python3" to the PYTHONPATH. "print(cv2.__version__)" should output something like "4.1.2-openvino". Perhaps you've disabled OpenCV component during OpenVINO installation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
thank you for the tip, I've changed the path in the environment variable..and it works now :-)
For all who are interested, here is the code I use now in Python. Works under Windows 10 and Rasp 3 with the NCS2
import time import cv2 as cv cap = cv.VideoCapture(0) cap.set (cv.CAP_PROP_BUFFERSIZE,1) net = cv.dnn.readNet('person-detection-retail-0013.xml', 'person-detection-retail-0013.bin') net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD) while(True): ret, frame = cap.read() start = time.time() # Prepare input blob and perform an inference blob = cv.dnn.blobFromImage(frame, size=(640, 480), ddepth=cv.CV_8U) net.setInput(blob) out = net.forward() end = time.time() print("Time: "+format(end - start)+" Second") # Draw detected person on the frame for detection in out.reshape(-1, 7): confidence = float(detection[2]) xmin = int(detection[3] * frame.shape[1]) ymin = int(detection[4] * frame.shape[0]) xmax = int(detection[5] * frame.shape[1]) ymax = int(detection[6] * frame.shape[0]) if confidence > 0.25: cv.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0)) # Show image cv.imshow('frame',frame) if cv.waitKey(1) & 0xFF == ord('q'): break
THANK YOU for the great support
Peter
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page