models icon indicating copy to clipboard operation
models copied to clipboard

DecodeError: Error parsing message

Open LXWDL opened this issue 8 years ago • 6 comments

I encountered the following error when I was testing on the picture or calling the camera. Traceback (most recent call last): File "object_detection_tutorial.py" line 61,in od_graph_def.ParseFromString(serialized_graph) google.protobuf.message.DecodeError: Error parsing message I tried a different version of Protobuf and looked at the following comment on the same question but none of it solved. anyone know how to solve it? I use the environment is Window10+tensorflow 1.6+CPU+Protobuf3.5.2 version, thank you.

LXWDL avatar Apr 02 '18 02:04 LXWDL

@LXWDL Could you give me a link or show me which file you ran to get the error? Thanks!

yhliang2018 avatar Apr 03 '18 03:04 yhliang2018

I'm also getting this error, and it seems to occur during any function that calls graph parsing protos. A simple example would be a standard use of tensorflow/python/tools/freeze_graph.py (including --input_binary=true), which returns the following:

Traceback (most recent call last):
  File "tensorflow/python/tools/freeze_graph.py", line 382, in <module>
    run_main()
  File "tensorflow/python/tools/freeze_graph.py", line 379, in run_main
    app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "tensorflow/python/tools/freeze_graph.py", line 378, in <lambda>
    my_main = lambda unused_args: main(unused_args, flags)
  File "tensorflow/python/tools/freeze_graph.py", line 272, in main
    flags.saved_model_tags, checkpoint_version)
  File "tensorflow/python/tools/freeze_graph.py", line 231, in freeze_graph
    input_graph_def = _parse_input_graph_proto(input_graph, input_binary)
  File "tensorflow/python/tools/freeze_graph.py", line 172, in _parse_input_graph_proto
    input_graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message

Somewhere I'd seen it suggested that variant sizes be changed to permit far greater values (in protobuf/io/coded_stream.h), but intuitively this seems hacky. And anyway, these results are consistent for protobuf 3.4.0 through 3.5.2.

I think the most likely case is that some variables are being called to be parsed that should be excluded from an inference graph popsicle. Would it really be so terrible to make name fields required? Noobies like me might go spending a bunch on gcloud ml-engine time only to get their results and realize they should have done that. Aside from extra keystrokes, I don't see how requiring reasonable organization is...well...unreasonable.

npeirson avatar Apr 29 '18 22:04 npeirson

try this

_EXPORT_DIR='path_to_exported_graph' with tf.Session(graph=tf.Graph()) as sess: tf.saved_model.loader.load(sess, [tf.saved_model.tag_constants.SERVING], _EXPORT_DIR) trainable_coll = sess.graph.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES) vars = {v.name:sess.run(v.value()) for v in trainable_coll}

tkngoutham avatar Aug 22 '18 18:08 tkngoutham

Closing this issue due to no response from the issue author. Feel free to reopen the issue when additional information is available. Thanks!

ymodak avatar Dec 05 '18 21:12 ymodak

Same problem,but I have no idea....

ghost avatar Dec 13 '18 12:12 ghost

I'm also getting this error, and it seems to occur during any function that calls graph parsing protos. A simple example would be a standard use of tensorflow/python/tools/freeze_graph.py (including --input_binary=true), which returns the following:

Traceback (most recent call last):
  File "tensorflow/python/tools/freeze_graph.py", line 382, in <module>
    run_main()
  File "tensorflow/python/tools/freeze_graph.py", line 379, in run_main
    app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "tensorflow/python/tools/freeze_graph.py", line 378, in <lambda>
    my_main = lambda unused_args: main(unused_args, flags)
  File "tensorflow/python/tools/freeze_graph.py", line 272, in main
    flags.saved_model_tags, checkpoint_version)
  File "tensorflow/python/tools/freeze_graph.py", line 231, in freeze_graph
    input_graph_def = _parse_input_graph_proto(input_graph, input_binary)
  File "tensorflow/python/tools/freeze_graph.py", line 172, in _parse_input_graph_proto
    input_graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message

Somewhere I'd seen it suggested that variant sizes be changed to permit far greater values (in protobuf/io/coded_stream.h), but intuitively this seems hacky. And anyway, these results are consistent for protobuf 3.4.0 through 3.5.2.

I think the most likely case is that some variables are being called to be parsed that should be excluded from an inference graph popsicle. Would it really be so terrible to make name fields required? Noobies like me might go spending a bunch on gcloud ml-engine time only to get their results and realize they should have done that. Aside from extra keystrokes, I don't see how requiring reasonable organization is...well...unreasonable.

Have you tried assigning --input_binary to False? I saw someone fixed the problem in this way.

anniezhi avatar Aug 07 '19 06:08 anniezhi