There are several questions with the exact same error, such as:
But none of them were able to solve my problem. I tried the main solutions which I will describe later.
I have also tried contacting the author of the tutorial on the related Github repository, but they don't seem to be very responsive about it.
I am trying to replicate a workflow for object detecting on satellite images as detailed here
This walkthough is however intended for working directly on a machine and not on a Jupyter Notebook/Google Colab I think, because the steps are listed in such a way that you are installing everything from scratch.
I want to replicate this workflow on Google Colab so that I can use the free GPU.
I can get everything working up to the actual training, simply by trial and error and adjusting as I go. But I cannot get it to train properly.
I just always get this error:
Traceback (most recent call last):
File "train.py", line 49, in <module>
from object_detection import trainer
File "/usr/local/lib/python3.7/dist-packages/object_detection/trainer.py", line 27, in <module>
from object_detection.builders import preprocessor_builder
File "/usr/local/lib/python3.7/dist-packages/object_detection/builders/preprocessor_builder.py", line 21, in <module>
from object_detection.protos import preprocessor_pb2
ImportError: cannot import name 'preprocessor_pb2' from 'object_detection.protos' (/usr/local/lib/python3.7/dist-packages/object_detection/protos/__init__.py)
I have created a simplified Colab notebook here with links to the training data hosted on my Google Drive so that anyone can run it.
As you can see in the Colab, I install the package like this:
%cd /content/models/research
!python setup.py build
!pip install .
...
%cd /content/models/research
!protoc object_detection/protos/*.proto --python_out=.
%cd /content/models/research/object_detection
%env PYTHONPATH="/content/models/research:/content/models/research/slim"
!echo "PYTHONPATH is:"
!echo $PYTHONPATH
!python train.py --logtostderr \
--train_dir training/ \
--pipeline_config_path=training/ssd_inception_v2_coco.config
which implements the main solution in the other stackoverflow question threads at the beginning of this question. But it still complains about missing modules, and I don't know what else I can do to make it work.
Any ideas?