User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cs:vision:object_detection:start [2018/03/30 16:56]
James Irwin [Generating Training Data]
cs:vision:object_detection:start [2018/03/31 19:46]
James Irwin [Getting a Model]
Line 80: Line 80:
  
 ====== Train Network ====== ====== Train Network ======
 +Instruction were adapted from [[https://​github.com/​tensorflow/​models/​blob/​master/​research/​object_detection/​g3doc/​running_locally.md | here]].
 +
 +===== Workspace Setup =====
 +Setup your workspace with the following directory structure:
 +  object_detection_workspace/​
 +  ├── data
 +  ├── models
 +  └── output
 +      ├── eval
 +      └── train
 +
 +data/ will hold your training data (label_map.pbtext,​ train.record,​ and test.record). output/ and its subdirectories hold the outputs of the training and evaluation programs. models/ will store the various network architectures you're experimenting with (you might just have one model).
 +
 +===== Getting a Model =====
 +Instructions were adapted from [[https://​github.com/​tensorflow/​models/​blob/​master/​research/​object_detection/​g3doc/​configuring_jobs.md | here]].
 +One of the advantages of using TFODA is that it is really easy to try different network architectures (models) and seeing their speed vs. accuracy tradeoffs. Example config files can be found [[https://​github.com/​tensorflow/​models/​tree/​master/​research/​object_detection/​samples/​configs : here]]. You'll need to modify these config files a bit for your own use. In addition, most of the models have network weights that have been pretrained on some dataset. Starting from these check-points is usually much faster than training from scratch. You can locate them [[https://​github.com/​tensorflow/​models/​blob/​master/​research/​object_detection/​g3doc/​detection_model_zoo.md | here]].
 +
 +Place the model config file and the pretrained ​ model in the models/ directory of your workspace.
 +
 +===== Start Training =====
 +The following command assume your current working directory is the root of the workspace you created earlier. To start training, run:
 +  python ~/​.local/​tensorflow_object_detection_api/​research/​object_detection/​train.py \
 +    --logtostderr \
 +    --pipeline_config_path=<​model config file> \
 +    --train_dir=
 +===== Exporting a trained model for inference =====
 +To export checkpoint trained data for ''​%%robosub_object_detection%%''​ format you need to follow [[https://​github.com/​tensorflow/​models/​blob/​master/​research/​object_detection/​g3doc/​exporting_models.md|these]] instructions. Or run this:
 +  python object_detection/​export_inference_graph.py \
 +      --input_type image_tensor \
 +      --pipeline_config_path ${PIPELINE_CONFIG_PATH} \
 +      --trained_checkpoint_prefix ${TRAIN_PATH} \
 +      --output_directory output_inference_graph.pb
 +
 +