Skip to content

NiqueWrld/Face-Recognition-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Recognition System

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.

� Problems This Solution Fixes

Traditional Attendance Issues

  • 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

Security & Access Control

  • 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

Operational Challenges

  • 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

Technical Limitations

  • 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

�🌟 Features

Core Functionality

  • 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

User Experience

  • 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

Technical Features

  • 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

🚀 Installation Guide

Prerequisites

  • Python 3.7+ - Download Python
  • Web camera (for live recognition)
  • Modern web browser (Chrome, Firefox, Safari, Edge)
  • Git (optional) - Download Git

Option 1: Quick Installation (Recommended)

  1. 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
  2. Install all dependencies at once

    pip install -r requirements.txt
  3. Run the application

    python app.py
  4. Open your browser and navigate to

    http://localhost:5001
    

Option 2: Manual Installation

  1. Create project directory

    mkdir face-recognition-system
    cd face-recognition-system
  2. Download project files

    • Download all files from the repository
    • Place them in your project directory
  3. 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
  4. Verify installation

    python -c "import cv2, flask, PIL, numpy; print('All dependencies installed successfully!')"
  5. Run the application

    python app.py

Option 3: Virtual Environment Setup (Best Practice)

  1. 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
  2. Install dependencies

    pip install -r requirements.txt
  3. Run the application

    python app.py
  4. Deactivate environment when done

    deactivate

Troubleshooting Installation

Common Issues and Solutions

1. OpenCV Installation Problems

# If opencv-python fails to install
pip install --upgrade pip
pip install opencv-python-headless==4.8.1.78

2. 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.txt

3. Python Version Issues

# Check Python version
python --version

# Use specific Python version if multiple installed
python3.9 app.py

4. 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

Verification Steps

  1. Check if server is running

  2. Test camera access

  3. Test face detection

    • Position face in camera view
    • Green rectangle should appear around detected faces

System Requirements

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

📖 User Guide

Getting Started

  1. Register Faces: Navigate to "Register Face" to add new identities
  2. Take Attendance: Use "Start Camera" for real-time recognition
  3. Manage Database: Access "View Database" to manage registered faces
  4. View Instructions: Check "Instructions" for detailed registration guide

Face Registration Process

  1. Enter the person's full name
  2. Position face within the camera view
  3. System automatically captures 3 high-quality photos
  4. Face quality validation ensures optimal recognition
  5. Duplicate detection prevents multiple registrations

Recognition Features

  • 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

🛠️ Technical Architecture

Backend Components

  • Flask Web Framework: RESTful API and route handling
  • OpenCV: Computer vision and face detection
  • SimpleFaceRecognizer: Custom face recognition engine
  • JSON Storage: Persistent data storage

Frontend Technologies

  • Tailwind CSS: Modern utility-first styling
  • Vanilla JavaScript: Real-time camera handling
  • HTML5 Canvas: Face overlay rendering
  • Font Awesome: Professional iconography

API Endpoints

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

📁 Project Structure

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

🔧 Configuration

Camera Settings

  • Default resolution: 1280x720 (ideal quality)
  • Display size: 640x480 (optimized for UI)
  • Frame rate: 30fps for smooth operation

Recognition Parameters

  • Face detection: OpenCV Haar Cascades
  • Similarity threshold: 75-85% (configurable)
  • Registration requirement: 3 high-quality photos
  • Real-time recognition frequency: 200ms intervals

🔒 Security Features

  • Duplicate Prevention: Advanced face similarity detection
  • Input Validation: Comprehensive data validation
  • Error Handling: Graceful error management
  • XSS Protection: Secure data handling

🎯 Performance

  • Lightweight: No heavy dependencies (dlib-free)
  • Fast Processing: Optimized OpenCV implementation
  • Real-time: Sub-200ms recognition response
  • Memory Efficient: Minimal resource usage

📱 Browser Compatibility

  • Chrome 60+ (Recommended)
  • Firefox 55+
  • Safari 11+
  • Edge 79+

🤝 Contributing

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

📄 License

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

🙏 Acknowledgments

  • OpenCV community for computer vision tools
  • Tailwind CSS for the styling framework
  • Flask framework for web development
  • Font Awesome for professional icons

📞 Support

For support, please open an issue in the GitHub repository or contact [[email protected]].

🔄 Version History

  • 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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors