I understand that we can not re-train the weights from a Frozen Model, but is there any way to load it, and add a layer and train the extra layers at least ?
Hi @Mah_Neh, you can able to add the layers to the base model and train the model. For example
#instantiate a base model with pre-trained weights.
base_model = tf.keras.applications.Xception(
weights='imagenet',
# image shape = 128x128x3
input_shape=(128, 128, 3),
include_top=False)
# freeze layers
base_model.trainable = False
#create a new model on top.
inputs = tf.keras.Input(shape=(150, 150, 3))
x = base_model(inputs, training=False)
x =tf. keras.layers.GlobalAveragePooling2D()(x)
outputs = tf.keras.layers.Dense(1)(x)
model = tf.keras.Model(inputs, outputs)
Then you can compile and train your model. Thank You.
1 Like
Yes, this is great, thank you for your reply.