Outputs of a Keras model

Hello,

I can’t reach exactly the output I want in the Android application. I decorated the layers with a model inspired by a repository. I started training with my own data. I reviewed the original model on netron.app. When I examined mine, the difference I saw was the names of the outputs. For my output variable “class_layer7”, I have the random output name StatefulPartitionedCall:0. However, I think the model should have StatefulPartitionedCall:1. Can I rename it or is it enough to just change the name?

My Model:

Creating the model

input_layer = keras.Input((384, 384, 3))
base_model = tf.keras.applications.MobileNetV3Small(
input_tensor=input_layer, include_top=False, weights=‘imagenet’)

#outputs

class_layer7 = tf.keras.layers.Dense(16)(class_layer6)
bbox_layer4 = tf.keras.layers.Softmax()(bbox_layer3)

model = Model(inputs=input_layer, outputs=[class_layer7, bbox_layer4])
#BTW I swapped the places of outputs here but it didn’t work.

model.compile(optimizer=tf.keras.optimizers.Adam(),
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False),
metrics=[‘accuracy’])

#Train
model.fit(x_train, y_train, epochs=10, validation_data=(x_val, y_val))

converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
open(“mymodel.tflite”, “wb”).write(tflite_model)

Hi @ACanFirat,

In TensorFlow Lite (TFLite) models, “StatefulPartitionedCall” is a common output name, especially when converting from SavedModel format. As it is internally model generataed name during conversion for your output varaible “class_layer7” , it is advisable not to change the name. In “StatefulPartitionedCall:0:” 0 denotes the output index of the function call, means it’s the first output.
Thank You