Skip to content

A Smart Attendance System using Python, Flask, OpenCV, and SQLite to automate attendance with real-time face recognition. It prevents proxy attendance, logs data securely, and generates reports. Features include role-based access, responsive web UI, and cloud-ready design with scope for mobile apps, IoT integration, and AI-driven analytics.

Notifications You must be signed in to change notification settings

themanishpndt/Face-Recognition-Attendance-System-Using-Python-and-HTML

Repository files navigation

๐ŸŽ“ Smart Attendance System (Face Recognition-Based)

Python Flask OpenCV SQLite License: MIT


๐Ÿ“– Project Overview

The Smart Attendance System is a Face Recognition-Based Attendance Tracker designed for educational institutions and workplaces.
It automates the process of marking attendance by recognizing faces in real-time and securely logging them in a database.

๐Ÿ”‘ Key Benefits

  • Contactless & hygienic ๐Ÿ‘‹
  • Prevents proxy/buddy attendance ๐Ÿšซ
  • Real-time data storage & reporting ๐Ÿ“Š
  • Secure, scalable & cloud-ready โ˜๏ธ

โšก System Workflow

flowchart TD
    A[User Face] --> B[Camera Capture]
    B --> C[OpenCV Haarcascade Detection]
    C --> D[Feature Extraction & Encoding]
    D --> E[Compare with Stored Database]
    E -->|Match| F[Attendance Marked โœ…]
    E -->|No Match| G[Reject/Registration โŒ]
    F --> H[Attendance Stored in DB & CSV]
    H --> I[Reports for Admin/Teacher]
Loading

โœจ Features

  • ๐Ÿ‘จโ€๐Ÿซ Role-Based Access โ†’ Admin, Teacher, Student
  • ๐Ÿ“ท Real-Time Face Detection & Recognition
  • ๐Ÿ“‚ Automated Attendance Logging (DB + CSV)
  • ๐Ÿ“Š Downloadable Reports (Daily/Weekly/Monthly)
  • ๐Ÿ“ฑ Responsive Web UI with Flask + Bootstrap
  • ๐Ÿ”’ Secure Authentication with hashed passwords
  • โ˜๏ธ Cloud-ready Deployment

๐Ÿ› ๏ธ Tech Stack

Frontend: HTML5, CSS3, JavaScript, Bootstrap
Backend: Python (Flask Framework)
Libraries: OpenCV, NumPy, Pickle, bcrypt
Database: SQLite (default) | MySQL (scalable)
Tools: Git, Heroku/Railway/AWS for deployment


๐Ÿ“‚ Project Structure

FaceRecognitionAttendanceSystem/
โ”‚
โ”œโ”€โ”€ app.py                         # Main Flask app
โ”œโ”€โ”€ schema.sql                     # Database schema
โ”œโ”€โ”€ attendance.db                  # SQLite database
โ”‚
โ”œโ”€โ”€ /Attendance/                   # Attendance CSV reports
โ”‚   โ””โ”€โ”€ Attendance_YYYY-MM-DD.csv
โ”‚
โ”œโ”€โ”€ /data/                         # Saved facial data
โ”‚   โ”œโ”€โ”€ faces_data.pkl
โ”‚   โ”œโ”€โ”€ names.pkl
โ”‚   โ””โ”€โ”€ settings.pkl
โ”‚
โ”œโ”€โ”€ /static/                       # Static files (CSS, images)
โ”‚   โ”œโ”€โ”€ css/style.css
โ”‚   โ””โ”€โ”€ bg.png
โ”‚
โ”œโ”€โ”€ /templates/                    # HTML Templates
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ login.html
โ”‚   โ”œโ”€โ”€ dashboard.html
โ”‚   โ”œโ”€โ”€ capture.html
โ”‚   โ”œโ”€โ”€ recognize.html
โ”‚   โ”œโ”€โ”€ attendance.html
โ”‚   โ””โ”€โ”€ settings.html
โ”‚
โ””โ”€โ”€ haarcascade_frontalface_default.xml  # Face detection model

โš™๏ธ Installation & Setup

๐Ÿ”ง Prerequisites

  • Python 3.8+
  • Webcam/Camera
  • SQLite (default)

๐Ÿ“ฅ Step 1: Clone Repository

git clone https://github.com/themanishpndt/Face-Recognition-Attendance-System.git
cd Face-Recognition-Attendance-System

๐Ÿ› ๏ธ Step 2: Create Virtual Environment

python -m venv venv
venv\Scripts๏ฟฝctivate   # Windows
source venv/bin/activate # Mac/Linux

๐Ÿ“ฆ Step 3: Install Dependencies

pip install -r requirements.txt

๐Ÿ—„๏ธ Step 4: Setup Database

sqlite3 attendance.db < schema.sql

โ–ถ๏ธ Step 5: Run Application

python app.py

๐ŸŒ Step 6: Access in Browser

http://127.0.0.1:5000/

๐Ÿ“Š Attendance Report Format

Example CSV Report:

Student_ID, Name, Date, Time, Status
101, Rahul Sharma, 2025-09-11, 09:05, Present
102, Priya Singh, 2025-09-11, 09:07, Present
103, Manish Sharma, 2025-09-11, 09:10, Present

๐Ÿ”’ Security Features

  • Password hashing (bcrypt) ๐Ÿ”‘
  • Role-based access control ๐Ÿง‘โ€๐Ÿ’ป
  • Input validation & CSRF protection ๐Ÿ›ก๏ธ
  • Data encryption for facial embeddings ๐Ÿ”
  • Logging & monitoring for admin audit ๐Ÿ“œ

๐Ÿงช Testing

  • โœ… Unit Testing โ†’ Individual modules
  • ๐Ÿ”„ Integration Testing โ†’ Face recognition + DB + UI
  • ๐ŸŒ System Testing โ†’ End-to-end workflow
  • ๐Ÿž Debugging Report maintained

๐Ÿ“œ Limitations

  • Requires good lighting conditions ๐Ÿ’ก
  • Accuracy decreases with poor camera quality ๐Ÿ“ท
  • Limited by hardware performance โš™๏ธ
  • Privacy/legal concerns around biometric data โš–๏ธ

๐Ÿ”ฎ Future Enhancements

  • ๐Ÿ“ฑ Mobile app (Android/iOS) integration
  • ๐ŸŒ Cloud database (Firebase/AWS RDS)
  • ๐Ÿค– AI-based engagement & emotion detection
  • ๐Ÿ”‘ Multi-Factor Authentication (Face + OTP)
  • ๐ŸŽฏ Integration with IoT smart classrooms

๐Ÿ“Œ Applications

  • ๐Ÿซ Schools & Colleges โ†’ Student attendance
  • ๐Ÿข Offices โ†’ Employee time tracking
  • ๐ŸŽค Events โ†’ Entry management
  • ๐Ÿฅ Healthcare โ†’ Staff attendance logging
  • ๐Ÿ›‚ Security โ†’ Access control in sensitive areas

๐Ÿ‘จโ€๐Ÿ’ป Author

Manish Sharma
๐Ÿ“ Ghaziabad, Uttar Pradesh, India
๐Ÿ“ž +91 7982682852
๐Ÿ“ง manishsharma93155@gmail.com
๐Ÿ”— LinkedIn
๐Ÿ’ป GitHub
๐ŸŒ Portfolio


๐Ÿ“œ License

This project is licensed under the MIT License โ€“ feel free to use, modify, and distribute with proper attribution.


โญ Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature-name)
  3. Commit changes (git commit -m 'Added new feature')
  4. Push branch (git push origin feature-name)
  5. Open Pull Request

If you like this project, please โญ the repository ๐Ÿ™Œ

About

A Smart Attendance System using Python, Flask, OpenCV, and SQLite to automate attendance with real-time face recognition. It prevents proxy attendance, logs data securely, and generates reports. Features include role-based access, responsive web UI, and cloud-ready design with scope for mobile apps, IoT integration, and AI-driven analytics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published