Skip to content

rulzi/facerecognition

Repository files navigation

๐Ÿค– Face Recognition App

โœ… STATUS: FULLY FUNCTIONAL & OPTIMIZED FOR PERFORMANCE Evidence: Face recognition working perfectly with 5x speed improvements!

๐Ÿงน R๐Ÿ’ก Solution:**

# STEP 1: Navigate to project directory
cd /path/to/your/facerecognition

# STEP 2: Activate virtual environment (REQUIRED!)
source venv/bin/activate

# STEP 3: Verify the environment is active (you should see "(venv)" in prompt)
# STEP 4: Run the application
python demo.py
```NED UP:** Project streamlined from 18 to 10 Python files (44% reduction)

๐Ÿ“– **For complete documentation, see [COMPLETE_GUIDE.md](COMPLETE_GUIDE.md)**

## ๐Ÿš€ Quick Start (Copy & Paste This!)

```bash
cd /path/to/your/facerecognition
source venv/bin/activate
python demo.py

Choose Option 4 for fastest recognition or Option 1 for basic detection!

โšก NEW: Performance Optimized Options

  • Option 4: โšก Fast Recognition (5x faster, real-time)
  • Option 3: ๐Ÿ‘ค Regular Recognition (2x faster, balanced)

๐ŸŽฎ Camera Controls

  • Q - Quit | S - Screenshot | F - Save faces | H - Help

๐Ÿšจ Fix "No module named 'cv2'" Error

# Always activate the virtual environment first!
source venv/bin/activate

โœ… CONFIRMED WORKING FEATURES

  • ๐ŸŽฅ Real-time face detection (OpenCV)
  • ๐Ÿง  Advanced face recognition (Deep Learning)
  • ๐Ÿ’พ Screenshot & face saving
  • ๐Ÿ‘ค Face database management
  • ๐ŸŽฎ Interactive controls

Features

Simple Face Detection (OpenCV)

  • Real-time face detection using Haar Cascades
  • Works out of the box with minimal setup
  • Save detected faces and screenshots
  • Basic face counting

Advanced Face Recognition (face_recognition library)

  • High-accuracy face recognition using deep learning
  • Add and recognize known faces
  • Confidence scoring
  • Face database management

Installation

Quick Setup

# Make setup script executable and run it
chmod +x setup.sh
./setup.sh

Manual Installation

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install system dependencies (macOS)
brew install cmake

# Install Python packages
pip install -r requirements.txt

Usage

Quick Start

# STEP 1: Navigate to the project directory
cd /path/to/your/facerecognition

# STEP 2: Activate virtual environment (REQUIRED!)
source venv/bin/activate

# STEP 3: Run the demo application
python demo.py

๐Ÿšจ CRITICAL: You must activate the virtual environment (source venv/bin/activate) before running any Python commands, or you'll get "No module named 'cv2'" errors!

Individual Applications

Simple Face Detection

python simple_face_detection.py

Advanced Face Recognition

python face_recognition_app.py

Face Database Management

# List known faces
python face_manager.py list

# Add face from camera
python face_manager.py capture --name "Person Name"

# Add face from image
python face_manager.py add --name "Person Name" --image "path/to/image.jpg"

Controls

Simple Face Detection

  • 'q' - Quit
  • 's' - Save screenshot
  • 'f' - Save detected faces

Advanced Face Recognition

  • 'q' - Quit
  • 's' - Save screenshot
  • 'a' - Add current face to database
  • 'r' - Reload known faces

Project Structure

facerecognition/
โ”œโ”€โ”€ ๐Ÿ“ฑ MAIN APPLICATIONS
โ”‚   โ”œโ”€โ”€ demo.py                    # Main menu (4 options)
โ”‚   โ”œโ”€โ”€ run_demo.py                # Option 1: Face Detection Demo
โ”‚   โ”œโ”€โ”€ simple_face_detection.py   # Option 2: Simple Face Detection  
โ”‚   โ”œโ”€โ”€ save_and_recognize.py      # Option 3: Recognition with saving
โ”‚   โ””โ”€โ”€ fast_face_recognition.py   # Option 4: Fast Recognition (NEW)
โ”œโ”€โ”€ ๐Ÿ”ง CORE LIBRARIES
โ”‚   โ”œโ”€โ”€ face_database.py           # Face database management
โ”‚   โ”œโ”€โ”€ face_recognition_compat.py # Compatibility layer
โ”‚   โ””โ”€โ”€ face_manager.py            # CLI face management tool
โ”œโ”€โ”€ ๐ŸŽ›๏ธ SUPPORTING TOOLS
โ”‚   โ”œโ”€โ”€ face_recognition_app.py    # Advanced recognition standalone
โ”‚   โ””โ”€โ”€ test_setup.py              # Setup testing script
โ”œโ”€โ”€ ๐Ÿ“„ SETUP & CONFIG
โ”‚   โ”œโ”€โ”€ setup.sh                   # Automated setup script
โ”‚   โ”œโ”€โ”€ start.sh                   # Quick launcher
โ”‚   โ”œโ”€โ”€ launch                     # One-command launcher
โ”‚   โ”œโ”€โ”€ requirements.txt           # Python dependencies
โ”‚   โ””โ”€โ”€ .gitignore                 # Git ignore rules
โ”œโ”€โ”€ ๐Ÿ“š DOCUMENTATION
โ”‚   โ”œโ”€โ”€ README.md                  # This file
โ”‚   โ””โ”€โ”€ COMPLETE_GUIDE.md          # Comprehensive guide
โ”œโ”€โ”€ ๐Ÿ“ DATA DIRECTORIES
โ”‚   โ”œโ”€โ”€ known_faces/              # Known face images
โ”‚   โ”œโ”€โ”€ detected_faces/           # Saved detected faces
โ”‚   โ”œโ”€โ”€ screenshots/              # Saved screenshots
โ”‚   โ””โ”€โ”€ face_database.pkl         # Face encodings database
โ””โ”€โ”€ ๐Ÿ”ง ENVIRONMENT
    โ””โ”€โ”€ venv/                     # Virtual environment

Troubleshooting

โŒ Error: "No module named 'cv2'"

This is the most common issue!

๐Ÿ’ก Solution:

# STEP 1: Navigate to project directory
cd /path/to/your/facerecognition

# STEP 2: Activate virtual environment (REQUIRED!)
source venv/bin/activate

# STEP 3: Verify environment is active (you should see "(venv)" in prompt)
# STEP 4: Run the application
python demo.py

๐Ÿš€ Quick Fix: Use the launcher script

./start.sh

Other Issues:

  • Advanced face recognition not working: Try the simple face detection first (it requires fewer dependencies)
  • Camera issues: Make sure cmake is installed: brew install cmake
  • Setup problems: Run the setup test: python test_setup.py
  • Camera not accessible: Check that your camera is not being used by another application

Requirements

  • Python 3.8+
  • macOS/Linux (Windows support may require additional setup)
  • Webcam or camera device
  • For advanced features: cmake and compilation tools

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors