OpenCV DNN net.forward giving segmentation fault.

asked 2020-05-23 16:15:43 -0500

Himant gravatar image

updated 2020-05-23 21:18:14 -0500

supra56 gravatar image

I am using OpenVino recent kit : l_openvino_toolkit_runtime_raspbian_p_2020.2.120.tgz Raspberry - Pi4. Open CV 4.3.0-openvino.

Trying to use the OpenCV DNN with tensorflow net and also caffe. But getting segmentation fault at net.forward() call.

I am using ssd inception v2 .

Below is the code for tensorflow in Python . I do not know how to proceed and resolve it. I tried searching and could not find a working solution for this.

Steps I am doing ( the paths are configured correctly )

Initialize the tensorflow net

tensorflowNet = cv2.dnn.readNetFromTensorflow(PATH_TO_CKPT, PATH_TO_LABELS)

tensorflowNet.setPreferableTarget(cv2.dnn.DNN_TARGET_MYRIAD) ## set to use the NCS2

PASS THE BLOB TO TENSORFLOW NETWORK

blob = cv2.dnn.blobFromImage(frame, size=(300, 300), swapRB=True, crop=False)

pass the blob through the network and obtain the detections and

tensorflowNet.setInput(blob)

print ("Before forward")

detections =tensorflowNet.forward()

print("after forward")

It fails at .forward method.Console out put is as below.

pi@raspberrypi:~/guardeyelite $ python3 OpenCVTensorFlow.py Frame found

processing frame done

Before forward

Segmentation fault

I do not know how to proceed

edit retag flag offensive close merge delete