[PYTHON] Solution for run-time error in OpenVINO IEPlugin.load ()

Introduction

Since I took OpenVINO hands-on, I was addicted to it when I tried to run it on my home PC, so I will make a note of it. Hands-on was done with Raspberry Pi + Neural Compute Stick. (Because Intel CPU is required) I followed the procedure with reference to this site Deep learning starting with OpenVINO, but I was worried about runtime errors with real-time face detection. I hope it will be a solution for those who are similarly addicted to it.

What is OpenVINO

OpenVINO is a toolkit for easily enabling computer vision and deep learning inference in visual applications at the edge. OpenVINO toolkit

Operating environment

Run-time error

There is an error in the OpenVINO library. I searched on StackOverflow etc., but none of them solved it.

{'data': <openvino.inference_engine.ie_api.InputInfo object at 0x1054d3578>}
<openvino.inference_engine.ie_api.IEPlugin object at 0x1054d34a8>
Traceback (most recent call last):
  File "sample.py", line 19, in <module>
    exec_net = plugin.load(network=net)
  File "ie_api.pyx", line 547, in openvino.inference_engine.ie_api.IEPlugin.load
  File "ie_api.pyx", line 557, in openvino.inference_engine.ie_api.IEPlugin.load
RuntimeError: Unsupported primitive of type: PriorBoxClustered name: fc7_mbox_priorbox

The place where the error is occurring is plugin.load (). The model file path is correct and the file exists. (I checked many times) There was a statement that you should use the FP32 version on your PC, but the error did not change even with the FP16 version.

#Model loading
net = IENetwork(model='FP32/face-detection-retail-0004.xml', weights='FP32/face-detection-retail-0004.bin')
exec_net = plugin.load(network=net)

solution

When using the CPU, add_cpu_extension () required an additional library.

#Specifying the target device
plugin = IEPlugin(device="CPU")
plugin.add_cpu_extension('/opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/libcpu_extension.dylib')

Set the path according to your environment. If you build the environment according to the procedure, you will get the above path.

reference

To use the built-in camera on your MacBook, refer to the following. Capture video from Mac built-in camera with python

cap = cv2.VideoCapture(0)

in conclusion

The runtime error of OpenVINO has been resolved, and real-time recognition using the camera is now possible. First of all, I would like to try various things using the prepared model.

Recommended Posts

Solution for run-time error in OpenVINO IEPlugin.load ()
All-round solution for permission error (permmision error)
Solution for scikit-learn (sklearn) fetch_mldata error
Solution for ValueError in Keras imdb.load_data
Solution for pip install error [Python] [Mac]
Solution for "Import Error: No module named requests"
Error in random.shuffle
Error in Pyinstaller
Error in TensorBoard
Matplotlib Runtime Error resolution
Error handling in PythonBox
Solution for MacOS Catalina (10.15.2), python pip causes OpenSSL error in environment updated from old OS
zipimporter error in pyramid
[Python] for statement error
Solution if you get 0xxx ascii coding error in superset
Get own process name at runtime in C / C ++ (for Linux)