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 .
import cv2 as cv
cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'txtfrozengraph.pbtxt')
img = cv.imread('cropped00019.jpg')
rows = img.shape
cols = img.shape
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)
if score > 0.8:
left = detection * cols
top = detection * rows
right = detection * cols
bottom = detection * rows
cv.rectangle(img, (int(left), int(top)), (int(right), int(bottom)), (23, 230, 210), thickness=2)
print(score, detection, detection, detection, detection)
key = cv.waitKey(0) & 0xFF
if key == ord("q"):
terminate called after throwing an instance of 'InferenceEngine::details::InferenceEngineException'
what(): ConfidenceThreshold parameter is wrong in layer detection_out. It should be > 0.
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.