Smart Attendance System using Face Recognition

The Future of Touchless Attendance


5 min read

Smart Attendance System using Face Recognition

Hello all,

The primary goal of every software developer is to solve the real time problems which is situated in and around us. The major tedious work in school or college is taking and maintaining the attendance of the students manually. Yes, It is one of the major problem facing by every faculties/ staff's.

Now a days, there are several solutions are available to solve this issue. One of the technique is to use biometric methodology. But as everyone knows we are facing the biggest problem called COVID -19. In this pandemic time, taking attendance using biometric system is risky.

So, I thought of thinking a better solution to solve this problem. Finally, an idea knock my mind, (i.e)Attendance system using face recognition. It is one of the best solutions to solve this real time problem during this days. We can say this as Contactless attendance system.


Source : Google


The overall project is split into two module, one is to say admin site and other one is teacher's site.

The concept is admin has to register the students details such as name, email address and also create training data of each student by entering his roll id and taking snaps of his or her frontal face and then webapp will automatically create model for that particular roll id and save it on server, The model which is created for each student is about 8kb in size. Admin can register teachers and assign the class using this site.

Now using teacher's site, teacher has to login first and then after clicking on attendance tab the student will then have to just click a snap enter class and roll id and press enter to mark their attandance. After marking attendance, If teacher wants to see attendace, just select date and time to see the attendance. And there is also an option to download the attendace sheet in excel form and then again reupload it after making any changes if sometime required by the teacher. And the teacher can also see total attendance for his or her lecture. so that they can analyze how many lectures each student from particular class had attended so far.

Tech Stack

  • Admin site dependency :

    • flask
    • mysqlclient
    • sklearn
    • numpy
    • scipy
    • pillow
    • dlib
    • face_recognition
  • Teachers site dependency :

    • flask_bootstrap
    • pytz
    • xlsxwriter
    • pandas
    • flask_mail
    • xlrd
  • For Face recognition : "face_recognition" by ageitgey.

  • For storing our trained images: MySQL

  • For front end of our web app : Bootstrap framework

  • For back end : Python and Flask framework

  • For report generation : xlrx, xlrd and pandas.

Admin Module

In this module admin has the access to add faculties and student. The details of the faculties are stored in database. Under the student functionality the student basic details and an image of the student are collected for model generation.



Authentication System

This function will authenticate the admin by verifying the username and password. Once the admin successfully logged in, register_teacher function is called where the faculty details are collected and stored it in the database. Similar to the faculty addition, the student addition can be carried out by calling the function called signup_student. In signup_student, where the basic details and the image of the student is collected to the purpose of model generation.

Training Phase

This function is responsible for training student data through face recognition and storing it in a database. The whole training process involves preprocessing the image and the model generation.

Model Generation

This function will result in the model generation through the input image and storing the result in the folder which is named after the register number of the student.

Teacher Module

In this module faculty has the access for taking attendance of the student, report generation and sending alert mail for the parents. Attendance are stored in excel format for future use.



This function will load the necessary packages including flask, flask bootstrap, MySQLdb, sklearn, shutil, pickle, face_recognition, xlsxwriter, pandas, flask_mail that are needed for faculty functionality.

Image Capturing

This function will be responsible for capturing the image of the student to mark the attendance. Here the image is taken and pass it to the match() function where the prediction taken place.

Image Detection

This function will classify the student based upon the model which is already trained and stored in database. For prediction, predict() function is called and the classification is done using KNN classifier. Once the prediction is completed, the status of the student is stored in the excel sheet.

Attendance View

This function will be responsible for viewing the attendance(i.e) report for the particular class.

Update Attendance

Consolidated Report Generation

The function to calculate the overall percentage of the particular course or student.

One additional feature is that teacher can send email for the attendance marked to all the parents as well as students by selecting class and clicking on send mail button.

Future Plan

The future plan is to improve the recognition rate when there are unintentional changes in a person like tonsuring head, using scarf, beard. Addition of student details and model generation for all students will be done in single trigger by storing and uploading the details in an excel sheet. The barcode of a particular subject will be displayed on the projector which will change every 10 seconds to avoid proxy attendance. The student needs to scan the barcode and capture the photo within 10 seconds or the barcode will expire. This will prevent other students from capturing the photo of barcode and sending it to their colleagues to mark the attendance.

To know more about this project, Documentation

If you really like this project idea, show your love by star the repository

To see the output and complete source code, Source