Tf-pose-estimation: How to save graph.pb in new version

Created on 1 Feb 2018  路  2Comments  路  Source: ildoonet/tf-pose-estimation

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

help wanted

All 2 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

khan958 picture khan958  路  3Comments

siddharthrajpatel picture siddharthrajpatel  路  4Comments

guofuzheng picture guofuzheng  路  6Comments

vladbelo picture vladbelo  路  4Comments

zerolim820 picture zerolim820  路  3Comments