Created
January 12, 2018 17:10
-
-
Save backnotprop/772ec81683e715f629f1793c75a3d4b1 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
# function ffwd, line 98 | |
# https://github.com/lengstrom/fast-style-transfer/blob/master/evaluate.py#L98 | |
if os.path.isdir(checkpoint_dir): | |
ckpt = tf.train.get_checkpoint_state(checkpoint_dir) | |
if ckpt and ckpt.model_checkpoint_path: | |
saver.restore(sess, ckpt.model_checkpoint_path) | |
########## add this for pre-trained models ########### | |
frozen_graph_def = tf.graph_util.convert_variables_to_constants(sess,sess.graph_def,['add_37']) | |
with open('output_graph.pb', 'wb') as f: | |
f.write(frozen_graph_def.SerializeToString()) | |
##################################################### | |
else: | |
raise Exception("No checkpoint found...") | |
else: | |
saver.restore(sess, checkpoint_dir) | |
########## add this for custom models ########### | |
frozen_graph_def = tf.graph_util.convert_variables_to_constants(sess,sess.graph_def,['add_37']) | |
with open('output_graph.pb', 'wb') as f: | |
f.write(frozen_graph_def.SerializeToString()) | |
##################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment