Tensorflow Object Detection API no train.py file
Asked Answered
A

4

13

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

Aecium answered 18/7, 2018 at 14:44 Comment(1)
You can show the loss with this fix.Kovacev
L
4

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.

Loehr answered 19/7, 2018 at 9:11 Comment(0)
M
8

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
Mcinerney answered 18/7, 2018 at 18:25 Comment(1)
Thank you. The point is that I run the model_main new script but it seems that it does not show the loss on the console. Using the previous script (train.py) I could clearly see on the console something like: step n -- loss: 2.5312 step n+1 --loss: 2.5310Aecium
M
6

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}
Mica answered 18/7, 2018 at 15:41 Comment(1)
are you saying that model_main.py does both train and evaluation? What if I would like to run them separately because I need to supervise the learning phase?Aecium
L
4

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.

Loehr answered 19/7, 2018 at 9:11 Comment(0)
H
3

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

Hyperpituitarism answered 18/7, 2018 at 17:53 Comment(5)
Is it normal that the new model_main script does not show the loss on the console? Or maybe there's something wrong in mt tf config?Aecium
You should see event files being generated by model_main. Visualize these in tensorboard to see the training loss.Hyperpituitarism
That's true Derek, but tf events are generated not at each step. They are record every 50-70 steps. This is why print the loss value on the console is useful.Aecium
Hello Derek, where can we modify to show loss value on the console as before when using model_main.py? Thank you and thank you, Giacomo, for asking this question.Immesh
I have the same question about the loss, still waiting for anyone's answer.Anacreon

© 2022 - 2024 — McMap. All rights reserved.