2

I'm trying to train tensorflow object detection api on colaboratory.

When I run train.py as '%run train.py ...' I receive the error 'Duplicate flag error: the flag 'master' is defined twice.

When I run train.py as '!python train.py ...' I receive the error 'no module named deployment'.

I have set the path using: import sys

sys.path.append('/content/models/research/slim')
sys.path.append('/content/models/research')
sys.path.append('/content/models/research/object_detection') 

In addition I am running train from the object_detection directory. I'm not sure what else I need to do to run the train.py script successfully.

1 Answer 1

2

The below snippet is for setting up the tensorflow object detection api on colab specifically.

`

!apt-get install protobuf-compiler python-pil python-lxml python-tk
!pip install Cython
!pip install jupyter
!pip install matplotlib

!git clone https://github.com/tensorflow/models.git

%cd /content/models/research

!protoc object_detection/protos/*.proto --python_out=.

%set_env PYTHONPATH=/content/models/research:/content/models/research/slim

!python object_detection/builders/model_builder_test.py

`

On google colab, the above series of lines need to be executed in order to have your object detection api up and running. The actual details for installation are found here

The below line specifies how to run the train script

%run object_detection/train.py \
    --logtostderr \
    --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \
    --train_dir=${PATH_TO_TRAIN_DIR}

From the official documentation, all these scripts are run from within the

/models/research

directory. Not from within the object detection folder itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.