13
votes

I've correctly installed Tensorflow Object Detection API according to the provided documentation. However, when I need to train my network there is no train.py file in the research/object_detection directory. Is there anything I can do to fix this?

Link: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

4
You can show the loss with this fix. - maxeh

4 Answers

4
votes

in the newest merge the train and eval moved to legacy dir. You can go to a previous version if you work with a tutorial.

8
votes

For some clarification, as aforementioned by Derek Chow, it seems the train and evaluation python scripts were recently (~6 days ago) moved into the 'legacy' directory. Assuming you wanted to continue using the old way..

If one was beginning training by calling:

python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config

One would know begin training by calling:

python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
6
votes

You should refer to Running locally section on the tutorial page.

Here is the sample configuration:

#From the tensorflow/models/research/ directory
PIPELINE_CONFIG_PATH={path to pipeline config file}
MODEL_DIR={path to model directory}
NUM_TRAIN_STEPS=50000
NUM_EVAL_STEPS=2000
python object_detection/model_main.py \
    --pipeline_config_path=${PIPELINE_CONFIG_PATH} \
    --model_dir=${MODEL_DIR} \
    --num_train_steps=${NUM_TRAIN_STEPS} \
    --num_eval_steps=${NUM_EVAL_STEPS} \
    --alsologtostderr 

and to run tensorboard:

tensorboard --logdir=${MODEL_DIR}
3
votes

You can use the legacy train and evaluation scripts, but we recommend using model_main.