You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.1 KiB

6 years ago
  1. # Running Locally
  2. This page walks through the steps required to train an object detection model
  3. on a local machine. It assumes the reader has completed the
  4. following prerequisites:
  5. 1. The Tensorflow Object Detection API has been installed as documented in the
  6. [installation instructions](installation.md). This includes installing library
  7. dependencies, compiling the configuration protobufs and setting up the Python
  8. environment.
  9. 2. A valid data set has been created. See [this page](preparing_inputs.md) for
  10. instructions on how to generate a dataset for the PASCAL VOC challenge or the
  11. Oxford-IIIT Pet dataset.
  12. 3. A Object Detection pipeline configuration has been written. See
  13. [this page](configuring_jobs.md) for details on how to write a pipeline configuration.
  14. ## Recommended Directory Structure for Training and Evaluation
  15. ```
  16. +data
  17. -label_map file
  18. -train TFRecord file
  19. -eval TFRecord file
  20. +models
  21. + model
  22. -pipeline config file
  23. +train
  24. +eval
  25. ```
  26. ## Running the Training Job
  27. A local training job can be run with the following command:
  28. ```bash
  29. # From the tensorflow/models/research/ directory
  30. PIPELINE_CONFIG_PATH={path to pipeline config file}
  31. MODEL_DIR={path to model directory}
  32. NUM_TRAIN_STEPS=50000
  33. SAMPLE_1_OF_N_EVAL_EXAMPLES=1
  34. python object_detection/model_main.py \
  35. --pipeline_config_path=${PIPELINE_CONFIG_PATH} \
  36. --model_dir=${MODEL_DIR} \
  37. --num_train_steps=${NUM_TRAIN_STEPS} \
  38. --sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \
  39. --alsologtostderr
  40. ```
  41. where `${PIPELINE_CONFIG_PATH}` points to the pipeline config and
  42. `${MODEL_DIR}` points to the directory in which training checkpoints
  43. and events will be written to. Note that this binary will interleave both
  44. training and evaluation.
  45. ## Running Tensorboard
  46. Progress for training and eval jobs can be inspected using Tensorboard. If
  47. using the recommended directory structure, Tensorboard can be run using the
  48. following command:
  49. ```bash
  50. tensorboard --logdir=${MODEL_DIR}
  51. ```
  52. where `${MODEL_DIR}` points to the directory that contains the
  53. train and eval directories. Please note it may take Tensorboard a couple minutes
  54. to populate with data.