pipidog / keras_to_tensorflow

A tutorial on converting your keras models to tensorflow .pb format for inference

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How would you know the output node name?

jageshmaharjan opened this issue · comments

How would you know the output node name is import/dense_3/Sigmoid
However the model.summary() is quite not exactly that name.

ps: without having to load the tensorboard and checking tf_board graph.

Remembered the simplest way (knew this):

tf.saved_model.simple_save(
    keras.backend.get_session(), dir_path+'/versionNo',
    inputs={'input': model.input},
    outputs={t.name: t for t in model.outputs}
)

And, from the terminal you can check input_node and output_node as:
saved_model_cli show --dir Misc/versionNo/ --all
The ouput is:

signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['input'] tensor_info:
    dtype: DT_FLOAT
    shape: (-1, 784)
    name: l1_input_input:0
The given SavedModel SignatureDef contains the following output(s):
outputs['last/Softmax:0'] tensor_info:
    dtype: DT_FLOAT
    shape: (-1, 10)
    name: last/Softmax:0
Method name is: tensorflow/serving/predict