drawing

Face Recognition based Company Attendance System

This project is a company attendance system that uses facial anti-spoofing and recognition to recognize employees and marks their entry and exit time in the database. The system effortlessly tracks time for employees with facial recognition, without human intervention or physical validation, as the system can detect and recognize faces autonomously.

Getting started

A quick introduction of the minimal setup you need to get this project up & running in a Linux environment.

The first thing to do is to clone the repository:

git clone https://github.com/vansf07/Face-Recognition-based-Company-Attendance.git
cd Face-Recognition-based-Company-Attendance

Create a virtual environment to install dependencies in and activate it:

virtualenv venv --python=python3.8.10 
source venv/bin/activate 
pip install --upgrade pip==22.1 

Then install the dependanceis:

pip install -r requirements.txt 

Once pip has finished downloading the dependencies:

python manage.py runserver

And navigate to http://127.0.0.1:8000/.

Admin Login

username: admin
password: rWN7fZ4R

Users

Admin

  • Register a new Employee. Add photos to dataset via webcam soon after successful registration.
  • View attendance of all employees on a particular day (through table and barplot for better comparison)
  • View attendance of particular employee during selected duration (through table and barplot for better comparison)
  • View daily statistics like number of employees present, total number of employees
  • View weekly statistics like this week's attendance, last week's attendance (through lineplot)

Employee

  • Mark attendance in-time/out-time on company home page through face recognition. The system will recognize them as one of the employees.
  • View their own attendance (through table and barplot for better comparison)

Implementation

Flowchart

Facial Anti-Spoofing

Typically, face recognition systems can be spoofed by presenting to the camera a photograph of a targeted person. Therefore, in order to design a secure attendance system, anti-spoofing was a top priority from the initial planning of the system.
The anti-spoofing system will first decide if the samples are from a living person. Only if it is, the sample will be passed on to the face recognition system.
The anti-spoofing system uses the challenge-response method where an attack can be detected by requesting the user to blink. Implementation of eye blink detection was based on face landmarks analysis and by calculating the area of the eye regions.

Tech Stack:

  • Django: I used Django for the backend. The reason I chose Django is because of its ‘batteries included’ approach, which means that essentials like authentication, admin interfacing and managing temporary messages have all been included in the framework.
  • Bootstrap: For the Front-end I’ve used Bootstrap to make my web application responsive and easy to navigate.
  • OpenCV: For the face recognition system itself, I have used Haar and LBPH. Face is detected using Haar Cascade, which is one of OpenCV’s most popular object detection algorithms and one of its main benefits is its speed.
    For face recognition, I’ve used LBPH, also provided by OpenCV through which it is possible to get great results because it is robust against monotonic grayscale transformations.
    Note: OpenCV may freeze due to compatibility isses with Linux but restarting the app will resolve the issue.
  • dlib: dlib is a C++ library with python bindings used to detect the face while adding a newly registered employee's photos to the training dataset.
  • Matplotlib, Pandas, Numpy, Seaborn, Scipy: used for depicting employee attendance through tables, barplots as well as lineplots.

Home page

image

Mark Attendance

final_62924531a98839005a22e8fa_894383

Log In

image

Admin Dashboard

image

Register New Employeefinal_6292451345b22b00e6e7ba2b_808322

View Attendance

final_6292451345b22b00e6e7ba2b_994273

Not Authorized

If a user tries to access a page that they are not allowed to access, they will be redirected to this error page. image