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.
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.
- Real-Time Detection: Instantly recognizes faces from a live video feed.
- High Accuracy: Achieves 95% accuracy using the
face_recognitionlibrary 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.
- Language: Python 3.x
- Computer Vision: OpenCV, face_recognition library, dlib
- GUI Framework: CustomTkinter
- Data Storage: CSV files
- Additional Libraries: NumPy, CMake
- Python 3.7 or higher
- Webcam/Camera
- Windows/Linux/MacOS
- At least 4GB RAM (recommended for face recognition processing)
git clone https://github.com/yourusername/Face-Recognition-based-Attendance-System.git
cd Face-Recognition-based-Attendance-Systempip install cmake
pip install face_recognition
pip install opencv-python
pip install customtkinter
pip install numpy- Create a
faces/directory (if not exists) - Add face images in
.jpgformat - Update the
vsmain.pyfile with the image names and corresponding person names
- Start the login interface:
python vslogin_page.py-
Enter credentials:
- Username: ADMIN
- Password: 2006
-
The face recognition system will launch automatically after successful login.
-
Press 'q' to quit the attendance system.
- Add their face image to the
faces/folder (e.g.,john_face.jpg) - 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']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
- Authentication: User logs in through the CustomTkinter GUI with admin credentials.
- Registration: The system loads pre-saved face images from the
faces/folder and creates face encodings. - Detection: The camera scans for faces during the attendance session in real-time.
- Matching: It compares the live face with the saved encodings using face_recognition library.
- Logging: If a match is found, the attendance is marked in a CSV file named with the current date (DD_MM_YYYY.csv).
- Display: Shows "Present" for recognized faces and "Unknown Face" for unrecognized ones.
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
- Ensure your webcam is connected and not being used by another application
- Try changing
cv2.VideoCapture(0)tocv2.VideoCapture(1)if you have multiple cameras
- Install Visual Studio Build Tools (Windows)
- Install dlib separately:
pip install dlib - Use pre-built wheels from unofficial sources
- Ensure good lighting conditions
- Use high-quality face images for registration
- Face images should be clear and front-facing
- 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.
Your Name
- GitHub: @yourusername
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For any queries or support, please contact: your.email@example.com
Give a ⭐ if this project helped you!