8. Transfer Learning and Pre-Trained Models
Activity 8.01: Using the VGG16 Network to Train a Deep Learning Network to Identify Images
Use the VGG16
network to predict the image given (test_image_1
). Before you start, ensure that you have downloaded the image (test_image_1
) to your working directory. Follow these steps to complete this activity:
- Import the
numpy
library and the necessaryKeras
libraries:import numpy as np from keras.applications.vgg16 import VGG16, preprocess_input from keras.preprocessing import image
- Initiate the model (note that, at this point, you can also view the architecture of the network, as shown in the following code):
classifier = VGG16() classifier.summary()
classifier.summary()
shows us the architecture of the network. The following points should be noted: it has a four-dimensional input shape (None, 224, 224, 3
) and it has three convolutional layers.The last four layers of the output are as follows: