Fine-tune VGG16 Image Classifier with Keras | Part 1: Build

deeplizard · 74K views · 2017 · 7:46

Open on YouTube

Machine learning & deep learningComputer vision, speech & NLPtutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the source tutorial for copying VGG16 layers into a Sequential model, and as a pointer for answers about fine-tuning and freezing layers.

Recommended by 1 people across 1 different months, 2018 to 2019.

What it is

A short deeplizard tutorial showing how to fine-tune the pre-trained VGG16 model with TensorFlow's Keras API to classify cats and dogs. This first part builds the model by copying VGG16's layers into a new Sequential model and replacing the output layer.

What people said

Recommends Dulmina · 2019-01 · Stack Overflow · on “Keras Transfer Learning on More Than 1000 classes”

This is called fine tuning a keras model. You should remove the last layer of the trained model and then for each layer you have to make the weights update false by using: layer.trainable=False After that you can add your custom layer Eg: Add a dense layer with more than 1000 classes if you want and train it. Then, you can update the weights of the final layer during the training process For more help refer to this video video [this video] cheers :-)

Cites Patryk Kaczmarek · 2018-10 · Stack Overflow · on “Keras Init Sequential model layers by Model layers”

I'm trying to build some app using Transfer Learning. I want to use Vgg16 so I've done sth like this: vgg16_model = keras.applications.vgg16.VGG16() but I want to transfer layers from Vgg16 to my model. model = Sequential(layers=vgg16_model.layers) (I've seen this here [this video] ) but it leads me to error TypeError: The added layer must be an instance of class Layer. Found: tensorflow.python.keras.engine.input_layer.InputLayer How can I init my Sequential model by vgg16 layers? Thanks in advance.

Cites Rstynbl · 2019-03 · Stack Overflow · on “The added layer must be an instance of class Layer. Found: <tensorflow.python.keras.engine.input_layer.InputLayer>”

I am new to machine learning. I was following this tutorial [this video] 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: Keras 2.2.3 Tensorflow 1.12.0 tensorflow-gpu1.12.0 Python 3.6.0 I am following this blog [LINK] but instead, I want to use VGG16. Any help to fix this would be appreciated. Thank you so much.

Cites Rane · 2019-04 · Stack Overflow · on “The input layer of vgg net is not copied to a new sequential model when making a layer by layer copy of it”

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 [this video] 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 f