My friends and I are partaking in a hackathon and are stuck on this one tutorial on training an object detection model:
https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html
But after three people have tried to follow the above tutorial to the letter, we are all stuck on the creating TfRecord step:
We get the error message:
ImportError: cannot import name 'string_int_label_map_pb2' from 'object_detection.protos'
We are three different people, with three different machines, getting this result, and have spent in total 20+ person-hours googling, retrying, sacrificing things to eldritch gods and nothing gets us passed this hurdle.
Is there a better way of achieving the result, or a fix for the issue? We are inexperienced with Tensorflow and are just wanting to use it to train a model that can be converted to an onnx model that will be consumed by ml.net.
The solution that works for me is as follows:
If you are creating a Virtual environment:
Run the command after you create the environment to change the Google file .protp
to .py
:
protoc object_detection/protos/*.proto --python_out=.
However, if you are still facing an error, you can simply run the code on a google colab notebook:
Protos Conversion to Python
%%cd /content/drive/MyDrive/TFOD1.x/models/research
!protoc object_detection/protos/*.proto --python_out=.
get the file in protoc folder, then copy it into the >models>research>protoc And (import step): Copy the folder to your environment path:
For example:
C:\Users\x04xx18\Anaconda3\envs\tfod1.x\libs\protos
This should fix the error for you!