Keras TF2.0 SavedModel Input/Output Nodes

Hello!

I am trying to perform model conversions on a TensorFlow2.0 SavedModel and I need to know what the input nodes, input dimensions, and output nodes are. I am trying to use the ‘graph_transforms:summarize_graph’ tool but I keep getting the following error: Can’t parse saved_model.pb as binary proto (both text and binary parsing failed for file saved_model.pb)

I also tried to visualize the graph using Tensorboard, but it provides complicated graphs that are not so obvious.

Any recommendations?

Thanks,
Ahmad

1 Like

Have you tried using GitHub - lutzroeder/netron: Visualizer for neural network, deep learning, and machine learning models to visualize your model.
You may try using browser version that allows you to quickly upload your model and it displays op level graph.

1 Like

I did try that! It just displays the graph as complicatedly as Tensorboard does.

1 Like

So you are trying to view conceptual graph and not op level graph. TensorBoard allows you to view conceptual graph as well. Does this help Examinando o gráfico TensorFlow  |  TensorBoard ?

1 Like

For some reason I don’t have the option to view that when I load my model into Tensorboard. I am working with a pre-trained model and loading the model into Tensorboard using the ‘import_pb_to_tensorboard.py’ script provided by TensorFlow rather than writing into logs while training using a callback. Could that be the issue?

1 Like

I see that can be the reason. How about using tf.keras.utils.plot_model() function.
See tf.keras.utils.plot_model  |  TensorFlow Core v2.8.0

tf.keras.utils.plot_model(
    model=your_keras_model, to_file='model.png', show_shapes=True, show_dtype=True,
    show_layer_names=True, rankdir='TB', expand_nested=True, dpi=96
)

expand_nested=True will expand your pre trained model

1 Like