A real-time attendance tracking system using facial recognition, powered by FaceNet embeddings, KNN classifier, and OpenCV. The system identifies individuals through a live webcam feed and marks their entry and exit times with high accuracy. Unknown individuals are automatically detected and their images are saved with timestamps.
- 🔍 Real-time face detection using webcam.
- 🤖 Face recognition using FaceNet + KNN classifier.
- ✅ Automatic attendance marking with entry and exit timestamps.
- 🔐 Confidence threshold to prevent false positives.
- 🧠 Face stabilization logic to avoid flickers.
- 🧾 Attendance logging in a structured CSV file.
- ❌ Unknown face detection with red bounding box and snapshot saving.
- 🖥️ GUI-based control to start/stop camera via Tkinter.
- Python 3.x
- OpenCV
- Keras-FaceNet
- NumPy
- Pandas
- Tkinter
- KNN Classifier (trained model loaded via
pickle)
- Organize person images in folders labeled with person IDs (e.g.,
001,002, etc.). - Each folder should contain 6–7 facial images with varied expressions and angles.
- Train and save the KNN model (
knn_model.pkl) and label encoder (label_encoder.pkl) using FaceNet embeddings.
- Ensure
Attendance.csvhas the following columns:
- Run the script.
- A simple GUI opens with a "Stop Camera" button to terminate the session.
- After stopping the camera, a file named
Attendance_Report.csvis saved with:
- Unknown individuals:
- Are displayed with a red bounding box.
- Are labeled as “Unknown”.
- Have their snapshot saved to
unknown_snapshots/with a timestamped filename.
- Green bounding box
- Name label displayed
- Attendance marked automatically
- Red bounding box
- “Unknown” label
- Snapshot saved to
unknown_snapshots/unknown_YYYYMMDD_HHMMSS.jpg
- Dynamic KNN training from the UI.
- Face re-registration module.
- Integration with databases (MySQL, Firebase).
- Email alerts for unknown detections.
- Multi-camera support.
This project is open-source and free to use for educational and research purposes.
- FaceNet by Keras-Facenet
- OpenCV for real-time video capture
- Inspiration from practical AI applications in smart surveillance and biometric systems
Feel free to contact shreeshanthgoud@gmail.com, doggapavansekhar@gmail.com