Skip to content

Repository files navigation

🎓 AI-Based Smart Attendance System

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.


✨ Features

  • 🔒 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) or A (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

🖥️ Screenshots

Run the app locally to see the full UI.


🛠️ Tech Stack

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

⚙️ Setup & Installation

Prerequisites

  • Python 3.9 – 3.11 (recommended)
  • A webcam connected to your machine
  • Git

1. Clone the repository

git clone https://github.com/TanmayKumawat/AI-based-attendance-system.git
cd AI-based-attendance-system

2. Create a virtual environment

python -m venv venv

# Windows
venv\Scripts\activate

# Linux / macOS
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Create required directories

These 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/

5. Run the application

python app.py

Or use the provided batch file on Windows:

run.bat

🔑 Default Admin Credentials

Field Value
Username admin
Password admin123

⚠️ Change these in config.py before deploying in production.


📂 Project Structure

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

🚀 Workflow

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

🔧 Configuration (config.py)

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

🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.


📄 License

This project is licensed under the MIT License.


👤 Author

Tanmay Kumawat
GitHub: @TanmayKumawat

About

An automated emotion detection system for attendence marking.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages