I am new to machine learning. I was following this tutorial on fine-tuning VGG16 models.
The model loaded fine with this code:
vgg_model = tensorflow.keras.applications.vgg16.VGG16()
but gets this ERROR:
TypeError: The added layer must be an instance of class Layer. Found: <tensorflow.python.keras.engine.input_layer.InputLayer object at 0x000001FA104CBB70>
When running this code:
model = Sequential()
for layer in vgg_model.layers[:-1]:
model.add(layer)
Dependencies:
I am following this blog but instead, I want to use VGG16.
Any help to fix this would be appreciated. Thank you so much.
This won't work because a tensorflow.keras layer is getting added to a keras Model.
vgg_model = tensorflow.keras.applications.vgg16.VGG16()
model = keras.Sequential()
model.add(vgg_model.layers[0])
Instantiate tensorflow.keras.Sequential(). This will work.
model = tensorflow.keras.Sequential()
model.add(vgg_model.layers[0])