Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV object detection run error

  • OpenCV => 3.4
  • Operating System - Ubuntu 16.04
  • Python - 3.5

Following the instructions given in "TensorFlow Object Detection API" I'm trying to run my trained graph based on Inception v2 SSD in OpenCV, but I get the following errors: When I used not optimized for inference graph I get the following error:

[ INFO:0] Initialize OpenCL runtime...
OpenCV Error: Assertion failed (!_aspectRatios.empty()) in PriorBoxLayerImpl, file /io/opencv/modules/dnn/src/layers/prior_box_layer.cpp, line 207
Traceback (most recent call last):
  File "opencvInf.py", line 9, in <module>
    cvOut = cvNet.forward()
cv2.error: /io/opencv/modules/dnn/src/layers/prior_box_layer.cpp:207: error: (-215) !_aspectRatios.empty() in function PriorBoxLayerImpl

After that I tried to optimize the graph using optimize_for_inference.py script, but it does not solve the problem: Now I get another error;

OpenCV Error: Unspecified error (Input layer not found: FeatureExtractor/InceptionV2/InceptionV2/Mixed_4c/Branch_0/Conv2d_0a_1x1/BatchNorm/FusedBatchNorm) in connect, file /io/opencv/modules/dnn/src/tensorflow/tf_importer.cpp, line 553
Traceback (most recent call last):
  File "opencvInf.py", line 3, in <module>
    cvNet = cv.dnn.readNetFromTensorflow('opt_graph.pb', 'graph.pbtxt')
cv2.error: /io/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:553: error: (-2) Input layer not found: FeatureExtractor/InceptionV2/InceptionV2/Mixed_4c/Branch_0/Conv2d_0a_1x1/BatchNorm/FusedBatchNorm in function connect

Could somebody tell how to solve this?