tensorflow / tensorflow/models

google.protobuf.text_format.ParseError: 1:2 : Extension "net" not registered. Did you import the _pb2 module which defines it

Open
#9,777 0 comments 0 reactions 3 assignees View on GitHub

Nobody has claimed this yet.

models:research:odapi type:bug
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • I checked to make sure that this issue has not been filed already.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/blob/master/research/object_detection/export_tflite_ssd_graph.py

2. Describe the bug

I trained a custom object detection model using darknet and saved the weights. Then I converted the .weights file into ckpt format using DW2TF. I am now trying to convert ckpt to frozen graph using export_tflite_ssd_graph. I am using this as I wish to add postprocessing op. However it throws the following error:

google.protobuf.text_format.ParseError: 1:2 : Extension "net" not registered. Did you import the _pb2 module which defines it. If you are trying to place the extension in the MessageSet field of another message that is in an Any or MessageSet field, that message's _pb2 module must be imported as well

3. Steps to reproduce

I am running the following command:
python object_detection/export_tflite_ssd_graph.py --pipeline_config_path custom_cfg/meter.cfg --trained_checkpoint_prefix /data/model.ckpt-0001 --output_directory my_frozen_graph --add_postprocessing_op True

4. Expected behavior

The code should run without any error and return the frozen graph.

5. Additional context

Traceback (most recent call last):
File "object_detection/export_tflite_ssd_graph.py", line 144, in
tf.app.run(main)
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "object_detection/export_tflite_ssd_graph.py", line 135, in main
text_format.Merge(f.read(), pipeline_config)
File "/usr/local/lib/python3.7/dist-packages/google/protobuf/text_format.py", line 737, in Merge
allow_unknown_field=allow_unknown_field)
File "/usr/local/lib/python3.7/dist-packages/google/protobuf/text_format.py", line 805, in MergeLines
return parser.MergeLines(lines, message)
File "/usr/local/lib/python3.7/dist-packages/google/protobuf/text_format.py", line 830, in MergeLines
self._ParseOrMerge(lines, message)
File "/usr/local/lib/python3.7/dist-packages/google/protobuf/text_format.py", line 852, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "/usr/local/lib/python3.7/dist-packages/google/protobuf/text_format.py", line 916, in _MergeField
'that message's _pb2 module must be imported as well' % name)
google.protobuf.text_format.ParseError: 1:2 : Extension "net" not registered. Did you import the _pb2 module which defines it? If you are trying to place the extension in the MessageSet field of another message that is in an Any or MessageSet field, that message's _pb2 module must be imported as well.

6. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
  • Mobile device name if the issue happens on a mobile device:
  • TensorFlow installed from (source or binary):
  • TensorFlow version (use command below): 1.15
  • Python version: 3.7
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.