Tag Archives: cv2.error: OpenCV(4.2.0)

[Solved] Opencv Calls PB Model Error: cv2.error: OpenCV(4.2.0)…

 

Problem description

cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\src\dnn.cpp:562: error: (-2:Unspecified error) Can't create layer "feature_fusion/truediv" of type "RealDiv" in function 'cv::dnn::dnn4_v20191202::LayerData::getLayerInstance'


Solution:

It has three places to modified in model.py

1.  Comment out this line:  #images = mean_image_subtraction(images)
2. c1_1 = slim.conv2d(tf.concat([g[i-1], f[i]], axis=3), num_outputs[i], 1)
3. pi2 = 0.5 * np.pi
   angle_map = (slim.conv2d(g[3], 1, 1, activation_fn=tf.nn.sigmoid, normalizer_fn=None) - 0.5) * pi2
   F_geometry = tf.concat([geo_map, angle_map], axis=3)