Convert SavedModel to Frozen Graph

Hello!

I am trying to convert a TF2 saved model into a frozen graph so that I can load it into TensorBoard in order to figure out what the input/output node names are. Everything that has to do with conversions to frozen graphs seems to be deprecated. And when I try to load the SavedModel file into tensorboard it is overly complicated and doesn’t show input/output node names. Would anyone be able to help with this please?

Thank,
Ahmad

1 Like

I guess this is not possible anymore. The SavedModel serialization format is the only format nowadays supported.

You can use the saved_model_cli tool to inspect the content of the saved model and understand what graphs are stored inside and what are the inputs and outputs.

The typical usage of saved_model_cli is as follows

 saved_model_cli show --all --dir saved_model_folder

This should show you the content of the saved model.

2 Likes

Thank you sir! This was really helpful.

Do you have any knowledge of loading SavedModels into Tensorboard? I am able to do so but it results in very complicated graphs that aren’t very useful to what I need them for.

1 Like

I guess you can load the SavedModel as a Keras model

model = tf.keras.models.load_model(saved_model_path)

and once you have it, you can follow the answer I wrote on StackOverflow about how to graph any graph (the call method of a Keras model is always decorated with tf.function hence the same answer applies).

Here’s the answer on SO: python 3.x - How to graph tf.keras model in Tensorflow-2.0? - Stack Overflow

Hope it helps

2 Likes

Thank you so much for your help; I really appreciate it! I’ll give it a try.

2 Likes