The Face Recognition Attendance System is a Python-based application that uses OpenCV, Tkinter, and other libraries to take images of students, train a machine learning model on the images, and track student attendance based on face recognition. It allows users to:
- Capture face images of students and save them.
- Train a model to recognize faces.
- Track student attendance and log it in a CSV file.
- Capture Student Faces: Takes images of students for training the face recognition model.
- Train Model: Trains the model using the images captured, allowing the system to recognize students' faces.
- Mark Attendance: Marks student attendance by recognizing faces during real-time video capture.
- Save Attendance: Saves attendance data in a CSV file.
- GUI Interface: The application uses Tkinter for a user-friendly interface.
- Notification System: Displays real-time notifications to the user on various actions, such as saving images or training the model.
Before running the application, make sure you have the following Python libraries installed:
opencv-python
Pillow
pandas
numpy
tkinter
(Usually pre-installed with Python)csv
datetime
To install the required libraries, run:
pip install opencv-python Pillow pandas numpy
- StudentDetails.csv: Stores student roll numbers and names.
- TrainingImage/: Directory where student face images are saved.
- TrainingImageLabel/Trainner.yml: Saved machine learning model for face recognition.
- Attendance/: Directory where attendance logs are saved.
- haarcascade_frontalface_default.xml: Pre-trained classifier for face detection (downloadable from OpenCV repository).
-
Start the Application: Run the script to launch the Face Recognition Attendance System.
python attendance_system.py
-
Capture Student Faces:
- Enter the Roll No and Student Name in the provided fields.
- Click on Take Images.
- The system will open a webcam window, and the student will need to stay in front of the camera for face detection.
- Once enough images are captured, the system will notify the user.
-
Train the Model:
- Click on Train Model to train the face recognition model using the captured images.
- The model will be saved as
Trainner.yml
for future use.
-
Mark Attendance:
- Click on Mark Attendance to start face recognition.
- The system will use the webcam to detect faces in real time and match them with the trained model.
- Attendance will be saved in a timestamped CSV file under the
Attendance/
folder.
-
Clear Fields:
- Click on Clear to reset the input fields and messages.
-
Exit:
- Click on Quit to close the application.
- Face_Recognition_Attendance_System/
- StudentDetails.csv # Stores student details (Roll No and Name)
- TrainingImage/ # Captured images of students' faces
- TrainingImageLabel/ # Folder where the trained model (Trainner.yml) is stored
- Attendance/ # Folder to store the attendance logs
- haarcascade_frontalface_default.xml # Pre-trained face detection model (downloadable from OpenCV)
- attendance_system.py # Python script to run the system
- Roll No should be numeric, and the Name should only contain letters and spaces.
- The system uses LBPH (Local Binary Pattern Histogram) face recognition for training and prediction.
- The system assumes a webcam is available for face capture and recognition.
- The application saves attendance in a CSV file named
Attendance_DDMMYYYY.csv
.
- Ensure that the webcam is accessible and working properly.
- If the
haarcascade_frontalface_default.xml
file is missing, download it from here. - If the StudentDetails.csv file is not found, the system will display an error message. Ensure the file is in the same directory as the script.