Malgo
Malgo

Reputation: 2168

How to fix 'google.protobuf.message.DecodeError: Error parsing message' while running optimize_for_inference.py

I am retraining mobilenet_v1_1.0_224 on my custom dataset. I have generated the required graph.pb file and want to run the model in an android app. Tried to run optimize_for_inference.py to generate an optimized file but got an error saying - google.protobuf.message.DecodeError: Error parsing message

I checked for protobuf installation and it is present. I am running the following -

!python tensorflow/tensorflow/python/tools/optimize_for_inference.py \
--input = model_output/graph_v1.pb \
--output = model_output/optimized_graph_v1.pb \
--input_names = input \
--output_names = MobilenetV1/Predictions/Reshape_1

Output:

Traceback (most recent call last):
  File "tensorflow/tensorflow/python/tools/optimize_for_inference.py", line 165, in <module>
    app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "tensorflow/tensorflow/python/tools/optimize_for_inference.py", line 83, in main
    input_graph_def.ParseFromString(data)
google.protobuf.message.DecodeError: Error parsing message

Am using tensorflow version 1.4.0

Upvotes: 1

Views: 6686

Answers (1)

Malgo
Malgo

Reputation: 2168

I removed the spaces before and after '=' while passing values to the arguments. Now it works fine

Upvotes: 2

Related Questions