Skip to content

patelritiq/SmartFace-Attendance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SmartFace Attendance System πŸ‘€

Python OpenCV License: MIT

An end-to-end, real-time face recognition attendance system using computer vision and machine learning. Built with OpenCV and K-Nearest Neighbors (KNN) algorithm, this system implements a complete pipeline from dataset creation to face recognition and CSV-based attendance logging, offering a contactless, cost-effective alternative to manual attendance and expensive biometric systems.


Project Overview πŸ“Š

What is SmartFace Attendance?

SmartFace Attendance is an intelligent, automated attendance management system that leverages facial recognition technology to eliminate manual attendance processes. By capturing and analyzing facial features in real-time, the system provides accurate, efficient, and hygienic attendance tracking suitable for educational institutions, workplaces, and small businesses.

Key Statistics & Features

  • 100+ Face Samples per User: Robust dataset creation ensuring high recognition accuracy
  • Real-Time Recognition: Instant face detection and identification using webcam
  • Multi-Face Detection: Simultaneous detection of multiple faces in frame
  • Feature Vector Engineering: 3,750-dimensional feature vectors (75Γ—50 pixel grayscale images)
  • KNN Classification: Optimized K=5 neighbors for accurate recognition
  • CSV-Based Logging: Daily attendance records with timestamps for easy integration
  • Validated Performance: Tested under multiple lighting conditions with consistent accuracy
  • Contactless Operation: Hygienic, touchless attendance marking

Use Cases & Real-World Applications 🎯

Educational Institutions (Schools, Colleges, Universities)

Benefits:

  • Eliminate manual attendance registers and roll calls
  • Reduce class time wasted on attendance (5-10 minutes per session)
  • Prevent proxy attendance and buddy punching
  • Generate automated attendance reports for administration
  • Track student attendance patterns for academic intervention

Impact: A class of 50 students taking 2 minutes for manual attendance = 100 minutes/day saved across the institution

Corporate Offices & Workplaces

Benefits:

  • Replace expensive biometric systems or RFID card readers
  • Accurate time-in/time-out tracking for payroll
  • Eliminate buddy punching and time theft
  • Seamless integration with HR management systems
  • Professional, modern attendance solution

Impact: Reduces attendance fraud, improves payroll accuracy, and saves HR administrative time

Small Businesses & Startups

Benefits:

  • Affordable attendance solution without capital investment
  • Easy to set up and maintain
  • Scalable as business grows
  • Professional appearance for clients and employees
  • No ongoing subscription or maintenance costs

Impact: Professional attendance tracking at fraction of commercial system costs

Training Centers & Workshops

Benefits:

  • Quick participant check-in for sessions
  • Accurate attendance records for certification
  • Reduced administrative overhead
  • Professional image for training programs

Limitation: Not ideal for large events/conferences where pre-registration of all attendees is impractical


Technical Overview πŸ’‘

Core Technology Stack

  • Face Detection: Haar Cascade Classifier (OpenCV pre-trained model)
  • Feature Engineering: 3,750-dimensional vectors (75Γ—50 grayscale images)
  • Classification: K-Nearest Neighbors (K=5, optimized through testing)
  • Data Storage: Pickle files for face data, CSV for attendance logs

How It Works

  1. Dataset Creation: Captures 100 face samples per user at 5-frame intervals
  2. Feature Extraction: Converts faces to grayscale, resizes to 75Γ—50, flattens to 3,750D vectors
  3. Training: KNN model learns from stored face vectors
  4. Recognition: Real-time face detection β†’ feature extraction β†’ KNN prediction
  5. Validation: Ensures exactly ONE face present before allowing attendance
  6. Logging: Records name and timestamp to daily CSV files

Multi-Face Validation

1. No Face:    β†’ "No face detected" (attendance disabled)
2. More than one face β†’ "Multiple faces detected!" (attendance disabled)
3. Exactly one face β†’ "Press 'o' to mark attendance" (attendance enabled)

Why 100 samples? Captures diverse angles, expressions, and lighting variations for robust recognition.

Why K=5? Tested values 3, 5, 7, 9 - K=5 provided best accuracy/robustness balance.

Why grayscale? Removes color dependency, focuses on facial structure, reduces computational load.


Getting Started πŸš€

Quick Setup: See QUICKSTART.md for rapid installation and usage.

Installation:

git clone https://github.com/patelritiq/SmartFace-Attendance.git
cd SmartFace-Attendance
pip install -r requirements.txt

Register Users:

cd src
python Dataset.py

Mark Attendance:

cd src
python Attendance.py

---## Project Structure πŸ“

SmartFace-Attendance/
β”œβ”€β”€ src/                                    # Source code
β”‚   β”œβ”€β”€ Dataset.py                          # User registration & dataset creation
β”‚   └── Attendance.py                       # Real-time attendance system
β”œβ”€β”€ models/                                 # Machine learning models
β”‚   └── haarcascade_frontalface_default.xml # Face detection model
β”œβ”€β”€ assets/                                 # UI resources
β”‚   └── bg.png                              # Background image
β”œβ”€β”€ data/                                   # Training data storage
β”‚   β”œβ”€β”€ .gitkeep                            # Keep folder in git
β”‚   β”œβ”€β”€ faces_data.pkl                      # Face feature vectors (ignored)
β”‚   └── names.pkl                           # User names (ignored)
β”œβ”€β”€ Attendance/                             # Attendance logs
β”‚   β”œβ”€β”€ .gitkeep                            # Keep folder in git
β”‚   └── Attendance_DD-MM-YYYY.csv           # Daily attendance files (ignored)
β”œβ”€β”€ .gitignore                              # Git ignore rules
β”œβ”€β”€ requirements.txt                        # Python dependencies
β”œβ”€β”€ LICENSE                                 # MIT License
β”œβ”€β”€ README.md                               # Project documentation
└── QUICKSTART.md                           # Quick setup guide

Note: Personal data files (.pkl, .csv) are excluded from git via .gitignore for privacy.


Security & Privacy πŸ”’

  • Local Storage: All data stays on your system (no cloud)
  • User Control: Users can delete their data anytime
  • Privacy Compliant: Follows data protection best practices

Recommendations:

  • Obtain user consent before collecting face data
  • Secure the data/ folder with appropriate permissions
  • Regularly backup attendance records
  • Comply with local regulations (GDPR, etc.)

Limitations:

  • Not for high-security applications (banking, government)
  • Can be fooled by high-quality photos (no liveness detection)
  • Performance degrades with significant appearance changes

Known Limitations & Future Enhancements οΏ½

Current Limitations:

  • Photo spoofing (no liveness detection)
  • Appearance changes affect recognition (beard, glasses)
  • Lighting dependency (poor performance in darkness)
  • Windows-only text-to-speech

Planned Enhancements:

  • Liveness detection (blink/head movement)
  • Web-based dashboard
  • Database backend
  • Mobile app
  • Admin panel
  • Multi-format export (PDF, Excel, JSON)

Contributing 🀝

Contributions are welcome to improve functionality, accuracy, and user experience!

How to Contribute

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/YourFeature
  3. Commit changes: git commit -m 'Add YourFeature'
  4. Push to branch: git push origin feature/YourFeature
  5. Open a Pull Request

Contribution Ideas

  • Implement multi-face validation
  • Add liveness detection
  • Create web-based interface
  • Improve recognition accuracy
  • Add database integration
  • Cross-platform compatibility improvements
  • Documentation enhancements

License πŸ“„

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

Key Points:

  • Free to use, modify, and distribute
  • Commercial use allowed
  • Attribution appreciated
  • No warranty provided

Author & Contact πŸ‘¨β€πŸ’»

Ritik Pratap Singh Patel
Computer Vision & Machine Learning Enthusiast

Project Links:

Connect:


Acknowledgments πŸ™

  • OpenCV Community: For excellent computer vision tools and documentation
  • scikit-learn: For robust machine learning algorithms
  • Haar Cascade: Pre-trained face detection model
  • Open Source Community: For inspiration and resources

Project Statistics πŸ“ˆ

GitHub stars GitHub forks GitHub issues GitHub last commit


Project Context πŸ’Ό

This project was developed as a college project demonstrating practical applications of computer vision and machine learning in solving real-world problems. It showcases the complete pipeline from data collection to deployment, emphasizing cost-effective, accessible solutions for attendance management.

Development Year: 2024
Status: Complete and functional
Purpose: Educational demonstration and practical deployment


Transforming attendance management through intelligent face recognition technology. πŸ‘€βœ¨

About

SmartFace Attendance is a face recognition-based attendance system that captures faces using a webcam, recognizes them, and logs attendance in CSV format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages