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.

pi + ncs2 error

dengyu
Novice
1,044 Views

python3 realtime_objectdetection_and_tracking.py
Traceback (most recent call last):
File "realtime_objectdetection_and_tracking.py", line 166, in <module>
net = cv2.dnn.readNet('models/mobilenet-ssd/FP16/mobilenet-ssd.xml', 'models/mobilenet-ssd/FP16/mobilenet-ssd.bin')
cv2.error: OpenCV(4.5.2) /home/pi/opencv/modules/dnn/src/dnn.cpp:3915: error: (-2:Unspecified error) Build OpenCV with Inference Engine to enable loading models from Model Optimizer. in function 'readFromModelOptimizer'

 

please help me

0 Kudos
8 Replies
Maksim_S_Intel
Employee
1,034 Views

Looks like you are using OpenCV which does not have integration with OpenVINO (InferenceEngine/nGraph) enabled. To verify it check output of the following command:

$ python3 -c "import cv2; print(cv2.__file__); print(cv2.getBuildInformation())"
... Other third-party libraries: Inference Engine: YES (...) * libs: ... * includes: ... nGraph: YES (...) * libs: ... * includes: ...
...

If you want to run OpenVINO models with OpenCV, you should use OpenCV built with OpenVINO support. It can be found in the OpenVINO package for Raspbian 9 or built manually.

0 Kudos
dengyu
Novice
1,014 Views

General configuration for OpenCV 4.5.2 =====================================
Version control: 4.5.2

Platform:
Timestamp: 2021-04-20T06:09:21Z
Host: Linux 5.10.17-v7l+ armv7l
CMake: 3.14.4
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release

CPU/HW features:
Baseline:
requested: DETECT

C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: /usr/bin/c++ (ver 8.3.0)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed
Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed
ccache: NO
Precompiled headers: NO
Extra dependencies: dl m pthread rt
3rdparty dependencies:

OpenCV modules:
To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc ml objdetect photo python2 python3 stitching ts video videoio
Disabled: world
Disabled by dependency: -
Unavailable: gapi java
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NO

GUI:
GTK+: YES (ver 2.24.32)
GThread : YES (ver 2.58.3)
GtkGlExt: NO
VTK support: NO

Media I/O:
ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.11)
JPEG: libjpeg-turbo (ver 2.0.6-62)
WEBP: build (ver encoder: 0x020f)
PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.36)
TIFF: build (ver 42 - 4.2.0)
JPEG 2000: build (ver 2.4.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
DC1394: NO
FFMPEG: YES
avcodec: YES (58.35.100)
avformat: YES (58.20.100)
avutil: YES (56.22.100)
swscale: YES (5.3.100)
avresample: NO
GStreamer: NO
v4l/v4l2: YES (linux/videodev2.h)

Parallel framework: pthreads

Trace: YES (with Intel ITT)

Other third-party libraries:
Lapack: NO
Eigen: NO
Custom HAL: NO
Protobuf: build (3.5.1)

OpenCL: YES (no extra features)
Include path: /home/pi/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.16)
Libraries: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.16)
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.16.2)
install path: lib/python2.7/dist-packages/cv2/python-2.7

Python 3:
Interpreter: /usr/bin/python3 (ver 3.7.3)
Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.7m.so (ver 3.7.3)
numpy: /usr/local/lib/python3.7/dist-packages/numpy/core/include (ver 1.20.2)
install path: lib/python3.7/dist-packages/cv2/python-3.7

Python (for build): /usr/bin/python2.7

Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO

Install to: /usr/local

 

Is this correct?

Thank you

0 Kudos
dengyu
Novice
1,012 Views

import os
from imutils.video import VideoStream
from imutils.video import FPS
import argparse
import time
import cv2
import numpy as np
from pyimagesearch.centroidtracker import CentroidTracker
from pyimagesearch.trackableobject import TrackableObject
import dlib

 

This is my model

0 Kudos
Maksim_S_Intel
Employee
1,005 Views

According to build information your OpenCV library is built without OpenVINO support, try to use OpenCV from OpenVINO toolkit package for Raspbian 9: https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_raspbian.html

0 Kudos
dengyu
Novice
1,001 Views

Do you mean my pi version is too new to support?

Which version of OPENVINO do I need to refer to?

Thank you

0 Kudos
Vladimir_Dudnik
Employee
995 Views

@dengyu OpenCV is flexible library, built on modular principles. The DNN module in OpenCV can be built  (it is build time option) with one of two supported inference backends. The first one is OpenVINO backend, and obviously, OpenCV library distributed as a part of OpenVINO install package is built with this backend. The second backend is OpenCV DNN inference module, developed with help of community, independently from OpenVINO, it is used by default in community OpenCV builds on Linux. Those backends are independent, may have different features, performance and functionality coverage, although available in OpenCV under the same OpenCV DNN API, so the usage is transparent for application (more or less). For example, OpenCV DNN inference backend support inference on nVidia GPU while OpenVINO backend does not support this (at least not for now). Both backends support inference on ARM CPU (although it is not default option for OpenVINO install package, but you may take a look on OpenVINO ARM CPU plugin readme to find how it can be built and used from open source OpenVINO contrib repository). 

So, what @Maksim_S_Intel  trying to say you is that it seems in your application at runtime community version of OpenCV library is used (which is built with OpenCV DNN backend by default). The recommendation is to ensure you can provide a path to OpenCV libraries from OpenVINO, those are built with OpenVINO backend by default.

Regards,
  Vladimir

0 Kudos
dengyu
Novice
971 Views

Yes i'm still studying.

Just getting started NCS2 and pi+python
Thank you, sir
0 Kudos
Peh_Intel
Moderator
924 Views

Hi Deng Yu,


This thread will no longer be monitored since we have provided suggestions. If you need any additional information from Intel, please submit a new question. 



Regards,

Peh


0 Kudos
Reply