Error while reading DeepLabv3+ tensorflow model in OpenCV

asked 2018-09-13 13:57:10 -0500

datascientist gravatar image

I am getting the following error while trying to import the model for DeepLabv3+ semantic segmentation ( https://github.com/tensorflow/models/... ) in OpenCV using readNetFromTensorflow.

libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(3.4.3) /Users/snayak/opencv/opencv-3.4.3/modules/dnn/src/tensorflow/tf_importer.cpp:1145: error: (-213:The function/feature is not implemented) Unsupported squeeze configuration in function 'populateNet'

I used the frozen_inference_graph.pb file which is given at
http://download.tensorflow.org/models...

The tensorboard model graph is attached here.

Any help in resolving this would be greatly appreciated. Thanks !

edit retag flag offensive close merge delete

Comments

2

cc @dkurt ...

berak gravatar imageberak ( 2018-09-13 14:30:46 -0500 )edit
1

@berak, yeah, thank you. I just wanted to reproduce it today.

dkurt gravatar imagedkurt ( 2018-09-14 03:44:38 -0500 )edit

The model is full of support nodes such Assert. One of the solutions is to generate a text graph removing all non-deep learning nodes. You may do it by writeTextGraph excluding all the Constnodes or by script (in example from https://github.com/opencv/opencv/issu...).

dkurt gravatar imagedkurt ( 2018-09-14 05:54:38 -0500 )edit

@dkurt, I did that based on the script you provided above, but I still get the same error, this time initiated at line 1153 of tf_importer.cpp:

libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(3.4.3) /Users/snayak/opencv/opencv-3.4.3/modules/dnn/src/tensorflow/tf_importer.cpp:1153: error: (-213:The function/feature is not implemented) Unsupported squeeze configuration in function 'populateNet'

In the .pbtxt file, the squeeze_dims attribute in the Squeeze node looks like this: attr {key: "squeeze_dims" value {list {i: 0}}} This doesn't satisfy the conditions in tf_importer.cpp(lines 1143) under type == "Squeeze"(when using .pb file only with readNetFromTensorflow). When using the new .pbtxt file, datalayout conditions are not satisfied(1153).

datascientist gravatar imagedatascientist ( 2018-09-14 14:15:13 -0500 )edit