0

I need step by step detailed instructions since I'm still a beginner.

I tried entering the following code:

import tensorflow.compat.v1 as tf

meta_path = './newcheckpoint/.meta' # Your .meta file
output_node_names = ['name_of_the_output_node']    # Output nodes

with tf.Session() as sess:
    # Restore the graph
    saver = tf.train.import_meta_graph(meta_path)

    # Load weights
    saver.restore(sess,tf.train.latest_checkpoint('./newcheckpoint/'))

    # 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('./freeze/output_graph.pb', 'wb') as f:
      f.write(frozen_graph_def.SerializeToString())

But I have no idea where to write this code (python? command prompt?) and do I have to change anything in this code? Like what do I put for name_of_the_output_node and ./newcheckpoint/.meta?

desertnaut
  • 57,590
  • 26
  • 140
  • 166

0 Answers0