Skip to content

The repository consists of a custom face recognition along with eye blink detector used as a liveliness detector.

Notifications You must be signed in to change notification settings

AshishOhri/Custom_Face_Unlock_System

Repository files navigation

Custom_Face_Unlock_System

This repository contains code for a custom face recognition implemented in python. Using the code in this repository, one can create a face recognition system having eye blink detector as an anti-spoofing method, that prevents a photo to be used as a measure to detect a face.

This code can be used to create a software as well as a hardware implementation to create a face recognition unlocking system.

Source
Source
Source
Source

Steps Involved

Run the files preferably on the command line.

  • Run pip install -r requirements.txt to install all required libraries. Check out this article to know more about requirements.txt.

  • Run python face_store_data.py. Input the name of the person of whom you are creating the dataset of images. Now, with the face recognition window as the active window, use key 'k' to cature your image when the camera recognizes your face. After capturing a good amount of photos, use key 'q' to exit.
    Advice: The more images the better 📷. Try to click atleast 50 to get a good recognition system. Also, if your camera doesn't recognize your face, invest in a better camera 😛

  • Run python train.py. Sit tight for a few seconds ☕

  • Run python final_code.py and VOILA! You have your own face recognition system.

Understanding and changing the code

One can change the below mentioned variables according to their needs

  • The final_code.py file consists of a variable EYE_AR_THRESHOLD that is set to 0.27 i.e. if the eye blink falls below this threshold, it will be considered as a blink.
  • The above file has variable EYE_AR_CONSEC_FRAMES set to 1 which implies that a blink must last for atleast one frame.
  • Finally, at the end of the same file, an if condition is set to check if blinks are greater than 2. If so, the code breaks out of the loop.

References

A special thanks to https://pyimagesearch.com. Their website helped a lot. Do check out their website.

About

The repository consists of a custom face recognition along with eye blink detector used as a liveliness detector.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages