Transfer learning is a machine learning method where a model developed for a task is reused as the starting point for a model on a second task.
It is a popular approach in deep learning where pre-trained models are used as the starting point on computer vision and natural language processing tasks given the vast compute and time resources required to develop neural network models on these problems and from the huge jumps in the skill that they provide on related problems.
TASK: To create a face recognition model using the VGG16 Model.
VGG16 is a convolutional neural network model proposed by K. Simonyan and A. Zisserman from the University of Oxford in the paper “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The model achieves 92.7% top-5 test accuracy in ImageNet, which is a dataset of over 14 million images belonging to 1000 classes.
# STEP 1: PREPARE THE DATA
Firstly, we must create more training and test data, using the Image Augmentation concept.
Image Augmentation is basically, creating more image set for model training purposes by modifying the image with little changes like, scaling, flipping, etc.
#STEP 2: MODIFY THE PRE-TRAINED MODEL
We will set all the layers of the model to be untrainable, as we don't want t make any changes in the weights.
We will only remove the end layer of the model and add layers we created depending on our data and classes.
#STEP 3: MODEL FITTING
Then, we will fit the data into the model. All the parameters and hyper-parameters must be selected cautiously.
We can save the model results in a file.
#STEP 4: RESULT TIME
We can use a module like cv2, to display the results.