π This project automates classroom attendance using Face Recognition (MTCNN + FaceNet) integrated with Flask and Google Sheets.
It captures student faces in real-time, marks attendance automatically, and even generates a QR link to access the system from mobile devices.
π§ Introduction
Attendance tracking is one of the most time-consuming classroom tasks.
Traditional methods β roll calls or manual entries β are inefficient and error-prone.
To make attendance seamless and contactless, I built a Real-Time Face Recognition Attendance System using MTCNN for face detection, FaceNet for feature extraction, and Flask for the web interface.
The project connects directly with Google Sheets to store attendance records automatically, and aβ¦
π This project automates classroom attendance using Face Recognition (MTCNN + FaceNet) integrated with Flask and Google Sheets.
It captures student faces in real-time, marks attendance automatically, and even generates a QR link to access the system from mobile devices.
π§ Introduction
Attendance tracking is one of the most time-consuming classroom tasks.
Traditional methods β roll calls or manual entries β are inefficient and error-prone.
To make attendance seamless and contactless, I built a Real-Time Face Recognition Attendance System using MTCNN for face detection, FaceNet for feature extraction, and Flask for the web interface.
The project connects directly with Google Sheets to store attendance records automatically, and a QR link allows mobile access for real-time participation.
π§° Tools & Technologies Used
| Component | Technology |
|---|---|
| Programming Language | Python |
| Framework | Flask |
| Face Detection | MTCNN |
| Face Embedding | FaceNet |
| Model Classifier | SVM |
| Data Storage | Google Sheets API |
| QR Code Generation | qrcode library |
| Deployment | Ngrok (for temporary public access) |
π§βπ» How I Built It (Step-by-Step)
π§© 1. Dataset Preparation
- Collected 20β40 images of 7 different students.
- Stored them in Google Drive as the training dataset.
- Each student had a separate folder (named by student name or ID).
- Used these images to train the recognition model.
π§ 2. Face Detection & Feature Extraction
- Used MTCNN to detect faces in each image.
- Extracted 128-dimensional embeddings using FaceNet.
- Trained an SVM (Support Vector Machine) classifier on the embeddings to identify each student.
βοΈ 3. Integration with Google Sheets
-
Created a Google Cloud Project and enabled the Google Sheets API.
-
Generated a
credentials.jsonfile for authorization. -
Every time a recognized face is detected, the app automatically logs:
-
Student Name
-
Date
-
Time into a Google Sheet.
π 4. Flask Web Application
-
Built a simple Flask app with routes:
-
/captureβ to start the webcam and capture the face. -
/submitβ to log attendance and show confirmation. -
Used Ngrok to get a temporary public URL, enabling mobile access and testing on different devices.
π³ 5. QR Code Integration
- Integrated the qrcode Python library to generate a scannable QR that links directly to the Flask web interface.
- This allows lecturers and students to access the app instantly on their mobile devices β no manual typing needed!
π Results & Observations
The system successfully recognized faces in real-time and logged attendance to Google Sheets.
β For recognized students β attendance was marked automatically.
β For unrecognized faces β the system displayed βFace not matched.β
β οΈ For multiple detected faces β the system warned βMultiple faces detected.β
π Key Features
- Real-time face recognition
- Google Sheets API integration
- QR access for mobile users
- Automatic attendance logging
- Handles unknown or multiple faces gracefully
π§ Limitations
- Requires proper lighting for accurate face recognition
- Performance may reduce if multiple students appear simultaneously
- Ngrok provides only a temporary public link (not permanent hosting)
π Future Enhancements
In future versions, I plan to:
-
Replace Google Sheets with a dedicated database for student records.
-
Implement dynamic QR codes that refresh every 10β15 seconds for secure attendance sessions.
-
Allow lecturers to log in and:
-
Create QR codes for each class session.
-
Edit attendance records manually (for excused absences or missed scans).
π Learnings
This project helped me understand:
- How to integrate ML models into web applications.
- Working with Google Cloud APIs for automation.
- Using Flask + Ngrok for real-time deployment and testing.
- Managing end-to-end data flow from detection to cloud logging.
π GitHub Repository
π§ Conclusion
This project demonstrates how AI can automate an everyday classroom task β attendance marking β in an efficient, contactless, and scalable way.
Itβs a simple yet powerful example of how deep learning and web development can combine to solve real-world problems.
π¬ If you found this post helpful, donβt forget to leave a like or comment β Iβd love to connect with you!