Skip to main content

Face Recognition by TRANSFER LEARNING

Transfer Learning in Deep Neural Networks - The easiest way to describe transfer learning is the use of previously acquired knowledge and skills in new learning or problem-solving situations. 

This is the same way in which we humans learn something.
Humans have an inherent ability to transfer knowledge across tasks. What we acquire as knowledge while learning about one task, we utilize in the same way to solve related tasks. The more related the tasks, the easier it is for us to transfer, or cross-utilize our knowledge. 
Some simple examples would be -
- Know how to ride a motorbike ⮫ Learn how to ride a car
- Know how to play classic piano ⮫ Learn how to play jazz piano
In transfer learning, we reuse the weights of one or more layers from a pre-trained neural network model in our new model and either keeping the weights fixed, fine tuning them, or adapting the weights entirely when training the model.

I've used the concept of transfer learning in deep neural networks to train face images and do Face recognition. The pre-trained model that I've used is VGG16.


I've divided this project into 2 parts-
1) Creating face dataset using Open-CV.
2) Training the VGG16 model by transfer learning and testing it.
Here's the link of my GitHub repository- 
https://github.com/aayushi1908/Face-Recognition-by-TRANSFER-LEARNING.git
1) For dataset creation- I've used Open-CV library and Haar Cascade classifiers for detecting the face. The dataset has been divided into two sets- train set and test set. For train set, the code captures 1000 images of the person's face. For the test set, the code captures 500 images of the person's face.
About Haar CascadeHaar Cascade is a machine learning object detection algorithm used to identify objects in an image or video. The Haar Cascade is trained by superimposing the positive image over a set of negative images. The training is generally done on a server and on various stages.
Here are the screenshots of the datasets that I've created for me and my friend's faces-



2) For training of VGG16 and testing the model - 
Firstly I've imported the VGG16 model and then its weights from ImageNet. In my new model, I have freezed all the intermediate layers of VGG except the Input and Output layer. I've trained the output layer according to my requirement. 
About VGG16 - VGG16 is a convolutional neural network model proposed by K. Simonyan and A. Zisserman from the University of Oxford. The model achieves 92.7% top-5 test accuracy in ImageNet, which is a dataset of over 14 million images belonging to 1000 classes. It was one of the famous model submitted to ILSVRC-2014. It makes the improvement over AlexNet by replacing large kernel-sized filters (11 and 5 in the first and second convolutional layer, respectively) with multiple 3×3 kernel-sized filters one after another.
With the help of transfer learning, I'm able to achieve an optimum accuracy of 94.70% without use of GPU or more desired RAM.
For Testing, any image provided to the model can be predicted if the image is of either of the two person's faces. The testing can also be done through the Web Cam of the laptop/PC.











Comments

Popular posts from this blog

MLOps - Tweaking Hyperparameters Automatically

  A time consuming task while training the Machine Learning models is to  continuously tweak the Hyper-Parameters  to reach our desired Accuracy. It is one of the reasons why most of the ML related projects fail.  This can be resolved upto an extent with   MLOPs = ML+ DevOps In this blog, I'm explaining my MLOPs project which trains and tweaks a CNN model for Cat and Dog prediction from the dataset. My project uses  "Jenkins"  as an automation-tool and  "GitHub"  where the developer pushes the code. Requirements for setting up the project : 1. Git 2. Jenkins 3. Redhat 8 VM 4. Docker Project : Creating Environments : I've created 3 environments (images) in Docker using Dockerfile for running my programs - 1)  env1  - This environment is for running any basic program which uses numpy and pandas. To run the container of env1 - docker run -it --name con_Basic env1 2)  env2  - This environment is for running Old ML programs which use sklearn. To run the container

SIH 2020 : A kick-start from my not-so techie life

How Smart India Hackathon (SIH) participation has helped me to strengthen my competency and enhance my skill-sets? Hello everyone! In this blog, I'm going to talk about how SIH played an important role in building my passion towards acquiring technical skills. Do read till the end to know about all of my experiences. Do you believe in the concept of “IDEA”? Do you follow the principle of “Smart Work”? Well, my SIH experience directed me towards these!  I’m writing this blog to enlighten these topics and I’ll try to elaborate the importance of the above 2 questions in every engineering student’s life! SIH kick-started my non-technical life to a much focused one.   The concept of “Smart work beats hard work” suits my story! So, I decided to participate in SIH 2020 under the Software Problems domain. This domain asked for a Web app/ Mobile app to be made. I was eager to make a Web app as I knew Web development from basic level. Now a team needed to be made! So I communicated w

Testing and Production System environments - Jenkins-Docker

In real-world use cases,  it's a standard practice to treat development , test , and production systems differently because they have differing security, data, and privacy controls. No code is deployed directly to be presented before the user, firstly it is tested in a testing environment and if it works fine, only then it is deployed in the production system.  About the project - In this project, I have made 2 environments- one for testing and other for the production system . The code is pushed by the Developer to GitHub. The code is pulled into our system by a job of Jenkins and then it is tested in a Docker environment for its efficiency and working. If any changes or updates are needed to be done in the code, we do it in the testing environment. After successful testing, the code is deployed for the user. Setup - 1) Jenkins 2) GitHub 3) Git Bash 4) REDHAT8 Linux - Docker Jenkins Jobs - Job 1 - The developer pushes the code to GitHub. This job pull