With this strategy in place, let's code up our solution as follows (Please refer to Transfer_learning.ipynb file in GitHub while implementing the code):
- Import the pre-trained model:
from keras.applications import vgg16from keras.utils.vis_utils import plot_modelfrom keras.applications.vgg16 import preprocess_inputvgg16_model = vgg16.VGG16(include_top=False, weights='imagenet',input_shape=(300,300,3))
Note that we are excluding the last layer in the VGG16 model. This is to ensure that we fine-tune the VGG16 model for the problem that we are trying solve. Additionally, given that our input image shape is 300 X 300 X 3, we are specifying the same while downloading the VGG16 model.
- Preprocess the set of images. This preprocessing ...