Skip to content

Tayeb-Ali/Face-recognition-system

Repository files navigation

SmartFace: Intelligent Face Recognition System

Overview

SmartFace is a comprehensive facial recognition and authentication system that combines modern computer vision techniques with database management for reliable person identification. The system implements a complete pipeline for face detection, recognition, and management using state-of-the-art technologies.

Features

  • Real-time face detection and tracking
  • Eye detection for improved accuracy
  • User profile management with SQLite database
  • Training interface for new users
  • Real-time recognition with confidence scoring
  • Support for multiple camera inputs
  • Automated dataset generation

Technologies Used

Core Technologies

  • Python: Primary programming language
  • OpenCV (cv2): Computer vision and image processing
  • NumPy: Numerical computations and array operations
  • PIL (Python Imaging Library): Image manipulation
  • SQLite3: Database management

Face Detection

  • Haar Cascade Classifiers
    • Pre-trained XML files for face and eye detection
    • haarcascade_frontalface_default.xml: Primary face detector
    • haarcascade_eye.xml: Eye detection for validation

Face Recognition

  • LBPH (Local Binary Pattern Histogram)
    • Illumination-invariant face recognition
    • Progressive learning capabilities
    • Real-time performance optimization
    • Confidence scoring for recognition accuracy

Data Management

  • SQLite Database
    • User profile storage
    • CRUD operations support
    • Efficient data retrieval
    • Lightweight and portable

Project Structure

├── dataSetGenerator.py    # Captures and creates training dataset
├── detectory.py          # Main recognition and detection system
├── trainner.py           # Trains the face recognition model
├── FaceBase.db          # SQLite database for user profiles
├── haarcascade_eye.xml  # Eye detection classifier
└── haarcascade_frontalface_default.xml  # Face detection classifier

System Components

1. Data Collection (dataSetGenerator.py)

  • Captures user images through webcam
  • Implements face detection
  • Stores captured images in dataset
  • Updates user information in database

2. Training System (trainner.py)

  • Processes collected images
  • Creates LBPH face recognition model
  • Generates and saves training data
  • Optimizes recognition parameters

3. Recognition System (detectory.py)

  • Real-time face detection
  • User identification
  • Profile information display
  • Confidence level calculation

Technical Specifications

Image Processing Pipeline

  1. Frame capture from video input
  2. Conversion to grayscale
  3. Face detection using Haar Cascades
  4. Eye detection for validation
  5. Feature extraction
  6. Recognition and matching
  7. Result display

Database Schema

  • User ID (Primary Key)
  • Name
  • Age
  • Gender
  • Additional profile information

Performance Optimizations

  • Numpy array operations for fast processing
  • Optimized detection parameters
  • Cached data processing
  • Efficient database queries

Requirements

Hardware

  • Webcam or USB camera
  • Processor: 2.0 GHz or higher
  • RAM: 4GB minimum
  • Storage: 1GB free space

Software

  • Python 3.x
  • OpenCV
  • NumPy
  • PIL
  • SQLite3

Installation

  1. Clone the repository
git clone [repository-url]
  1. Install required packages
pip install opencv-python numpy pillow
  1. Initialize the database
python init_database.py

Usage

Adding New Users

python dataSetGenerator.py
  • Enter user ID and name when prompted
  • System will capture face images
  • Look at different angles when prompted

Training the System

python trainner.py
  • Processes all collected images
  • Creates/updates recognition model

Running Recognition

python detectory.py
  • Starts real-time recognition
  • Displays user information when detected

Performance Metrics

  • Face Detection Speed: ~30 FPS
  • Recognition Accuracy: >95% under good lighting
  • Database Response Time: <100ms
  • Training Time: ~1-2 minutes for 100 images

Best Practices

  • Ensure good lighting conditions
  • Maintain 0.5-1m distance from camera
  • Collect varied facial expressions
  • Regular model retraining
  • Backup database regularly

Future Enhancements

  • Multi-face recognition
  • Emotion detection
  • Age and gender estimation
  • Web interface integration
  • Cloud database support
  • Mobile application support

Contributors

  • Eltayeb Hassan

License

BSD

Support

me[at]elteyab[dot]sd

Releases

No releases published

Packages

No packages published

Languages