Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AI and Deep Learning by (50.2k points)

I train a model and save it using:

saver = tf.train.Saver()

saver.save(session, './my_model_name')

Besides the checkpoint file, which simply contains pointers to the most recent checkpoints of the model, this creates the following 3 files in the current path:

  1. my_model_name.meta

  2. my_model_name.index

  3. my_model_name.data-00000-of-00001

I wonder what each of these files contains.

I'd like to load this model in C++ and run the inference. The label_image example loads the model from a single .bp file using ReadBinaryProto(). I wonder how I can load it from these 3 files. What is the C++ equivalent of the following?

new_saver = tf.train.import_meta_graph('./my_model_name.meta')

new_saver.restore(session, './my_model_name')

closed

1 Answer

0 votes
by (108k points)
selected by
 
Best answer

The equivalent of

new_saver = tf.train.import_meta_graph('./my_model_name.meta')

new_saver.restore(session, './my_model_name')

Is just

Status load_graph_status = LoadGraph(graph_path, &session);

The load operation needs the session in which to restore the graph definition or the path and variables.

For more information regarding the same, refer to the following link:

https://medium.com/jim-fleming/loading-a-tensorflow-graph-with-the-c-api-4caaff88463f#.goxwm1e5j

If you wish to learn about Tensor Flow visit this TensorFlow Tutorial.

Browse Categories

...