Create your Own Face Recognition Authentication System using Python Computer Vision and Machine

Source

Create your Own Face Recognition Authentication System using Python, Computer Vision, and Machine Learning From Scratch !!

For Machine Learning Approach Scroll to The End of the Page.

Creating a Basic Face Lock isn’t a Rocket Science when you have Python’s

package openCV with you.

I will suggest you, use Jupyter Notebook for this project

https://jupyter.org/install — link to install Jupyter Notebook

So first install openCV package in you Jupyter Notebook

Run both the cells, and wait for a while

now import both the packages in your notebook

import both the packages

Download Haar Cascade XML files for Object Detection which will help you to detect Faces:

http://alereimondo.no-ip.org/OpenCV/34 — Download Harr Cascade Choose Frontal Face Zip

the Code below will help you to Register Your Face Which will be Compared With Scanned Faces(Functionalities of every line is explained in the comments)

now from this Cell, we have divided the Captured Image into Small Pixels Which are further Encoded with their respective Pixel code in NumPy Array.

Trending AI Articles:

1. Natural Language Generation:
The Commercial State of the Art in 2020

2. This Entire Article Was Written by Open AI’s GPT2

3. Learning To Classify Images Without Labels

4. Becoming a Data Scientist, Data Analyst, Financial Analyst and Research Analyst

For Eg:- I Applied this function on my image and this is what I got:-

and from the function below we can again convert the NumPy Array To Respective Image and Save it By the Function Below:-

Now use the Second Instance of The faceCascade to Compare it with the Registered image and then Find the Accuracy :

this Cell Will again do the same, Capture the image and the will convert it into Its Respective NumPy Array

Now we Have Both the NumPy Array The Registered one and another to Test on.

Big Data Jobs

so now we are cropping the image of the Face only by the detected Rectangle Dimensions around the Faces ,for both Images (Registered and Testing One)

Look at the comments to know what’s every line doing

Machine Learning for Good Results:-

Now Coming To Train Your Model

Actually This Process Should be implemented When we Were Registering Faces, but this will become too much for now so I placed it here

So in Aspect Of Machine Learning, we are going to use a Classification Technique i.e. Logistic Regression(Sigmoid)

for This, We have to Train Our Model First

For This Run the Cell Below:-

Run this Cell for 7–8 Times and Every Time Add train_list to a 2-D Matrix Column Wise for Every iteration.

(Sometimes try to run with Different Faces and Mark Them with 0(Wrong) for Better Training.)

Suppose you run the cell for 7 times and stores the list in a 2-D Matrix You will get a Matrix Of Dimensions:-

[number of elements in the list: 7 ]

Create a respective [1:number of elements] matrix(TRAIN_Y) with Values 1 when you scanned your face and 0 when you used Different Faces.

Now Use Logistic Regression to Train You model By Iteration of Training Matrix (TRAIN_X) and The Result Matrix(TRAIN_Y) Column Wise.

Heyyyaahh !! Model Is Trained:

Now Every Time You Use This Facial Recognition Convert the Image to Respective List as we have Done Above, Then Use LogisticRegression.Predict() and Pass Your List In Predict Method.

After That If The Logistic Regression Model Shows 1 This Means Permission Granted and 0 For Permission Denied.

For Any Queries:- harshpatel674@gmail.com

Don’t forget to give us your ? !


Create your Own Face Recognition Authentication System using Python, Computer Vision, and Machine… was originally published in Becoming Human: Artificial Intelligence Magazine on Medium, where people are continuing the conversation by highlighting and responding to this story.

Via https://becominghuman.ai/create-your-own-face-recognition-authentication-system-using-python-computer-vision-and-machine-7bcf3aea6c70?source=rss—-5e5bef33608a—4

source https://365datascience.weebly.com/the-best-data-science-blog-2020/create-your-own-face-recognition-authentication-system-using-python-computer-vision-and-machine

Published by 365Data Science

365 Data Science is an online educational career website that offers the incredible opportunity to find your way into the data science world no matter your previous knowledge and experience. We have prepared numerous courses that suit the needs of aspiring BI analysts, Data analysts and Data scientists. We at 365 Data Science are committed educators who believe that curiosity should not be hindered by inability to access good learning resources. This is why we focus all our efforts on creating high-quality educational content which anyone can access online.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Design a site like this with WordPress.com
Get started