Skip to content

This real-time face recognition attendance system automatically logs attendance using OpenCV and KNN-based recognition.

Notifications You must be signed in to change notification settings

Chaimaaorg/AttendAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Recognition Attendance System

A modern, efficient, and contactless attendance management system that uses facial recognition to automatically track attendance. This system eliminates the need for traditional attendance methods and provides a seamless experience for both administrators and users.

Features

  • Facial Recognition: Automatically identifies registered individuals using advanced facial recognition algorithms
  • Real-time Tracking: Instantly detects and recognizes faces in the camera feed
  • Automatic Attendance Logging: Saves attendance records with timestamps in CSV format
  • User-friendly Interface: Simple and intuitive UI with visual feedback
  • Easy Registration: Quick process to add new faces to the database
  • Privacy-focused: All data is stored locally, ensuring privacy and data security

Face Detection in Action

System Requirements

  • Python 3.6+
  • Webcam or camera device
  • Dependencies listed in requirements.txt

Project Structure

├── assets                  # Images and other static assets
├── attendance              # Attendance records (CSV files)
├── data                    # Face data and model files
│   ├── names.pkl           # Stored names for recognition
│   ├── face_data.pkl       # Facial features data
│   └── haarcascade_frontalface_default.xml  # Face detection model
├── src                     # Source code
│   ├── main.py             # Main application entry point
│   ├── dataset.py          # Data collection functionality
│   ├── constants.py        # Configuration and constants
│   └── util_functions.py   # Utility functions
├── README.md               # Project documentation (this file)
└── requirements.txt        # Project dependencies

Installation

  1. Clone this repository:

    git clone https://github.com/Chaimaaorg/AttendAI.git
    cd face-recognition-attendance
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Make sure the data directory contains the required files or run the dataset collection first.

Usage

Step 1: Data Collection (for new users)

Run the dataset collection script to register new faces:

python src/dataset.py

Follow the prompts to:

  • Enter your name
  • Allow the system to capture multiple face samples
  • Stay still and ensure proper lighting for best results
  • Press 'q' to quit after sufficient samples are collected

Step 2: Running the Attendance System

Start the main application:

python src/main.py
  • The system will automatically detect and recognize registered faces
  • Press 'o' to mark attendance for the detected person
  • Press 'q' to quit the application

Attendance Records

Attendance records are saved in the attendance directory as CSV files with the naming format Attendance_DD-MM-YYYY.csv. Each file contains:

  • Name of the individual
  • Timestamp of attendance

How It Works

  1. Face Detection: Uses Haar Cascade classifier to detect faces in the video feed
  2. Feature Extraction: Processes detected faces to extract key features
  3. Classification: Uses K-Nearest Neighbors algorithm to match faces against the database
  4. Attendance Logging: Records attendance with timestamps in CSV format

Customization

You can modify the following parameters in constants.py:

  • Frame dimensions and positions
  • Color schemes
  • Sample frequency for data collection
  • Maximum number of face samples to collect
  • And more...

Troubleshooting

  • No Face Detected: Ensure proper lighting conditions and face positioning
  • Misidentification: Collect more samples with various expressions and angles
  • Camera Issues: Check your camera connection and permissions

Future Improvements

  • Implement deep learning-based facial recognition (e.g., using FaceNet or OpenFace). I may add some notebooks related to this project. Check out my Kaggle profile: Kaggle Profile

  • Improve recognition accuracy under varying lighting conditions.

  • Integrate with a database for centralized attendance tracking.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

This real-time face recognition attendance system automatically logs attendance using OpenCV and KNN-based recognition.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages