An intelligent, face-recognition-powered attendance management system built with Python. The system automatically detects and recognizes students through a webcam, marks attendance in real-time, detects facial expressions, and provides a rich dashboard with reporting tools.
- 🔒 Admin Login — Secure login before access
- 📸 Student Registration — Capture face samples and register students
- 🤖 AI Face Recognition — Real-time face detection & recognition via OpenCV + LBPH
- 😊 Facial Expression Detection — Emotions displayed above the face bounding box using DeepFace
- 📋 Automatic Attendance — Marks
P(present) orA(absent) in CSV files per subject - 🕐 30-Minute Window — Updates a single attendance CSV within a rolling 30-minute session
- 📊 Dashboard — Live statistics: total students, attendance rate, subject-wise summaries
- 📈 Reports — Detailed attendance reports with Excel & CSV export, charts, and filters
- 🎨 Modern Dark UI — Built with CustomTkinter, dark theme, indigo accent palette
Run the app locally to see the full UI.
| Category | Library / Tool |
|---|---|
| UI Framework | customtkinter |
| Face Detection & Recognition | opencv-python, opencv-contrib-python |
| Expression Detection | deepface, tensorflow, tf-keras |
| Data Handling | pandas, numpy, openpyxl |
| Visualization | matplotlib |
| Image Processing | Pillow |
| Body Pose / Landmarks | mediapipe |
| Text-to-Speech | pyttsx3 |
- Python 3.9 – 3.11 (recommended)
- A webcam connected to your machine
- Git
git clone https://github.com/TanmayKumawat/AI-based-attendance-system.git
cd AI-based-attendance-systempython -m venv venv
# Windows
venv\Scripts\activate
# Linux / macOS
source venv/bin/activatepip install -r requirements.txtThese directories are excluded from version control (they are created automatically on first run, but you can create them manually):
MasterData/
StudentDetails/
TrainingImage/
Attendance/
model/
backups/
python app.pyOr use the provided batch file on Windows:
run.bat| Field | Value |
|---|---|
| Username | admin |
| Password | admin123 |
⚠️ Change these inconfig.pybefore deploying in production.
AI-based-attendance-system/
│
├── app.py # Application entry point
├── login.py # Admin login UI
├── dashboard.py # Main dashboard with stats
├── register_student.py # Student registration & face capture
├── train_image.py # Train LBPH face recognizer
├── automatic_attendance.py # Real-time attendance with face + expression
├── reports.py # Attendance reports & export
├── config.py # App-wide configuration & constants
├── face_engine.py # Face utility functions
├── utils.py # General utilities
│
├── assets/ # Icons, themes, UI assets
├── MasterData/ # Master student list (CSV) [not tracked]
├── StudentDetails/ # Student detail records [not tracked]
├── TrainingImage/ # Captured face images per student [not tracked]
├── Attendance/ # Generated attendance CSVs [not tracked]
├── model/ # Trained model files [not tracked]
│
├── requirements.txt # Python dependencies
├── run.bat # Windows launcher script
└── .gitignore
1. Admin logs in
↓
2. Register students (capture 15–25 face samples)
↓
3. Train the face recognition model
↓
4. Start Automatic Attendance
↓
5. Camera detects & recognizes faces → marks attendance
↓
6. View reports on the Dashboard
| Setting | Default | Description |
|---|---|---|
SUBJECTS |
["Python","Java","DBMS","AI","Maths","English"] |
List of subjects |
CAMERA_INDEX |
0 |
Webcam index |
FACE_CONFIDENCE_THRESHOLD |
70 |
Recognition confidence threshold |
MIN_FACE_SAMPLES |
15 |
Min images captured per student |
MAX_FACE_SAMPLES |
25 |
Max images captured per student |
SUBJECT_COOLDOWN_SECONDS |
60 |
Re-mark cooldown per subject |
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.
Tanmay Kumawat
GitHub: @TanmayKumawat