Login using Social Account
     Continue with GoogleLogin using your credentials
The trained VGG16 model is available with tensorflow.keras.applications
. We have imported this as from tensorflow.keras.applications import VGG16
in the Import Modules section.
Now let us see how we could use.
Write the following code to get the weights of the pre-trained VGG16 model.
vgg_base = VGG16(weights='imagenet', include_top=False)
vgg_base.trainable=False
Explanation:
We have got an instance of the VGG16 model which is trained on 'imagenet' data.
Since we want to customize it for our purpose of cat-vs-noncat classification, we remove the top layers which are the dense layers.
We put the vgg_base
layers are not trainable by setting vgg_base
to False
, so that we could use the same weights of the Convolutional layers as used in the VGG16 imagenet data.
Note- If you face Unable to open file
error while loading the model, refer to Input/Output Error(Error no. 5).
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...