Reputation: 139
I try to freeze the model generate in the tensorflow tutorial: https://www.tensorflow.org/get_started/estimator
The model generate files in /tmp/iris_model:
checkpoint
eval
events.out.tfevents.1516649318.xavier-OMEN-by-HP-Laptop
graph.pbtxt
model.ckpt-10.data-00000-of-00001
model.ckpt-10.index
model.ckpt-10.meta
model.ckpt-1.data-00000-of-00001
model.ckpt-1.index
model.ckpt-1.meta
When I try to freeze the model with the tools in tensorflow source I get that error:
python3 ./tensorflow/tensorflow/python/tools/freeze_graph.py /tmp/iris_model checkpoint '' doesn't exist!
Upvotes: 0
Views: 1072
Reputation: 32091
You should be loading model.ckpt-10.data-00000-of-00001
as such:
tf.reset_default_graph()
# Create some variables.
v1 = tf.get_variable("v1", shape=[3])
v2 = tf.get_variable("v2", shape=[5])
# Add ops to save and restore all the variables.
saver = tf.train.Saver()
# Later, launch the model, use the saver to restore variables from disk, and
# do some work with the model.
with tf.Session() as sess:
# Restore variables from disk.
saver.restore(sess, "/your/path/model.ckpt-10.data-00000-of-00001")
print("Model restored.")
# Check the values of the variables
print("v1 : %s" % v1.eval())
print("v2 : %s" % v2.eval())
The code above was copied from the TF documentation here:
https://www.tensorflow.org/programmers_guide/saved_model
Upvotes: 1