Skip to content

savanigit/-Face-Recognition-based-Attendance-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📸 Facial Recognition Based Attendance System

A smart and automated system that marks attendance using facial recognition technology. This project replaces manual roll calls with a fast, contactless, and secure solution using Python.

🚀 Overview

This system uses the camera to detect faces in real-time and matches them with a registered database of students/employees. Once a face is recognized, the system automatically logs the Name, Date, and Time into a CSV file.

It is designed to be highly accurate (95%) and works efficiently even for multiple people.

✨ Key Features

  • Real-Time Detection: Instantly recognizes faces from a live video feed.
  • High Accuracy: Achieves 95% accuracy using the face_recognition library and OpenCV.
  • Automated Logging: Saves attendance data immediately to CSV files with timestamp.
  • Duplicate Prevention: Prevents marking attendance multiple times for the same person in a single session.
  • Export Data: Automatically exports attendance sheets to CSV files with date stamps.
  • Secure Login System: CustomTkinter-based GUI with admin authentication.
  • Unknown Face Detection: Displays alerts for unrecognized faces.

🛠️ Tech Stack

  • Language: Python 3.x
  • Computer Vision: OpenCV, face_recognition library, dlib
  • GUI Framework: CustomTkinter
  • Data Storage: CSV files
  • Additional Libraries: NumPy, CMake

📋 Prerequisites

  • Python 3.7 or higher
  • Webcam/Camera
  • Windows/Linux/MacOS
  • At least 4GB RAM (recommended for face recognition processing)

🔧 Installation

Step 1: Clone the Repository

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

Step 2: Install Required Packages

pip install cmake
pip install face_recognition
pip install opencv-python
pip install customtkinter
pip install numpy

Step 3: Prepare Face Images

  1. Create a faces/ directory (if not exists)
  2. Add face images in .jpg format
  3. Update the vsmain.py file with the image names and corresponding person names

🚀 Usage

Running the Application

  1. Start the login interface:
python vslogin_page.py
  1. Enter credentials:

    • Username: ADMIN
    • Password: 2006
  2. The face recognition system will launch automatically after successful login.

  3. Press 'q' to quit the attendance system.

Adding New Users

  1. Add their face image to the faces/ folder (e.g., john_face.jpg)
  2. Update vsmain.py:
john_face = face_recognition.load_image_file('faces/john_face.jpg')
john_face_encoding = face_recognition.face_encodings(john_face)[0]

known_face_encodings = [savani_face_encoding, nupur_face_encoding, john_face_encoding]
known_face_names = ['SAVANI THAKUR 54', 'NUPUR VAVHAL 56', 'JOHN DOE']

📁 Project Structure

Face-Recognition-based-Attendance-System/
├── vsmain.py              # Main face recognition logic
├── vslogin_page.py        # Login GUI using CustomTkinter
├── faces/                 # Directory containing registered face images
│   ├── savani_face.jpg
│   └── nupur_face.jpg
├── DD_MM_YYYY.csv         # Auto-generated attendance records
└── README.md              # Project documentation

⚙️ How It Works

  1. Authentication: User logs in through the CustomTkinter GUI with admin credentials.
  2. Registration: The system loads pre-saved face images from the faces/ folder and creates face encodings.
  3. Detection: The camera scans for faces during the attendance session in real-time.
  4. Matching: It compares the live face with the saved encodings using face_recognition library.
  5. Logging: If a match is found, the attendance is marked in a CSV file named with the current date (DD_MM_YYYY.csv).
  6. Display: Shows "Present" for recognized faces and "Unknown Face" for unrecognized ones.

📊 Attendance Records

Attendance is automatically saved to CSV files with the format: DD_MM_YYYY.csv

Example (21_04_2025.csv):

SAVANI THAKUR 54,10-30-45
NUPUR VAVHAL 56,10-31-12

🐛 Troubleshooting

Camera Not Working

  • Ensure your webcam is connected and not being used by another application
  • Try changing cv2.VideoCapture(0) to cv2.VideoCapture(1) if you have multiple cameras

Face Recognition Not Installing

  • Install Visual Studio Build Tools (Windows)
  • Install dlib separately: pip install dlib
  • Use pre-built wheels from unofficial sources

Poor Recognition Accuracy

  • Ensure good lighting conditions
  • Use high-quality face images for registration
  • Face images should be clear and front-facing

🔮 Future Improvements

  • Adding a Web Dashboard using Flask/Django for remote access.
  • Implementing a database (MySQL/SQLite) instead of CSV files.
  • Adding facial recognition in low-light conditions using infrared cameras.
  • Creating a mobile app for attendance viewing.
  • Deploying the system to a cloud server.
  • Adding email/SMS notifications for attendance reports.

👨‍💻 Author

Your Name

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📧 Contact

For any queries or support, please contact: your.email@example.com

⭐ Show Your Support

Give a ⭐ if this project helped you!

About

Automated attendance system using Python and OpenCV. Detects faces in real-time with 95% accuracy and saves records directly to a database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages