Face-Recognition-based-Attendance-System
A real time implementation of Attendance System in python.
To understand the implentation of Facial recognition based Attendance System you must have, Pre-requisites
– Basic understanding of Image Classification
– Knowledge of Python and Deep Learning
1- OpenCV Dependencies
2- dlib
3- face_recognition
4- os
5- imutils
6- numpy
7- pickle
8- datetime
9- Pandas
Note: To install dlib and face_recognition, you need to create a virtual environment in your IDE first.
Face is the crucial part of the human body that uniquely identifies a person. Using the face characteristics the face recognition projects can be implemented. The technique which I have used to implent this project is Deep Metric Learning. Overview
If you have any prior experience with deep learning you know that we typically train a network to: What is Deep Metric Learning ?
Accept a single input image
And output a classification/label for that image
However, deep metric learning is different. Instead, of trying to output a single label, we are outputting a real-valued feature vector. This technique can be divided into three steps,
The first task that we perform is detecting faces in the image(photograph) or video stream. Now we know that the exact coordinates or location of the face, so we extract this face for further processing. Face Detection
Now see we have cropped out the face from the image, so we extract specific features from it. Here we are going to see how to use face embeddings to extract these features of the face. Here a neural network takes an image of the face of the person as input and outputs a vector that represents the most important features of a face. For the dlib facial recognition network which I have used here, the output feature vector is 128-d (i.e., a list of 128 real-valued numbers) that is used to quantify the face. This output feature vector is also called face embeddings. Feature Extraction
We have face embeddings for each face in our data saved in a file, the next step is to recognize a new image that is not in our data. Hence the first step is to compute the face embedding for the image using the same network we used earlier and then compare this embedding with the rest of the embeddings that we have. We recognize the face if the generated embedding is closer or similar to any other embedding. Comparing Faces
Three files only. These are What's include in this repository ?
1- Feature_extractor.py for extracting and saving the features from images (128-d vector for each face) of persons provided
2- attendace.py for real time implementation of Face-Recognition-based-Attendance-System.
3- README.md which you are reading.
Create a folder named 'images' at the same location where you have kept the python files mentioned above. In this folder you will create sub folders, each having the the images of the of a persons whom you want the program to recognize. Each folder should have 3-4 images. Change the names of subfolder to the names of the people to be identified. Now first run Feature_extractor.py. This will takes some time and provide you a file named face_enc containing the features extracted from the the images. This file will be used by attendace.py. Now run attendace.py to real time implementation of Face-Recognition-based-Attendance-System. If a person recognized by the program then his/her name and time of recognization will be stored in record.csv . You don't need this file, program will create this file itself and will keep maintaining the attendance data in it. How to implement ?
To further understand the working of program, just go through the code files and read the comments in it.