I am working with Tensorflow 2.0 and want to store the following Keras model as frozen graph.
import tensorflow as tf
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(64, input_shape=[100]))
model.add(tf.keras.layers.Dense(32, activation='relu'))
model.add(tf.keras.layers.Dense(16, activation='relu'))
model.add(tf.keras.layers.Dense(2, activation='softmax'))
model.summary()
model.save('./models/')
I can't find any good examples how to do this in Tensorflow 2.0. I have found the freeze_graph.py file in the Tensorflow Github repository but find it hard to wrap my head around it.
I load the file mentioned above using:
from tensorflow.python.tools.freeze_graph import freeze_graph
But what exactly do I have to provide to the freeze_graph
function itself? Here I marked the arguments where I am not sure with a questionmark.
freeze_graph(input_graph=?,
input_saver='',
input_binary=False,
input_checkpoint=?,
output_node_names=?,
restore_op_name='',
filename_tensor_name='',
output_graph='./frozen_graph.pb',
clear_devices=True,
initializer_nodes='')
Can someone provide a simple example that shows how I can store the model above as a frozen graph using the freeeze_graph
function?