Marking Attendance using FACE RECOGNITION

Akash
3 min readFeb 15, 2021

In this project we will figure out how to perform Facial recognition with high precision and will make an Attendance project that will utilize webcam to recognize faces and record the attendance live in a excel sheet which will include the name, date and time.

This Project consists of 6 simple steps :

1. Import Libraries.

2. Load images.

3. Convert into RGB & Find Encodings.

4. Run Webcam.

5. Match Images.

6. Mark Attendance.

LET’S START

1. Importing the required Libraries.

First we will import the relevant Libraries. We have to import all the necessary libraries into the code. “cv2” is for OpenCV, “face_recognition” is for recognition related operations, and “numpy” is for the numerical purposes.

2. Loading Images.

The Face Recognition package consists of a load image function that loads the images from the destination source/path provided.

3. Converting into RGB and find Encodings.

Once the image is imported now it’s time to convert the image into RGB, because we are getting the images as BGR but library understands it as RGB.

After converting the image now it’s time to find the image encodings by using face_encodings() function. It is basically comparing these image face and finding the distance between them. We have the encoding of both the images now we just are going to compare these encodings.

4. Run webcam and find it’s Encodings.

RUN WEBCAM

READ WEBCAM IMAGE AND RESIZE

Now we will read the image from webcam and will resize it to make the program fast, it will help us to reduce the data.

WEBCAM IMAGE ENCODINGS

And once we have our perfect webcam frame then we will be finding faces in our image. face_locations() is used to perform this task.

5. Match the images.

Now it’s the time to match current face encodings with our images list encodings in order to find the best match.

In order to find the best match we will find the distance, the Lower the distance the better the match is.

Now on the basis of the index value we can display the name of the person and display it on the original Image.

6. Marking Attendance and details.

In the last we will mark the attendance after finding the perfect match of the image including the current date and time.

The Attendance record will be maintained in an “Attendance.csv” file. It will contain name and current date and time.

--

--