0

I am trying to perform OCR using the Intel Movidius Neural Compute Stick 2. The OCR network that I am using is based on YOLO, and therefore has the graph structure saved as a .cfg file and the weights as a .weights file. I use OpenCV which was installed with Openvino on a Raspberry Pi 3b+. My code is given below:

import cv2

# load network
ocr_net  = cv2.dnn.readNetFromDarknet('ocr-net.cfg', 'ocr-net.weights')
ocr_net.setPreferableTarget(cv2.dnn.DNN_TARGET_MYRIAD)
ocr_net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)

# perform inference
im = cv2.imread('img_path.jpg')
blob = cv2.dnn.blobFromImage(im, swapRB=False)
ocr_net.setInput(blob)
result = ocr_net.forward()

On running this code, I get the following error:

Traceback (most recent call last):
  File "test.py", line 12, in <module>
    result = ocr_net.forward()
cv2.error: OpenCV(4.1.2-openvino) /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/dnn/src/op_inf_engine.cpp:704: error: (-215:Assertion failed) Failed to initialize Inference Engine backend: Device with "CPU" name is not registered in the InferenceEngine in function 'initPlugin'

If I change the inference target to cv2.dnn.DNN_TARGET_CPU and the inference backend to cv2.dnn.DNN_BACKEND_OPENCV, the model works fine and is able to correctly perform OCR. My openvino/openCV setup is also correctly installed since I can correctly run other Tensorflow/Caffe models using openCV (using readNetFromTensorflow()/readNetFromCaffe()).

The OCR network that I am attempting to use can be found here: cfg , weights .

Any help is appreciated!

John.Ludlum
  • 145
  • 3
  • 13

1 Answers1

0

From what I remember of Intel's documentation, the openVINO distribution of opencv.dnn cannot handle darknet models. On this page you can find a list of what I assume can be interpreted as all supported frameworks.

I'm currently trying to convert my darknet custom models to a tf.pb representation, no luck so far.