Created
December 5, 2017 18:05
-
-
Save gauravkaila/40488786653776543a7a3af4e202ca57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
# Assuming object detection API is available for use | |
from object_detection.utils.config_util import create_pipeline_proto_from_configs | |
from object_detection.utils.config_util import get_configs_from_pipeline_file | |
import object_detection.exporter | |
# Configuration for model to be exported | |
config_pathname = ${Model_configuration} | |
# Input checkpoint for the model to be exported | |
# Path to the directory which consists of the saved model on disk (see above) | |
trained_model_dir = ${Model_dir_path} | |
# Create proto from model confguration | |
configs = get_configs_from_pipeline_file(config_pathname) | |
pipeline_proto = create_pipeline_proto_from_configs(configs=configs) | |
# Read .ckpt and .meta files from model directory | |
checkpoint = tf.train.get_checkpoint_state(trained_model_dir) | |
input_checkpoint = checkpoint.model_checkpoint_path | |
# Model Version | |
model_version_id = ${Enter_model_version} | |
# Output Directory | |
output_directory = ${Output_directory} + str(model_version_id) | |
# Export model for serving | |
object_detection.exporter.export_inference_graph(input_type='image_tensor',pipeline_config=pipeline_proto,trained_checkpoint_prefix=input_checkpoint,output_directory=output_directory) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment