Failed to infer shapes for Convolution layer

asked 2020-01-17 12:12:53 -0500

Hi! I'm doing inference using OpenVINO's Gaze Estimation model: http://docs.openvinotoolkit.org/2019_...

My code looks like the following:

gaze_net = cv2.dnn.readNet(bin, xml)
layerNames = ["gaze_vector"]

left_eye = cv2.cvtColor(left_eye, cv2.COLOR_GRAY2BGR)
right_eye = cv2.cvtColor(right_eye, cv2..COLOR_GRAY2BGR)   # i had gray eyes because of detector

left_eye_image = cv2.dnn.blobFromImage(left_eye, size=(60, 60), ddepth=cv2.CV_8U)
right_eye_image = cv2.dnn.blobFromImage(right_eye, size=(60, 60), ddepth=cv2.CV_8U)

gaze_net.setInput(right_eye_image, 'right_eye_image')
gaze_net.setInput(left_eye_image, 'left_eye_image')
gaze_net.setInput(np.array(angles, dtype=np.float32), 'head_pose_angles')
gaze_net.forward(layerNames)

Eventhough I've checked lots of times for errors in input shapes:

print(right_eye_image.shape, left_eye_image.shape, np.array(angles, dtype=np.float32).shape)
(1, 3, 60, 60) (1, 3, 60, 60) (3,)

(which are fine), I'm getting this error:

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: Failed to infer shapes for Convolution layer (142) with error: New shapes [1,513,1,1] make Kernels(1x1), Channels(513), Output depth(320), Groups(1) not matching weights size: 164160 vs 164800 in function 'initPlugin'

Anyone might know what is causing this?

edit retag flag offensive close merge delete

Comments

Remove period.

right_eye = cv2.cvtColor(right_eye, cv2..COLOR_GRAY2BGR)

to:

right_eye = cv2.cvtColor(right_eye, cv2.COLOR_GRAY2BGR)

Also drop cv2 shoukld be like thsi:

ddepth=cv2.CV_8U

to

ddepth=CV_8U

I am uncertainty should be ddepth = CV_32F instead of CV_8U

supra56 gravatar imagesupra56 ( 2020-01-17 13:53:44 -0500 )edit