0
votes

vgg16_model = tf.keras.applications.vgg16.VGG16()

model= Sequential()

for layer in vgg16_model.layers[:-1]:

model.add(layer)

model.summary() #The last dense layer is removed till now

enter image description here

for layer in model.layers:

layer.trainable=False         #for transfer learning i have freeze the layers

model.add(Dense(2, activation='softmax'))

model.summary() #now when i add dense layers trainable parameters of model get changed

enter image description here

1

1 Answers

0
votes

In the first step you generate a network with 134,260,554 parameters.

Those parameter are all set to be non trainable. Then you add a layer with two neurons to the model. This adds 2*4096 + 2 = 8194 (weights + bias) parameters to the model. Those parameters are trainable. This is what the summary shows.