I want to freeze the model. Then I find INPUT_GRAPH is needed in freeze_graph.py.
But graph.pb hasn't been saved in version. Then I try saving graph like following.
with tf.Graph().as_default() as graph:
net, pretrain_path, last_layer = get_network(args.model, q_inp_split[0])
graph_def = graph.as_graph_def()
with gfile.GFile(args.modelpath + '/graph.pb', 'wb') as f:
f.write(graph_def.SerializeToString())
Unfortunately, the size of graph.pb is 128 byte.Obviously锛宨t fails.
So, my question is how to save graph.pb in new version.
@ildoonet
@ztwe
I wrote graph file using below codes
with tf.Session(config=config) as sess:
net, _, last_layer = get_network(args.model, input_node, sess, trainable=False)
tf.train.write_graph(sess.graph_def, './tmp', 'graph.pb', as_text=True)
After this, I made frozen graph and optmized graph. This is what you need : https://github.com/ildoonet/tf-pose-estimation/blob/master/etcs/training.md#model-optimization-for-inference
Thanks! I find those code in run_checkpoint.py.