November 2017
Intermediate to advanced
304 pages
6h 58m
English
def export_model(checkpoint_dir, export_dir, export_name, export_version):
graph = tf.Graph()
with graph.as_default():
image = tf.placeholder(tf.float32, shape=[None, None, 3])
processed_image = datasets.preprocessing(image, is_training=False)
with tf.variable_scope("models"):
logits = nets.inference(images=processed_image, is_training=False)
model_checkpoint_path = get_model_path_from_ckpt(checkpoint_dir)
saver = tf.train.Saver()
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.per_process_gpu_memory_fraction = 0.7
with tf.Session(graph=graph) as sess:
saver.restore(sess, model_checkpoint_path)
export_path = os.path.join(export_dir, export_name, str(export_version)) ...Read now
Unlock full access