Face Recognition Model

Face Recognition Model

Training a model from scratch requires a very large dataset and takes a lot of time to train. The solution to this is using a pre-trained model since all the extracted features from images are similar (edges, circles, lines, etc.).So a pre-trained model converge fastly because his weights are already optimized , save you much time AND you don’t need a large dataset to train it to learn your data.

In this task we have to create a face recognition model so the best and efficient approach is to use transfer learning concept and to use this concept we require a pre-trained model so in my case I have used VGG16 convolutional neural network.

So for face recognition as we know that VGG16 does not contain our images so it can't recognize us , so for this we have to provide our own dataset which will contain our images.

So first step is to create a dataset of our images. So here we will use concept of openCV library. We will write a python code to take images and store in a folder.

So first of all we have to create folders shown in the image for training and test dataset.

No alt text provided for this image


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

This can have folders of multiple people as in my case I have created this model for myself and my sister. So two separate folders we have created.

Now we have to write code for collecting images. In my case I have taken 6000 images each of me and my sister which I will divide in 4:1 ratio that is 4800 images for training dataset and 1200 images for test dataset.

No alt text provided for this image


No alt text provided for this image

Transfer learning is a method through which we can use the weights of the pre-trained model to customize the network and train it on our custom dataset. Here we use the concept of freezing the layers that is we will tell the pre-trained network( deep neural network ) that you don't have to train the whole network for our new dataset just use your knowledge of the previous dataset because all the images are same. Here what changes we have to make in pre-created network is that we will not include the last layer of the model that is the output layer, instead we will include our own custom FCL( fully connected layer ) to train our dataset and at the end of our FCL we will add one output layer then we will combine our FCL with the pre-trained network.

Now once we have collected the dataset now we have to train the model.On training the model we will get to know about various layers of the model

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

Now we have to freeze all the layers and add the layer we created.

No alt text provided for this image

Now we have to train our pre-trained model with new dataset by running epochs in my case I have done 4 epochs. Here we are using loss function as loss = 'categorical_crossentropy' because it is multi classification data. We have used optimizer RMSprop(lr = 0.001) with learning rate as 0.001 and accuracy using metrics

No alt text provided for this image

And I am getting a good accuracy of around 99 percent

Now we have to make our model ready for testing.

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

Now I have taken 3 test cases to check for my Face Detection model and I got correct result.

No alt text provided for this image


No alt text provided for this image


No alt text provided for this image


So with this we come to the end of task and i want to thank Vimal Sir for giving us a industry level projects as by practising this will make our base stronger for future.

If you have any query related to task feel free to ask me.

No alt text provided for this image

















要查看或添加评论,请登录

Tushar Saxena的更多文章

  • Dynamic Jenkins

    Dynamic Jenkins

    This article is a simple integration of GitHub, Jenkins, Kubernetes and Docker to automate the process of deploying a…

    2 条评论
  • Configuring CI/CD on Kubernetes with Jenkins and Groovy

    Configuring CI/CD on Kubernetes with Jenkins and Groovy

    This article is a simple integration of GitHub, Jenkins, Kubernetes and Docker to automate the process of deploying a…

    1 条评论
  • DevOps Assembly Line Task 3

    DevOps Assembly Line Task 3

    This article is a simple integration of GitHub, Jenkins, Kubernetes and Docker to automate the process of deploying a…

    6 条评论
  • INTEGRATING PROMETHEUS AND GRAFANA WITH KUBERNETES

    INTEGRATING PROMETHEUS AND GRAFANA WITH KUBERNETES

    Task : Integrate Prometheus and Grafana and perform in following way: Deploy them as pods on top of Kubernetes by…

  • AWS automation using Terraform and Jenkins

    AWS automation using Terraform and Jenkins

    First lets know about the basic terminologies used in this project . What is Cloud Computing? Cloud computing is a term…

    4 条评论
  • ML + DEVOPS = MLOPS

    ML + DEVOPS = MLOPS

    So before starting this article my one question to everyone is why 90% of machine learning models not deployed ? So…

    4 条评论
  • Docker + Git + Github + Jenkins = Automated Project#2

    Docker + Git + Github + Jenkins = Automated Project#2

    This article is based on a integration of great DevOps tools like git , github , jenkins , docker. Integrating all the…

    6 条评论
  • DevOps Automation using Docker , Jenkins and Git/Github

    DevOps Automation using Docker , Jenkins and Git/Github

    This project uses DevOps tools for continuous development, continuous integration and continuous deployment.We have to…

    2 条评论

社区洞察

其他会员也浏览了