Face Recognition
Let's create a Model of Face Recognition using Transfer Learning .
Transfer Learning
Transfer learning (TL) is a research problem in machine learning (ML) that focuses on storing knowledge gained while solving one problem and applying it to a different but related problem. For example, knowledge gained while learning to recognize cars could apply when trying to recognize trucks.
A pre-trained model is a model created by some one else to solve a similar problem. Instead of building a model from scratch to solve a similar problem, you use the model trained on other problem as a starting point. Example : VGG , Inception , MobileNet
Here I am going to use VGG16 model .
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.
Let's write a python code for this ! Here I am going to use Jupyter as a python Interpreter .
Step1 : To use a pre-created Model , First we have to import this Model . Keras is a open-source neural network library written in Python . It is running on the top of Tensorflow . ImageNet is a dataset of over 15 million labeled high-resolution images belonging to roughly 22,000 categories.
from keras.applications import VGG16
Here I initialized weights with best fitted weights instead of Random Weights.
Step2 : Here We reload the model excluding the last layer and freeze all those layers so that they can't be retrained .
Step 3 : Now add the Top layer . To add layer we use dense function with "relu" as activation function . It is a Categorical classification so we have to use Softmax as activation function .
Step 4 : To train the model , we have to import some functions . So I import them using keras library .
Step 5 : I create a dataset to train the model which is stored in 'Train_data' folder and one dataset to validate the Model in 'Validation_data' . I train the model with three categories.
Step 6 : Now Compile the Model .
Step 7 : Here the model is ready . To use this model in future we save it . To load this model , we import a module 'load_model'
Step 8 : Now the final step ! Here we predict and check whether it predicts right or not . It will take a random image from validation data set and recognize the face .
Here the Final Outcome !!
Here is My Github Repository .
Hope You Enjoy this Article !
Thanks for Reading : )
Have you tried MATLAB for this. I've made shape recognition program on that. Btw great work.
Great work!!!
Superb👌 Rupali Gurjar
Great Rups😉♥️
💯 Amazing work Rupalii !!!! 🔥🔥...