Deep learning · Completed
Face recognition attendance system
A Django web app that marks student attendance from a camera image using face detection and face embeddings, with enrollment, records, filters, and CSV export.
Overview
Taking attendance by hand is slow and easy to get wrong. This project replaces the roll call with a camera: a student looks at the webcam, the app recognizes the face, and the attendance record for that day is created automatically.
It is a complete web application, not just a recognition script. Staff can enroll students with a photo, review attendance by date or by student, and export the records to a spreadsheet.
How recognition works
- Enrollment. When a student is registered, their photo is decoded with OpenCV and converted from BGR to RGB. Faces are located with dlib’s HOG-based detector (upsampled twice to catch smaller faces), and a 128-dimensional face encoding is computed with two jitters for a more stable embedding. The encoding is stored with the student record as binary data.
- Detection at check-in. The browser sends a camera frame to the server. The same detector finds faces in the frame, and each one is encoded with the larger landmark model.
- Matching. Each live encoding is compared with the stored encodings using a distance tolerance of 0.5, which is stricter than the library’s default of 0.6 to reduce false matches.
- Recording. On a match, the app creates one attendance record per student per day, so repeated check-ins do not create duplicates. It returns the processed frame with a box and the student’s name drawn on the face.
The encodings come from the face_recognition library, which wraps dlib’s pretrained deep metric learning model. Faces are compared by the distance between their embeddings, so no model training is needed when a new student enrolls.
Features
- Student management: enroll students with a photo, edit details or replace the photo (which re-computes the encoding), and remove students.
- Attendance records: every record stores the date and time automatically.
- Filtering: narrow records by date range and by student.
- CSV export: download the filtered records for use in a spreadsheet.
- Dashboard: a responsive interface built with Bootstrap 5.
Tech stack
| Layer | Technology |
|---|---|
| Web framework | Django 4.2 |
| Computer vision | OpenCV, face_recognition (dlib) |
| Data | NumPy, pandas, SQLite |
| Frontend | HTML, CSS, JavaScript, Bootstrap 5 |
Run it locally
git clone https://github.com/kazisalon/Attendance-Management-System-with-Face-Recognition.git
cd Attendance-Management-System-with-Face-Recognition
pip install -r requirements.txt
python manage.py runserver
dlib must be installed before face_recognition. On Windows that usually means a prebuilt wheel matching your Python version, because building dlib from source requires CMake and a C++ compiler.