The Sentinel Facial Attendance System is a real-time facial recognition-based attendance management system. It eliminates the need for manual attendance tracking by leveraging computer vision and machine learning techniques to automatically mark attendance. The system is designed for schools, colleges, and corporate offices to enhance accuracy and efficiency.
This system uses OpenCV's pre-trained Haar Cascade Classifier to detect faces from a live camera feed and compare them against stored images to identify individuals. It records attendance and captures images of unauthorized persons separately. The system allows adding new students and retraining the model dynamically.
- Real-Time Facial Recognition: Identifies individuals from live video streams.
- Attendance Marking: Logs attendance efficiently and accurately.
- Intruder Detection: Captures and stores images of unknown persons and sends email alerts.
- Automated Data Logging: Stores attendance data in CSV format for easy analysis.
- Training and Retraining: Supports adding new individuals and updating the model.
- Easy Setup: Minimal configuration required.
- Customizability: Modify training images and detection settings as needed.
- Programming Language: Python 3
- Computer Vision Library: OpenCV
- Machine Learning Algorithm: Haar Cascade Classifier
- Data Storage: CSV files for attendance logs
- Email Alerts: SMTP for sending intruder detection alerts
- Environment Management: Virtual Environment (venv)
The Haar Cascade Classifier is a machine learning object detection algorithm used to detect objects in images or video. It works by analyzing patterns in an image and comparing them to pre-trained patterns stored in an XML file.
- Feature Extraction: Haar-like features (patterns) are extracted from an image.
- Integral Image Calculation: The algorithm quickly calculates feature values.
- Adaboost Training: Weak classifiers are combined into a strong classifier.
- Cascade Structure: The classifier works in multiple stages, rejecting non-face regions early to optimize speed.
| Method | Accuracy | Speed | Complexity | Requires Training? |
|---|---|---|---|---|
| Haar Cascade (Used in Sentinel) | High | Fast | Low | No (Pre-trained Model) |
| HOG + SVM | Medium | Medium | Medium | Yes |
| Deep Learning (CNNs, YOLO, etc.) | Very High | Slow | High | Yes |
- Fast: Uses a cascade approach for quick processing.
- Lightweight: Requires minimal computational power.
- Pre-trained: Works out of the box with minimal setup.
git clone https://github.com/yourusername/Sentinel-Facial-Attendance-System.git
cd Sentinel-Facial-Attendance-Systempython -m venv venvActivate the virtual environment:
- Windows:
venv\Scripts\activate
- Linux/macOS:
source venv/bin/activate
pip install -r requirements.txtEnsure that the Haar Cascade XML file (haarcascade_frontalface_default.xml) is in the project root directory.
If not, download it from OpenCV GitHub and place it in the project directory.
- Place training images in the
TrainingImage/folder. - Use the following naming convention for images:
<StudentID>_<StudentName>.jpg - Update
StudentDetails.csvin theStudentDetails/folder.
python main.py- Attendance records are stored in the
Attendance/folder as CSV files. - Each file is named with the current date and contains the following details:
- Student ID
- Name
- Date
- Time
When an unknown face is detected:
- The system captures the image and saves it in the
Intruder/folder. - An email alert is sent to the administrator with the detected image attached.
- Configure the SMTP server in the
config.pyfile:SMTP_SERVER = "smtp.gmail.com" SMTP_PORT = 587 EMAIL_SENDER = "your_email@gmail.com" EMAIL_PASSWORD = "your_password" EMAIL_RECEIVER = "admin_email@gmail.com"
- Ensure that less secure apps access is enabled on your email account.
Ensure the file is in the project root directory. If missing, download and place it manually.
If OpenCV is not installed correctly, reinstall it:
pip uninstall opencv-python opencv-contrib-python
pip install opencv-python opencv-contrib-pythonCheck if your webcam is properly connected and accessible.
- Adjust camera angle and lighting conditions.
- Ensure the face is clearly visible to the camera.
- Verify SMTP server settings.
- Check if your email account allows less secure apps.
- Ensure the internet connection is stable.
We welcome contributions! Fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- OpenCV for providing robust computer vision tools.
- Python for its simplicity and power.
- Haar Cascade Classifier for efficient face detection.
- Dev Sharma - GitHub Profile