OpenCV object detection run error

asked 2018-03-30 06:21:56 -0600

Vahe gravatar image
  • 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?

edit retag flag offensive close merge delete

Comments

@Vahe, We need to know the difference between a public model and yours. What changes have been made in a config file? Moreover OpenCV 3.4.1 or higher is required. (according to wiki page).

dkurt gravatar imagedkurt ( 2018-03-30 06:28:30 -0600 )edit

The only change which I have done in original conf file during model training is that I have only 3 classes. I checked my OpenCV version is 3.4.0. Could it be the reason of this?

Vahe gravatar imageVahe ( 2018-03-30 06:36:35 -0600 )edit