Face Recognition

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.

No alt text provided for this image

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.

No alt text provided for this image


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.

No alt text provided for this image

Step2 : Here We reload the model excluding the last layer and freeze all those layers so that they can't be retrained .

No alt text provided for this image

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 .

No alt text provided for this image

Step 4 : To train the model , we have to import some functions . So I import them using keras library .

No alt text provided for this image

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.

No alt text provided for this image

Step 6 : Now Compile the Model .

No alt text provided for this image

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'

No alt text provided for this image

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 .

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Here the Final Outcome !!

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image


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.

💯 Amazing work Rupalii !!!! 🔥🔥...

To view or add a comment, sign in

More articles by Rupali Gurjar

  • Running GUI Application inside Docker Container

    Hello Guys ! Hope you are safe and doing well :) Before moving towards this task, let's see what the Docker is ? Docker…

    2 Comments
  • Coursera : Aws Case Study

    Hello Everyone !! Let's see how Coursera platform is using Amazon Web Services ..

    10 Comments
  • Web-portal using EKS

    What is Amazon EKS Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service that makes it easy for you to…

    6 Comments
  • Web Portal Using Personal VPC

    VIRTUAL PRIVATE CLOUD ( VPC ) A virtual private cloud (VPC) is an on-demand configurable pool of shared computing…

    10 Comments
  • CI/CD Pipeline using Docker inside Docker

    A CI/CD Pipeline implementation, or Continuous Integration/Continuous Deployment, is the backbone of the modern DevOps…

    6 Comments
  • Task-1 : Integration of Github with Docker and Jenkins

    This Project is based on the integration of Github with Docker and Jenkins . Github : GitHub, Inc.

    10 Comments
  • Task1 : Aws Infrastructure with Terraform

    I have created an AWS Infrastructure using Terraform code so that it would be automated from end to end . What is AWS ?…

    16 Comments
  • MLOPS TASK 3 : INTEGRATING MACHINE LEARNING WITH DEVOPS

    MLOPS : A COMPOUND OF MACHINE LEARNING AND OPERATIONS It is a practice for collaboration and communication between data…

    12 Comments

Others also viewed

Explore content categories