Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export the checkpoints to .pb format graph #10

Open
shishaozheng opened this issue Dec 13, 2017 · 1 comment
Open

Export the checkpoints to .pb format graph #10

shishaozheng opened this issue Dec 13, 2017 · 1 comment

Comments

@shishaozheng
Copy link

shishaozheng commented Dec 13, 2017

Hello, for some reason, I have to frozen the variables of checkpoints file and export the graph to pb file. After research the graph structure, I export the pb file successfully using flowing code:

output_node_names = ['digit_length/dense/BiasAdd','stack']
with tf.Session() as sess:
    # Restore the graph
    saver = tf.train.import_meta_graph(FLAGS.meta_path)

    # Load Weight
    saver.restore(sess, FLAGS.checkpoint_path)

    # Freeze the graph
    frozen_graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, output_node_names)

    # Save the frozen graph
    with open('output/svhnclassification.pb', 'wb') as output:
        output.write(frozen_graph_def.SerializeToString())

But then I don't know how to load this pb file, and input a image nparray into the graph to get the predict result. Could you help me?

Thanks

@NehaPathapati
Copy link

How did you find the output node names from checkpoints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants