This is a complete Face Recognition Attendance Management System built using Python, OpenCV, Tkinter, and MySQL. It uses a real-time camera feed to detect and recognize student faces and mark attendance automatically. The GUI is developed with Tkinter and includes secure login access for admin.
🚀 Project inspired by the CodeWithKiran YouTube Playlist — "How to Create Advanced Facial Recognition System in Python".
- 🔒 Admin Login Authentication (custom addition)
- 👤 Student Registration Module
- 📷 Face Image Dataset Creation using OpenCV
- 🤖 Training Module with LBPH Face Recognizer
- 🧠 Real-time Face Detection & Recognition
- 📝 Attendance Logging with date, time, and session (morning/afternoon)
- 📊 Attendance Management (view, import, export as CSV)
- 🖼️ Tkinter GUI Clean and user-friendly
- 🗃️ MySQL Database Integration
Face-Attendance-System/ ├── images/ # GUI and button images ├── data/ # Stored face images ├── classifier.xml # Trained face recognition model ├── Attendance.csv # Attendance records ├── login.py # Login screen ├── main.py # Main dashboard ├── student.py # Student registration ├── train.py # Train dataset ├── face_recognition.py # Real-time recognition & attendance ├── attendance.py # Attendance viewing/export └── haarcascade_frontalface_default.xml
Install the following Python libraries before running the project:
pip install opencv-python pip install pillow pip install pymysql
You also need to:
Install and configure MySQL (XAMPP or standalone) Create a database named face_recognition Create required tables as shown below
🛠️ MySQL Database Setup Run the following SQL queries in your MySQL database:
-- Create the database CREATE DATABASE face_recognition;
-- Use the database USE face_recognition;
-- Create users table for login CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255), password VARCHAR(255) );
-- Insert admin login credentials INSERT INTO users (username, password) VALUES ('admin', 'admin123');
-- Create student table CREATE TABLE student ( Dept VARCHAR(50), study_year VARCHAR(10), Semester VARCHAR(10), Period VARCHAR(20), Student_id VARCHAR(20) PRIMARY KEY, division VARCHAR(10), Name VARCHAR(100), Rollno VARCHAR(20), Dob VARCHAR(20), Phone VARCHAR(20), Address VARCHAR(255), Teacher VARCHAR(100), PhotoSample VARCHAR(10) ); 🚀 How to Run the Project Clone the repository:
git clone https://github.com/Asha-R19/Face-Attendance-Python.git cd Face-Attendance-Python
Start the application:
Login using:(Note: You can also change the username and password in database) Username: admin Password: admin123
Follow these steps:
Add student details and take photo samples and the data will be automatically stored in data folder. Train the dataset using the "Train Data" module Start face recognition to mark attendance View and export attendance logs
🧰 Technologies Used Python 3.x OpenCV Tkinter MySQL with PyMySQL Pillow CSV File Handling
🙏 Credits YouTube Channel: CodeWithKiran Tutorial Playlist: Advanced Facial Recognition System in Python Custom enhancements and design by Asha