tensorflow: Error converting the model to TF Lite

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04.4
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below): r1.6 commit: cbc658095ae228f2f557af47e4901d552573aa15
  • Python version: 3.5.2
  • Bazel version (if compiling from source): 0.11.1
  • GCC/Compiler version (if compiling from source): gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
  • CUDA/cuDNN version: N/A (build without support CUDA)
  • GPU model and memory: N/A (build without support CUDA)
  • Exact command to reproduce:

Describe the problem

Trained model, successfully froze, it works on the tensorflow android, using TensorFlowInferenceInterface. I try to convert this into a TF Lite format, but I get an error.

Source code / logs

bazel-bin/tensorflow/contrib/lite/toco/toco \
    --input_file=./test_model/frozen_graph.pb \
    --input_format=TENSORFLOW_GRAPHDEF \
    --output_file=./test_model/unet.tflite \
    --output_format=TFLITE \
    --input_array='input' \
    --input_data_type=FLOAT \
    --input_shape=2,192,320,1 \
    --inference_type=FLOAT \
    --inference_input_type=FLOAT \
    --output_array='final/Sigmoid' \
    --v=1
2018-03-13 21:07:12.711948: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 282 operators, 479 arrays (0 quantized)
2018-03-13 21:07:12.716274: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 282 operators, 479 arrays (0 quantized)
2018-03-13 21:07:12.716893: F tensorflow/contrib/lite/toco/graph_transformations/resolve_batch_normalization.cc:86] Check failed: mean_shape.dims() == multiplier_shape.dims()
Aborted (core dumped)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 10
  • Comments: 23 (9 by maintainers)

Most upvoted comments

You should not use graph.pbtxt(produced when training) to froze graph. You should use a eval.pbtxt to frozen_graph. Just like ziped files (each file contains a eval.pbtxt)in https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md

frozen_graph.zip Here is an example of a frozen graph