Face Recognition Using Transfer Learning (VGG16)
Face Recognition is a method to identify the identity of an individual using their face. It is capable of identifying a person from a digital image source or a video frame from a video source.It can be used as an attendance system, can be used to verify a customer’s identity, can be used at airports, police stations and many more.
Transfer learning make use of the knowledge gained while solving one problem and applying it to a different but related problem.
For example, knowledge gained while learning to recognize cars can be used to some extent to recognize trucks.
Pre-Training
When we train the network on a large dataset(for example: ImageNet) , we train all the parameters of the neural network and therefore the model is learned. It may take hours on your GPU.
Fine tuning
We can give the new dataset to fine tune the pre-trained CNN. Consider that the new dataset is almost similar to the orginal dataset used for pre-training. Since the new dataset is similar, the same weights can be used for extracting the features from the new dataset.
- If the new dataset is very small, it’s better to train only the final layers of the network to avoid overfitting, keeping all other layers fixed. So remove the final layers of the pre-trained network. Add new layers . Retrain only the new layers.
If the new dataset is very much large, retrain the whole network with initial weights from the pretrained model.
For this task I have used the dataset from kaggle , you can find it here
Original dataset is of 14 celebrities but I choose only 2 to work on . Those are arnold schwarzenegger and sofia vergara .
Let us focus on program now
As we have two catogories to classify from dataset, hence we have ro use two as num_classes .
As the dataset we got from kaggle is not sufficient for training model so we have to generate the data for training and validation also .
Now just we need to train the model and save it .
Now Prediction using the model .
Finally done , any suggestions are always welcome.
Thank you .
Software Engineer - Cloud Engineer at CRISIL Limited
4 å¹´Nice Job dude ????
SE @TCS Digital | AWS Cloud & DevOps Engineer | Also skilled in NodeJS / MERN Full Stack and Python automation
4 å¹´Rocking performance Shyam
Nice work bro.. ????
SWE@Cadence | Spring Boot | Java | DSA | K8s | OpenSource | Microservices
4 å¹´Great work shyam sulbhewar