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.

36 lines
1.5 KiB

6 years ago
  1. # Exporting a trained model for inference
  2. After your model has been trained, you should export it to a Tensorflow
  3. graph proto. A checkpoint will typically consist of three files:
  4. * model.ckpt-${CHECKPOINT_NUMBER}.data-00000-of-00001
  5. * model.ckpt-${CHECKPOINT_NUMBER}.index
  6. * model.ckpt-${CHECKPOINT_NUMBER}.meta
  7. After you've identified a candidate checkpoint to export, run the following
  8. command from tensorflow/models/research:
  9. ``` bash
  10. # From tensorflow/models/research/
  11. INPUT_TYPE=image_tensor
  12. PIPELINE_CONFIG_PATH={path to pipeline config file}
  13. TRAINED_CKPT_PREFIX={path to model.ckpt}
  14. EXPORT_DIR={path to folder that will be used for export}
  15. python object_detection/export_inference_graph.py \
  16. --input_type=${INPUT_TYPE} \
  17. --pipeline_config_path=${PIPELINE_CONFIG_PATH} \
  18. --trained_checkpoint_prefix=${TRAINED_CKPT_PREFIX} \
  19. --output_directory=${EXPORT_DIR}
  20. ```
  21. NOTE: We are configuring our exported model to ingest 4-D image tensors. We can
  22. also configure the exported model to take encoded images or serialized
  23. `tf.Example`s.
  24. After export, you should see the directory ${EXPORT_DIR} containing the following:
  25. * saved_model/, a directory containing the saved model format of the exported model
  26. * frozen_inference_graph.pb, the frozen graph format of the exported model
  27. * model.ckpt.*, the model checkpoints used for exporting
  28. * checkpoint, a file specifying to restore included checkpoint files
  29. * pipeline.config, pipeline config file for the exported model