How to solve google.protobuf.message.DecodeError: Truncated message

479 Views Asked by At

I am using tensorflowjs_converter to convert my .pb model to json file using below code:

!tensorflowjs_converter --input_format tf_frozen_model --output_node_names='output_0' input/saved_model.pb output/

However, I got the following error

Traceback (most recent call last): File "/usr/local/bin/tensorflowjs_converter", line 8, in <module> sys.exit(pip_main()) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 813, in pip_main main([' '.join(sys.argv[1:])]) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 817, in main convert(argv[0].split(' ')) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 804, in convert weight_shard_size_bytes, metadata_map) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/converter.py", line 581, in _dispatch_converter metadata=metadata_map) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 521, in convert_tf_frozen_model graph = load_graph(frozen_model_path) File "/usr/local/lib/python3.7/dist-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 67, in load_graph graph_def.ParseFromString(f.read()) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/message.py", line 185, in ParseFromString self.MergeFromString(serialized) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/python_message.py", line 1083, in MergeFromString if self._InternalParse(serialized, 0, length) != length: File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/python_message.py", line 1120, in InternalParse pos = field_decoder(buffer, new_pos, end, self, field_dict) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/decoder.py", line 633, in DecodeField if value._InternalParse(buffer, pos, new_pos) != new_pos: File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/python_message.py", line 1120, in InternalParse pos = field_decoder(buffer, new_pos, end, self, field_dict) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/decoder.py", line 612, in DecodeRepeatedField if value.add()._InternalParse(buffer, pos, new_pos) != new_pos: File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/python_message.py", line 1120, in InternalParse pos = field_decoder(buffer, new_pos, end, self, field_dict) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/decoder.py", line 743, in DecodeMap if submsg._InternalParse(buffer, pos, new_pos) != new_pos: File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/python_message.py", line 1109, in InternalParse new_pos = local_SkipField(buffer, new_pos, end, tag_bytes) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/decoder.py", line 850, in SkipField return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/decoder.py", line 799, in _SkipGroup new_pos = SkipField(buffer, pos, end, tag_bytes) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/decoder.py", line 850, in SkipField return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end) File "/usr/local/lib/python3.7/dist-packages/google/protobuf/internal/decoder.py", line 814, in _SkipFixed32 raise _DecodeError('Truncated message.') google.protobuf.message.DecodeError: Truncated message.

0

There are 0 best solutions below