unable to load Tensorflow DNN models based on mobilenet_v2

asked 2018-09-07 16:53:39 -0500

Hi,

Unable to load any pretrained convolutional dnn models available from tensorflow tf-slim project. In, particular, I am using the mobilenet_v2_1.0_224 model. I have exported the inference graph and frozen it with the available checkpoint training weights. (using export_inference_graph.py and freeze_graph.py scripts available in tensorfow). However, I get the following errors. I also tried optimizing the graph with optimize_for_inference.py and even applying various transformation with transform_graph.py to remove unnecessary nodes, but without success.

code:

Mat net = cv::dnn::readNetFromTensorflow("frozen_mobilenet_v2.pb");

error:

error: OpenCV(3.4.2) /home/david/Downloads/opencv-3.4.2/modules/dnn/src/tensorflow/tf_importer.cpp:5 32: error: (-2:Unspecified error) Const kernel input not found in function 'getConstBlob'

Here is an image of the graph captured from tensorboard:

image description

Any ideas for what is wrong?

Note: using the unoptimized frozen_mobilenet_v2.pb also results in no failure, but with different runtime error:

error: (-2:Unspecified error) Input layer not found: MobilenetV2/expanded_conv/output in functio n 'connect'

System information:

Linux debian 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux Tensorflow 1.9 OpenCV v3.4.2

If there's any information that might be helpful in diagnosing this issue, just let me know and I'll do my best to provide it. It looks like a very simple case, but I figured I'd ask before posting a github issue.
Thanks. dgs

edit retag flag offensive close merge delete