A robust, bilingual, real-time face recognition-based attendance system using YOLOv8, DeepFace, TensorFlow, and OpenCV. This project supports both real-time webcam-based tracking and video file-based pipelines with Region of Interest (ROI), logging, frame skipping, and CSV-based attendance.
Pipeline:
- Real-time webcam feed.
- Face detection:
face_recognition. - Feature extraction:
DeepFace.represent(). - Identity prediction: Pretrained TensorFlow model.
- Attendance CSV generation with name and timestamp.
Highlights:
- Real-time accuracy.
- Simple pipeline to test live tracking.
- CSV output:
attendance.csv
Pipeline:
- Input: Pre-recorded video file.
- ROI (Region of Interest): Defined polygon mask.
- Face detection:
YOLOv8usingyolov11l-face.pt. - Recognition:
DeepFace.find()using cosine similarity. - Output: Annotated video + attendance CSV.
Highlights:
- Supports masked region-based filtering.
- Face matching from pre-encoded database folder.
- Output CSV:
attendance_log.csv.
Pipeline Enhancements:
- Faster detection using
yolov11n-face.pt. - Frame skipping for performance boost.
- Embedding caching to avoid repeated comparisons.
- Overlay of last matched face image and label (“Present”).
- Real-time bounding box display with names.
- Attendance duplication prevention.
Extras:
- Logging with
loggingmodule (logs.txt). - Efficient attendance marking.
- Output files:
- Annotated video:
output.mp4 - Attendance CSV:
final_attendance.csv
- Annotated video:
| Module | Purpose |
|---|---|
face_recognition |
Real-time face detection |
DeepFace |
Face embeddings and identity match |
YOLOv8 |
High-speed face detection |
TensorFlow |
Custom model for identity prediction (prototype) |
OpenCV |
Video I/O, drawing, overlays |
Numpy/Pandas |
Data and CSV handling |
Logging |
Robust debugging |
├── deep_track_prototype.py # Webcam-based face tracking
├── core1.py # Video + YOLO + DeepFace
├── core1_improved.py # Optimized video pipeline
├── known_faces/ # Folder with known images
├── attendance/ # Output CSV files
├── output/ # Output annotated video
├── roi_mask.npy # ROI polygon mask file
├── logs.txt # Runtime logs
├── model.h5 # Trained TensorFlow model
-
Clone the repo:
git clone https://github.com/NihalDR/Attendence_ms
-
Install requirements:
pip install -r requirements.txt
-
Download YOLOv8 weights:
- Place
yolov11l-face.ptandyolov11n-face.ptin the root directory.
- Place
-
Run pipelines:
- Prototype (webcam):
python detect_faces.py
- Core 1 (video):
python app.py
- Core 1 Improved:
python app.py
- Prototype (webcam):
- ✅
final_attendance.csv:
- Web-based dashboard for CSV management.
- Real-time multi-camera support.
- Automatic ROI calibration using perspective transform.
- Facial spoofing detection.
Nihal DR
📍 BE AIDS @ CMRIT
📧 [nihaldr77@gmail.com]