A modern, real-time face recognition attendance system built with Python Flask and advanced computer vision technology. This system automatically detects and recognizes registered faces to mark attendance, providing a seamless and contactless attendance tracking solution.
The registration interface now supports both camera capture and direct file upload for maximum flexibility.
- Real-time Face Detection with live camera feed
- High Accuracy using
face_recognition(dlib) - Multiple Registration Methods: Camera capture or direct file upload
- Automatic Attendance Marking
- Duplicate Prevention: 10-second cooldown
- Daily Tracking: Separate records for each day
- Live Notifications and WebSocket updates
- Modern, Responsive UI (Bootstrap 5)
- Secure File Handling and validation
- Automatic browser launch on app start
- Backend: Python Flask
- Face Recognition:
face_recognitionlibrary - Real-time Communication: Flask-SocketIO with Eventlet
- Frontend: HTML5, CSS3, JavaScript
- UI Framework: Bootstrap 5
- Image Processing: Pillow (PIL)
- Data Storage: JSON files
- Python 3.7+
- pip (Python package manager)
- Webcam or camera device
- Modern web browser (Chrome, Edge, Firefox, etc.)
- Internet connection for dependencies
git clone <repository-url>
cd SmartAttendance-FaceID- Install Visual Studio Build Tools
- During installation, select "Desktop development with C++".
- Install CMake
Or via pip:pip install cmake
- Install Python dependencies
pip install --upgrade pip pip install -r requirements.txt pip install dlib pip install face_recognition
brew install cmake
pip install --upgrade pip
pip install -r requirements.txt
pip install dlib
pip install face_recognitionsudo apt-get update
sudo apt-get install cmake
sudo apt-get install libopenblas-dev liblapack-dev
sudo apt-get install libx11-dev libgtk-3-dev
sudo apt-get install libboost-python-dev
pip install --upgrade pip
pip install -r requirements.txt
pip install dlib
pip install face_recognitionpython app.py- The application will start on http://localhost:5000
- Your browser will open automatically!
python test_file_upload.py # Test file upload functionality
python test_attendance.py # Test attendance API- Run
python app.pyand your browser will open automatically - Click "Start Camera" to initialize the webcam
- Ensure camera permissions are granted
- Click "Start Camera"
- Click "Capture Photo"
- Enter the person's name
- Click "Register Face"
- Click "Choose File"
- Select an image (PNG, JPG, JPEG, max 5MB)
- Preview the image
- Enter the person's name
- Click "Register Face"
- Use the "Clear" button to remove uploaded files if needed
π‘ Pro Tip: You can switch between camera and file upload seamlessly.
- Click "Start Detection" to begin real-time face recognition
- Attendance is marked automatically
- View real-time attendance in the "Today's Attendance" panel
- Check "Live Detections" for instant notifications
- Use "Refresh" buttons to update lists
- Connection: WebSocket status
- Camera: Camera feed status
- Detection: Face detection status
- Registered Faces: Count of registered faces
SmartAttendance-FaceID/
βββ app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ registered_faces.json # Stored face encodings
βββ attendance.json # Attendance records
βββ UI.png # Main dashboard screenshot
βββ UI-of-Register.png # Registration interface screenshot
βββ test_file_upload.py # File upload functionality test
βββ test_attendance.py # Attendance API test
βββ static/
β βββ css/
β β βββ style.css # Custom styles
β βββ js/
β βββ app.js # Frontend JavaScript
βββ templates/
β βββ index.html # Main HTML template
βββ uploads/ # Stored face images
βββ README.md # This file
- Tolerance: Adjustable in
app.py(default: 0.5) - Cooldown Period: 10 seconds between attendance marks
- Image Formats: PNG, JPG, JPEG
- File Size Limit: 5MB per image
- Face Detection: Requires at least one clear face in the image
- Face Images: Stored in
uploads/ - Data Files: JSON format
- File Validation: Only allowed image formats accepted
- Secure Filenames: Automatic filename sanitization
- Input Validation: Server-side validation for all inputs
- Error Handling: Graceful error handling and user feedback
- Direct Image Upload: Upload images directly from your device
- File Validation: Automatic validation of image formats and sizes
- Preview Functionality: See uploaded images before registration
- Clear Button: Easy removal of uploaded files
- Dual Method Support: Seamless switching between camera and file upload
- Enhanced UI: Modern file upload interface
- Error Handling: Comprehensive error messages for invalid files
- Automatic browser launch: Opens your browser when you run the app
- CMake or compiler errors?
- Make sure you have installed both CMake and Visual Studio Build Tools (with C++ support).
- Restart your terminal after installation.
- Check that
cmake --versionworks in your terminal.
- Still having issues?
- Try installing pre-built wheels from https://www.lfd.uci.edu/~gohlke/pythonlibs/#dlib (advanced users).
- General tips:
- Use a virtual environment:
python -m venv venv venv\Scripts\activate # On Windows source venv/bin/activate # On macOS/Linux
- Upgrade pip:
python -m pip install --upgrade pip - If you see errors about numpy or Pillow, run
pip install numpy Pillowbefore installing dlib or face_recognition.
- Use a virtual environment:
- Camera Not Working
- Ensure camera permissions are granted
- Check if camera is being used by another application
- Try refreshing the page
- Face Recognition Not Working
- Ensure good lighting conditions
- Face should be clearly visible and centered
- Check if face is properly registered
- Performance Issues
- Close other applications using the camera
- Ensure adequate system resources
- Consider reducing camera resolution
POST /api/register- Register a new face (supports both file upload and base64 image)- File Upload: Send
multipart/form-datawithfileandnamefields - Camera Capture: Send JSON with
image(base64) andnamefields
- File Upload: Send
GET /api/registered-faces- Get list of registered faces
POST /api/attendance- Mark attendance manuallyGET /api/attendance-list- Get today's attendance
GET /uploads/<filename>- Access stored images
stream_frame- Send camera frame for real-time detectionface_detected- Receive detection results
- Fork the repository
- Create a 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
This project is licensed under the MIT License - see the LICENSE file for details.
Vignesh B S - Developer and Maintainer
- face_recognition library by Adam Geitgey
- Flask web framework
- Bootstrap for responsive UI components
- Socket.IO for real-time communication
If you encounter any issues or have questions:
- Check the troubleshooting section above
- Review the project documentation
- Open an issue on the repository
- Contact the development team
A modern, real-time face recognition attendance system
Developed by Vignesh B S
Β© 2024 Vignesh B S. All rights reserved.
Empowering efficient attendance management through AI-powered face recognition

