I am trying to copy vgg16 layers (except the last layer) into a new Sequential model. I loop through every layer of the vgg16 except the last one and add them to my new model. But when I print the summary of the model I see that the input layer of vgg16 has not been copied. I am following this tutorial https://www.youtube.com/watch?v=oDHpqu52soI in which the same code that I have is used but the input layer is copied too. I am wondering if someone could please help me with why my code does not copy the input layer.
I am using keras 2.2.4-tf
Here is my code:
vgg16_model = keras.applications.vgg16.VGG16(weights='imagenet')
model = Sequential()
for layer in vgg16_model.layers[:-1]:
model.add(layer)
model.summary()
These are the first few layers of the "model" (input layer is missing):
These are the first few layers of "vgg16_model" which has the input layer too.