Ask Your Question

Revision history [back]

Failed to infer shapes for Convolution layer

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

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?