Device with "CPU" name is not registered in the InferenceEngine in function 'initPlugin'

asked 2019-12-02 00:35:10 -0500

raspi_opencv gravatar image

updated 2019-12-02 00:39:22 -0500

I am using two models to infer face and get embedding of the face. One model runs on Neural compute stick 2 for the inference and other models is running on CPU. I am running the code on raspberry pi4, but I get an error on my Raspberry pi whereas it run fine on my Mac pc. Any clue on why this could be happening?

[ WARN:0] global /home/jenkins/workspace/OpenCV/OpenVINO/build/opencv/modules/dnn/src/op_inf_engine.cpp (660) initPlugin DNN-IE: Can't load extension plugin (extra layers for some networks). Specify path via OPENCV_DNN_IE_EXTRA_PLUGIN_PATH parameter
Traceback (most recent call last):
  File "", line 355, in <module>
  File "", line 241, in recognize_faces_using_ncs
    vec = embedder.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'

Code Below:

def recognize_faces_using_ncs():
    detector = cv2.dnn.readNet("../caffe_models/ncs2/res10_300x300_ssd_iter_140000.xml",


    embedder = cv2.dnn.readNetFromTorch("../caffe_models/openface_nn4.small2.v1.t7")

    recognizer = None
    le = None
    with open("../Data/pickle_saving/recognizer.pickle", "rb") as rec:
        recognizer = pickle.loads(

    with open("../Data/pickle_saving/le.pickle", "rb") as lab_encod:
        le = pickle.loads(

    vs = VideoStream(src=0).start()

    while True:
        frame =
        frame = imutils.resize(frame, width=600)
        (h, w) = frame.shape[:2]

        image_blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)), 1.0, (300, 300), (104.0, 177.0, 123.0),

        detections = detector.forward()
        for i in range(0, detections.shape[2]):
            confidence = detections[0, 0, i, 2]

            if confidence > 0.5:
                box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
                (startx, starty, endx, endy) = box.astype("int")

                face = frame[starty:endy, startx:endx]
                (fh, fw) = face.shape[:2]

                if fw < 20 or fh < 20:

                faceBlob = cv2.dnn.blobFromImage(face, 1.0 / 255, (96, 96), (0, 0, 0), swapRB=True, crop=False)
                vec = embedder.forward()
edit retag flag offensive close merge delete


Does this help CPU?

supra56 gravatar imagesupra56 ( 2019-12-02 05:23:18 -0500 )edit

Hi, I am relatively new to both opencv and Neural networks..Can you please give me more details on what exactly needs to be done here? Do I have to do anything specific programmatically?

raspi_opencv gravatar imageraspi_opencv ( 2019-12-02 10:47:24 -0500 )edit

I haven't attempted OpenVINO. Did you copy from mac on pc to raspi 4?

supra56 gravatar imagesupra56 ( 2019-12-03 08:10:35 -0500 )edit