A modern, lightweight web-based face recognition system built with Flask and OpenCV. This system provides real-time face detection, registration, and recognition capabilities with a clean, professional user interface.
- Manual Attendance Taking: Eliminates time-consuming roll calls and paper-based systems
- Buddy Punching: Prevents attendance fraud through biometric verification
- Lost Attendance Records: Provides digital backup and export capabilities
- Human Error: Reduces mistakes in manual attendance recording
- Unauthorized Access: Secure identity verification for restricted areas
- Key Card Dependencies: Eliminates need for physical cards or badges
- Visitor Management: Easy registration and tracking of temporary personnel
- Identity Verification: Reliable person identification in security systems
- Time Wastage: Reduces time spent on attendance and check-in processes
- Administrative Overhead: Automates repetitive identification tasks
- Scalability Issues: Handles large numbers of users efficiently
- Integration Complexity: Simple web-based system works across platforms
- Expensive Solutions: Provides enterprise-level features without high costs
- Complex Setup: Easy installation with minimal dependencies
- Hardware Requirements: Works with standard webcams and computers
- Maintenance Issues: Self-contained system with simple file-based storage
- Real-time Face Registration: Capture and register faces using live camera feed
- Live Face Recognition: Real-time face detection and identification
- Attendance System: Automatic attendance marking with visual indicators
- Database Management: Complete CRUD operations for registered identities
- Duplicate Prevention: Advanced face similarity detection to prevent duplicate registrations
- Modern UI/UX: Clean, responsive design with Tailwind CSS
- Professional Interface: Consistent design across all pages
- Real-time Feedback: Live face overlay and status indicators
- Mobile Responsive: Optimized for all screen sizes
- Intuitive Navigation: Easy-to-use interface with clear instructions
- No Heavy Dependencies: Pure OpenCV implementation without dlib
- High Accuracy: Multi-image registration for improved recognition
- Face Quality Validation: Automatic face position and quality checking
- JSON Storage: Simple file-based data persistence
- Export Capabilities: CSV export for attendance records
- Python 3.7+ - Download Python
- Web camera (for live recognition)
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Git (optional) - Download Git
-
Download or Clone the repository
# Using Git git clone https://github.com/yourusername/face-recognition-system.git cd face-recognition-system # Or download ZIP and extract
-
Install all dependencies at once
pip install -r requirements.txt
-
Run the application
python app.py
-
Open your browser and navigate to
http://localhost:5001
-
Create project directory
mkdir face-recognition-system cd face-recognition-system -
Download project files
- Download all files from the repository
- Place them in your project directory
-
Install dependencies individually
pip install flask==3.0.0 pip install opencv-python==4.8.1.78 pip install pillow==10.1.0 pip install numpy==1.24.3
-
Verify installation
python -c "import cv2, flask, PIL, numpy; print('All dependencies installed successfully!')" -
Run the application
python app.py
-
Create virtual environment
# Windows python -m venv face-recognition-env face-recognition-env\Scripts\activate # macOS/Linux python3 -m venv face-recognition-env source face-recognition-env/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Deactivate environment when done
deactivate
1. OpenCV Installation Problems
# If opencv-python fails to install
pip install --upgrade pip
pip install opencv-python-headless==4.8.1.782. Permission Errors
# Windows: Run as Administrator or use --user flag
pip install --user -r requirements.txt
# macOS/Linux: Use sudo or --user flag
sudo pip install -r requirements.txt
# OR
pip install --user -r requirements.txt3. Python Version Issues
# Check Python version
python --version
# Use specific Python version if multiple installed
python3.9 app.py4. Camera Access Issues
- Windows: Check Windows Privacy Settings → Camera → Allow apps to access camera
- macOS: System Preferences → Security & Privacy → Camera → Allow browser access
- Linux: Ensure user is in video group:
sudo usermod -a -G video $USER
5. Port Already in Use
# Change port in app.py or kill existing process
# Windows
netstat -ano | findstr :5001
taskkill /PID <process_id> /F
# macOS/Linux
lsof -ti:5001 | xargs kill -9-
Check if server is running
- Look for message: "Running on http://127.0.0.1:5001"
- No error messages in terminal
-
Test camera access
- Navigate to http://localhost:5001
- Click "Register Face"
- Camera should activate and show video feed
-
Test face detection
- Position face in camera view
- Green rectangle should appear around detected faces
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 2GB | 4GB+ |
| CPU | Dual-core 2GHz | Quad-core 2.5GHz+ |
| Storage | 100MB | 500MB+ |
| Camera | 480p | 720p+ |
| Browser | Chrome 60+ | Latest Chrome/Firefox |
- Register Faces: Navigate to "Register Face" to add new identities
- Take Attendance: Use "Start Camera" for real-time recognition
- Manage Database: Access "View Database" to manage registered faces
- View Instructions: Check "Instructions" for detailed registration guide
- Enter the person's full name
- Position face within the camera view
- System automatically captures 3 high-quality photos
- Face quality validation ensures optimal recognition
- Duplicate detection prevents multiple registrations
- Real-time Detection: Live face overlay with confidence scores
- Attendance Tracking: Automatic present/absent status
- Visual Indicators: Color-coded face borders and status
- Export Data: Download attendance records as CSV
- Flask Web Framework: RESTful API and route handling
- OpenCV: Computer vision and face detection
- SimpleFaceRecognizer: Custom face recognition engine
- JSON Storage: Persistent data storage
- Tailwind CSS: Modern utility-first styling
- Vanilla JavaScript: Real-time camera handling
- HTML5 Canvas: Face overlay rendering
- Font Awesome: Professional iconography
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Main dashboard |
/register |
GET | Registration page |
/camera |
GET | Live recognition interface |
/database |
GET | Database management |
/instructions |
GET | User guide |
/register_multiple |
POST | Register new face |
/recognize |
POST | Recognize faces |
/detect_faces |
POST | Detect faces (live preview) |
/delete_face/<name> |
POST | Remove registered face |
face-recognition-system/
├── app.py # Main Flask application
├── face_data.json # Face database (auto-generated)
├── templates/ # HTML templates
│ ├── index.html # Main dashboard
│ ├── register.html # Face registration
│ ├── camera.html # Live recognition
│ ├── database.html # Database management
│ └── instructions.html # User guide
├── static/ # Static assets (if any)
└── README.md # Project documentation
- Default resolution: 1280x720 (ideal quality)
- Display size: 640x480 (optimized for UI)
- Frame rate: 30fps for smooth operation
- Face detection: OpenCV Haar Cascades
- Similarity threshold: 75-85% (configurable)
- Registration requirement: 3 high-quality photos
- Real-time recognition frequency: 200ms intervals
- Duplicate Prevention: Advanced face similarity detection
- Input Validation: Comprehensive data validation
- Error Handling: Graceful error management
- XSS Protection: Secure data handling
- Lightweight: No heavy dependencies (dlib-free)
- Fast Processing: Optimized OpenCV implementation
- Real-time: Sub-200ms recognition response
- Memory Efficient: Minimal resource usage
- Chrome 60+ (Recommended)
- Firefox 55+
- Safari 11+
- Edge 79+
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenCV community for computer vision tools
- Tailwind CSS for the styling framework
- Flask framework for web development
- Font Awesome for professional icons
For support, please open an issue in the GitHub repository or contact [[email protected]].
- v1.0.0 - Initial release with core functionality
- v1.1.0 - Added database management and improved UI
- v1.2.0 - Enhanced face recognition accuracy and real-time features
Built with ❤️ using Python, Flask, and OpenCV