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.
6406 Discussions

Problem with Faster RCNN model running on movidius NCS 2

s_3
Beginner
744 Views

I am using the latest openVINO version with python3 on the raspberry pi, and I am using the openCV of '4.1.0-openvino' as a soft link. 

I made a custom object detection model using the Tensorflow Object Detection API, the architecture used to build the model is 'faster_rcnn_inception_v2_coco' from the Tensorflow model zoo. I was able to execute the model and get expected results using the following code with the CPU as backend which is very slow on Raspberry pi, but I am getting an error when I tried using Movidius NCS 2 .

Executable code:

import cv2 as cv

cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'txtfrozengraph.pbtxt')
#cvNet.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
cvNet.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)
#cvNet.setPreferableTarget(cv.dnn.DNN_TARGET_CPU)

img = cv.imread('cropped00019.jpg')
rows = img.shape[0]
cols = img.shape[1]
cvNet.setInput(cv.dnn.blobFromImage(img, size=(920, 530), swapRB=True, crop=False))
cvOut = cvNet.forward()

for detection in cvOut[0,0,:,:]:
    score = float(detection[2])
    if score > 0.8:
        left = detection[3] * cols
        top = detection[4] * rows
        right = detection[5] * cols
        bottom = detection[6] * rows
        cv.rectangle(img, (int(left), int(top)), (int(right), int(bottom)), (23, 230, 210), thickness=2)

        print(score, detection[3], detection[4], detection[5], detection[6])

cv.imshow('img', img)
key = cv.waitKey(0) & 0xFF
if key == ord("q"):
    cv.destroyAllWindows()

ERROR:

terminate called after throwing an instance of 'InferenceEngine::details::InferenceEngineException'
  what():  ConfidenceThreshold parameter is wrong in layer detection_out. It should be > 0.
Aborted

I found a link who has similar issue    https://github.com/opencv/opencv/issues/14839

I tried to build the OpenCV from source, not succeded on the Raspberry pi, I wonder if there is any other way to resolve this error.

Any help would be appreciated.

Thanks in advance.

0 Kudos
2 Replies
Kenneth_C_Intel
Employee
744 Views

Hi this doesnt look like it uses our api, you would have to go to the opencv forum for help with this issue. 

 

0 Kudos
Shubha_R_Intel
Employee
744 Views

Dear saineni, sreekar,

Since you are using OpenCV for inference, please post your questions to :

https://answers.opencv.org/questions/

https://github.com/opencv/opencv

This forum is dedicated to Model Optimizer and Inference Engine API, both of which make up OpenVino.

Thanks,

Shubha

0 Kudos
Reply