CoolFace
Apppublic

irsyadakbar01/revastco-facerecognizer

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
App README

🎯 FaceMatch AI - Advanced Face Recognition System

![Streamlit](https://streamlit.io) ![DeepFace](https://github.com/serengil/deepface) ![TensorFlow](https://tensorflow.org) ![Python](https://python.org) ![Hugging Face](https://huggingface.co/spaces)

An advanced facial recognition system powered by deep learning neural networks, designed for high-accuracy face matching in group photos and challenging conditions. Optimized for Hugging Face Spaces deployment.

πŸš€ Ready to Deploy? This app is ready for Hugging Face Spaces! Jump to Deployment Section for step-by-step guide.

✨ Features

πŸš€ 5 Performance Tiers

  • β€”βš‘ Ultra Fast Mode (~0.5-1s) - Single model, quick results
  • β€”βš‘ Fast Mode (~1-2s) - Balanced speed and accuracy [RECOMMENDED]
  • β€”πŸŽ― Accurate Mode (~3-5s) - 3-model ensemble for high accuracy
  • β€”πŸ”₯ HardMode (~10-20s) - 4-5 model ensemble for maximum accuracy
  • β€”βš‘πŸ”₯ Extreme Mode (~5-15s) - SUPERIOR: Multi-detector + 5+ models + FAISS [BEST]

🎨 Advanced Capabilities

  • β€”βœ… Multi-face detection - Detect and recognize multiple faces in a single photo
  • β€”βœ… Group photo support - Optimized for 21+ people in challenging conditions
  • β€”βœ… Multi-detector approach - RetinaFace, MTCNN, OpenCV for best detection
  • β€”βœ… Adaptive thresholding - Quality-based threshold adjustment per face
  • β€”βœ… Face enhancement - CLAHE, bilateral filtering, sharpening
  • β€”βœ… Second-pass matching - Automatic retry with enhancement for unmatched faces
  • β€”βœ… Cross-model verification - Reduces false positives significantly
  • β€”βœ… Persistent caching - Instant load times after initial setup
  • β€”βœ… Multi-user support - Concurrent access with session isolation
  • β€”βœ… Admin panel - Cache management and pre-warming tools

🧠 AI Models Used

  • β€”Facenet512 - High-accuracy face embeddings (weighted 1.5x)
  • β€”ArcFace - State-of-the-art face recognition (weighted 1.5x)
  • β€”VGG-Face - Robust face representation
  • β€”OpenFace - Lightweight and efficient
  • β€”SFace - Additional verification layer
  • β€”FAISS - Fast similarity search for large datasets

🎬 Quick Deployment Overview

For Hugging Face Spaces Users:

  1. 1.Create Space β†’ Choose Streamlit SDK
  2. 2.Upload Files β†’ All project files including persistent_cache/ (pre-warmed)
  3. 3.Set Secrets β†’ Admin credentials in Space settings
  4. 4.Launch β†’ Instant startup with pre-warmed cache!

Time to deploy: 5-10 minutes (with pre-warmed cache) | First load: < 10 seconds ⚑

πŸ“– Full deployment guide below β†’ Jump to Deployment


πŸ“‹ Table of Contents


πŸ› οΈ Installation

Prerequisites

  • β€”Python 3.8 or higher
  • β€”4GB+ RAM (8GB recommended for Extreme Mode)
  • β€”Windows, macOS, or Linux

Step 1: Clone the Repository

bash
git clone <your-repo-url>
cd "FaceMatch Detector"

Step 2: Install Dependencies

bash
pip install -r requirements.txt

Dependencies include:

  • β€”Streamlit 1.32.2 - Web interface
  • β€”DeepFace 0.0.91 - Face recognition library
  • β€”TensorFlow 2.13.0 - Deep learning framework
  • β€”OpenCV - Computer vision tools
  • β€”FAISS - Fast similarity search
  • β€”InsightFace - Additional face recognition models
  • β€”And more... (see requirements.txt)

πŸš€ Quick Start

1️⃣ Prepare Your Dataset

Create a students_data.json file with your face database:

json
{
  "students": [
    {
      "nama": "John Doe",
      "nim": "123456",
      "foto": "foto rev/john.jpg",
      "kelas": "A"
    }
  ]
}

Place reference photos in the foto rev/ directory.

2️⃣ Run the Application

bash
streamlit run app.py

The application will be available at: http://localhost:8501

3️⃣ Pre-warm Cache (Recommended)

For instant performance on subsequent runs:

Option A: Via Script (Fastest)

bash
python prewarm_cache.py

Option B: Via Admin Panel

  1. 1.Run admin panel: run_admin.bat (Windows) or ./run_admin.sh (Linux/Mac)
  2. 2.Access at: http://localhost:7861
  3. 3.Login with default credentials (username: admin, password: admin)
  4. 4.Go to "πŸš€ Pre-warming" tab and click pre-warm for each mode

⏱️ First-time setup: 60-90 minutes ⚑ After pre-warming: Instant (< 1 second load time)


πŸ“– Usage

Basic Recognition Flow

  1. 1.Select Recognition Mode - Choose from 5 performance tiers based on your needs
  2. 2.Upload Photo - Support for JPG, PNG, JPEG formats
  3. 3.Adjust Threshold (Optional) - Fine-tune matching sensitivity (0.3-0.6)
  4. 4.Detect Faces - AI processes the image and finds all faces
  5. 5.View Results - See matched students with confidence scores and details

Recognition Modes Explained

ModeSpeedAccuracyBest ForModels Used
Ultra Fast0.5-1sGoodQuick testing1 model
Fast ⭐1-2sHighDaily use1 optimized model
Accurate3-5sVery HighImportant matches3-model ensemble
HardMode10-20sMaximumCritical accuracy4-5 model ensemble
Extreme πŸ”₯5-15sSUPERIORLarge groups, challenges5+ models + FAISS + Multi-detector

Threshold Guidelines

  • β€”0.30-0.35 - Very permissive (more matches, some false positives)
  • β€”0.35-0.40 - Balanced (recommended)
  • β€”0.40-0.50 - Strict (fewer matches, high confidence)
  • β€”0.50-0.60 - Very strict (only very clear matches)

πŸ”§ Admin Panel

Access the admin panel to manage cache and optimize performance.

Starting Admin Panel

Windows:

bash
run_admin.bat

Linux/Mac:

bash
chmod +x run_admin.sh
./run_admin.sh

Manual:

bash
streamlit run admin_cache.py --server.port 7861

Access at: http://localhost:7861

Admin Features

πŸ“Š Cache Status Tab
  • β€”View all cached modes
  • β€”Monitor storage usage
  • β€”Check cache validity
  • β€”See creation timestamps
πŸš€ Pre-warming Tab
  • β€”Pre-warm each mode individually
  • β€”View progress in real-time
  • β€”Verify successful caching
πŸ”’ Security Settings
  • β€”Change admin credentials
  • β€”Secure your admin panel

⚠️ IMPORTANT: Change default credentials immediately!

bash
python update_admin_password.py

πŸ“¦ Data Preparation

Student Database Format

Create students_data.json:

json
{
  "students": [
    {
      "nama": "Student Name",
      "nim": "Student ID",
      "foto": "foto rev/student.jpg",
      "kelas": "Class Name",
      "jurusan": "Major (optional)",
      "angkatan": "Year (optional)"
    }
  ]
}

Photo Requirements

  • β€”Format: JPG, PNG, JPEG
  • β€”Quality: High resolution preferred (minimum 640x480)
  • β€”Face visibility: Clear, front-facing photos work best
  • β€”Lighting: Good lighting conditions
  • β€”Location: Place in foto rev/ directory
  • β€”Naming: Match the filename in students_data.json

Prepare Data Script

Use the included script to organize your data:

bash
python prepare_data.py

βš™οΈ Configuration

Application Settings

Edit app.py to customize:

python
# Page configuration
st.set_page_config(
    page_title="FaceMatch AI - Recognition System",
    page_icon="🎯",
    layout="wide"
)

Cache Configuration

Cache is automatically managed by cache_manager.py:

  • β€”Location: persistent_cache/ directory
  • β€”Format: Pickle files with embeddings and metadata
  • β€”Validation: Hash-based integrity checking
  • β€”Modes: Separate cache for each recognition mode

Environment Variables

For deployment (e.g., Hugging Face Spaces):

bash
ADMIN_USERNAME=your_username
ADMIN_PASSWORD=your_secure_password

🌐 Deployment to Hugging Face Spaces

πŸš€ Quick Deployment Guide

Step 1: Create Hugging Face Space
  1. 1.Login to Hugging Face
  2. 2.Click "New Space"
  3. 3.Choose:
  4. 4.SDK: Streamlit
  5. 5.Space name: facematch-ai (or your preferred name)
  6. 6.Visibility: Private (recommended) or Public
  7. 7.Hardware: CPU Basic (Free) or upgrade for better performance
Step 2: Prepare Your Repository

Required files structure:

FaceMatch Detector/
β”œβ”€β”€ app.py                      # Main application βœ…
β”œβ”€β”€ admin_cache.py              # Admin panel βœ…
β”œβ”€β”€ cache_manager.py            # Cache management βœ…
β”œβ”€β”€ requirements.txt            # Dependencies βœ…
β”œβ”€β”€ packages.txt                # System packages (empty is OK) βœ…
β”œβ”€β”€ students_data.json          # Your student database βœ…
β”œβ”€β”€ admin_config.json           # Admin credentials βœ…
β”œβ”€β”€ foto rev/                   # Reference photos βœ…
β”œβ”€β”€ persistent_cache/           # Pre-warmed cache (recommended) βœ…
└── README.md                   # This file (with HF metadata) βœ…
Step 3: Pre-warm Cache (HIGHLY RECOMMENDED)

⚠️ IMPORTANT: Pre-warming saves 25-35 minutes of wait time for first user!

Option A: Local Pre-warming (Recommended)

bash
# Install dependencies locally
pip install -r requirements.txt

# Run pre-warming script
python prewarm_cache.py

# This creates persistent_cache/ folder with all embeddings
# Takes 60-90 minutes but only needs to be done ONCE

Option B: Use Admin Panel

bash
# Run admin panel
run_admin.bat  # Windows
./run_admin.sh # Linux/Mac

# Access at http://localhost:7861
# Login and pre-warm each mode
Step 4: Upload to Hugging Face

Via Git (Recommended):

bash
# Clone your space
git clone https://huggingface.co/spaces/YOUR_USERNAME/facematch-ai
cd facematch-ai

# Copy all files from your project
cp -r "path/to/FaceMatch Detector/"* .

# IMPORTANT: Ensure .gitignore allows persistent_cache/
# Check .gitignore doesn't have: persistent_cache/

# Add files
git add .

# Commit (may take time if including cache - ~1.2GB)
git commit -m "Initial deployment with pre-warmed cache"

# Push to Hugging Face
git push

Via Web UI:

  1. 1.Go to your Space β†’ Files
  2. 2.Click "Add file" β†’ "Upload files"
  3. 3.Upload all files including persistent_cache/ folder
  4. 4.Commit changes
Step 5: Configure Secrets (Security)

In your Space settings β†’ Repository secrets, add:

ADMIN_USERNAME=your_secure_username
ADMIN_PASSWORD=your_secure_password

⚠️ Change default credentials immediately! Default is admin/admin

bash
# Generate new password hash locally
python update_admin_password.py
Step 6: Verify Deployment
  1. 1.Wait for build - Check "Building" status in Space
  2. 2.Access app - Click "Open Space" when ready
  3. 3.Test recognition - Upload a test photo
  4. 4.Check cache - Should load instantly if pre-warmed
  5. 5.Access admin - Run admin panel separately if needed

Your Space URL: https://huggingface.co/spaces/YOUR_USERNAME/facematch-ai


πŸ“Š Deployment Performance

SetupFirst Load TimeUser ExperienceStorage
Without Cache ❌25-35 minutesPoorMinimal
With Cache βœ…< 10 secondsExcellent~1.2-1.5 GB

Recommendation: Always pre-warm and commit cache!


πŸ” Security Best Practices

  1. 1.Change default credentials:
bash
   python update_admin_password.py
  1. 1.Use environment variables for sensitive data:
  2. 2.Set in Space Settings β†’ Repository secrets
  3. 3.Don't commit credentials to Git
  1. 1.Set visibility:
  2. 2.Private: Only you can access
  3. 3.Public: Anyone can use (be careful with personal data!)
  1. 1.Monitor access:
  2. 2.Check Space logs regularly
  3. 3.Review admin panel access logs

βš™οΈ Advanced Configuration

Hardware Upgrades (Optional)

For better performance, upgrade Space hardware:

  • β€”CPU Basic (Free) - Suitable for small datasets (<100 students)
  • β€”CPU Upgrade ($9/month) - Better for medium datasets (100-500 students)
  • β€”GPU ($60+/month) - Fastest for large datasets (500+ students)
Multi-Page App Setup

Access admin panel as a separate page:

bash
# Create pages directory
mkdir pages

# Move admin to pages
mv admin_cache.py pages/1_πŸ”§_Admin_Panel.py

Streamlit will auto-detect and show in sidebar!

Custom Domain (Optional)
  1. 1.Upgrade to Hugging Face Pro
  2. 2.Settings β†’ Custom domain
  3. 3.Follow DNS configuration steps

πŸ› Troubleshooting Deployment

❌ Space stuck on "Building"

Solution: Check build logs for errors. Common issues:

  • β€”Missing dependencies in requirements.txt
  • β€”Python version mismatch
  • β€”Large files timing out
❌ "Out of memory" error

Solution:

  • β€”Use only Fast/Accurate modes (disable HardMode/Extreme)
  • β€”Reduce cache size
  • β€”Upgrade to better hardware
❌ Cache not loading

Solution:

  • β€”Verify persistent_cache/ folder uploaded correctly
  • β€”Check if files are Git LFS tracked (for large files)
  • β€”Re-run pre-warming
❌ Slow performance

Solution:

  • β€”Ensure cache is pre-warmed and committed
  • β€”Upgrade hardware
  • β€”Check Space isn't sleeping (Free tier sleeps after inactivity)
❌ Admin panel not accessible

Solution:

  • β€”Set up as multi-page app (see Advanced Configuration)
  • β€”Or run separately: streamlit run admin_cache.py --server.port 7861

πŸ“– Additional Resources

  • β€”πŸ“˜ Detailed guide: See HUGGINGFACE_DEPLOYMENT.md
  • β€”πŸš€ Quick start: See QUICKSTART.md
  • β€”πŸ”§ Admin guide: See ADMIN_ACCESS_GUIDE.md
  • β€”πŸ—„οΈ Cache system: See CACHE_SYSTEM_README.md

🎯 Deployment Checklist

Before going live, ensure:

  • β€”βœ… All files uploaded correctly
  • β€”βœ… Cache pre-warmed and committed
  • β€”βœ… Admin credentials changed
  • β€”βœ… Environment variables set
  • β€”βœ… Student data populated
  • β€”βœ… Reference photos uploaded
  • β€”βœ… App tested and working
  • β€”βœ… Admin panel accessible
  • β€”βœ… Performance acceptable
  • β€”βœ… Security configured

Ready to deploy? Follow the steps above! πŸš€


πŸ› Troubleshooting

Common Issues

❌ "Cache manager not available"

Solution: Ensure cache_manager.py exists in the project directory

❌ "Failed to load embeddings"

Solution: Run pre-warming script:

bash
python prewarm_cache.py
❌ Slow first run

Expected: First run takes 5-20 minutes to compute embeddings. Use pre-warming to speed up!

❌ Low detection rate

Solution:

  • β€”Try Extreme Mode for challenging photos
  • β€”Adjust threshold (lower = more permissive)
  • β€”Ensure reference photos are high quality
  • β€”Check lighting and face visibility
❌ Memory errors

Solution:

  • β€”Use lower modes (Ultra Fast or Fast)
  • β€”Reduce image resolution
  • β€”Add more RAM or use cloud deployment
❌ Admin panel won't start

Solution:

bash
# Check if port is available
netstat -ano | findstr :7861

# Kill process if needed (Windows)
taskkill /PID <process_id> /F

# Restart admin panel
run_admin.bat

πŸ“Š Performance

Speed Benchmarks

ModeInit Time (First)Load Time (Cached)Recognition Time
Ultra Fast2-5 min< 0.5s0.5-1s
Fast3-8 min< 1s1-2s
Accurate12-20 min< 1s3-5s
HardMode20-30 min< 1s10-20s
Extreme25-35 min< 1s5-15s

Accuracy Comparison

Based on testing with 21-person group photo:

ModeDetection RateFalse PositivesBest Use Case
Ultra Fast~40%LowQuick testing
Fast~50-60%LowDaily operations
Accurate~70-80%Very LowImportant matches
HardMode~80-90%Very LowCritical accuracy
Extreme~90-95%MinimalLarge groups, challenges

Storage Requirements

  • β€”Application: ~50 MB
  • β€”Dependencies: ~2 GB
  • β€”Cache (all modes): ~1.2-1.5 GB
  • β€”Total: ~3.5-4 GB

πŸ—οΈ Architecture

System Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Web Interface (Streamlit)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Face Detection & Recognition            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚RetinaFaceβ”‚  MTCNN   β”‚  OpenCV  β”‚  SSD    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Model Ensemble (DeepFace)              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚Facenet512β”‚ ArcFace β”‚ VGG-Face β”‚ OpenFace β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Cache Management System               β”‚
β”‚         (Persistent Embeddings Storage)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Student Database (JSON + Photos)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Technologies

  • β€”Frontend: Streamlit (Python web framework)
  • β€”Backend: Python 3.8+
  • β€”Face Detection: RetinaFace, MTCNN, OpenCV, SSD
  • β€”Face Recognition: DeepFace (Facenet512, ArcFace, VGG-Face, OpenFace)
  • β€”Deep Learning: TensorFlow, Keras
  • β€”Similarity Search: FAISS (Facebook AI Similarity Search)
  • β€”Image Processing: OpenCV, PIL, Albumentations
  • β€”Caching: Pickle-based persistent storage

πŸ“ Project Structure

FaceMatch Detector/
β”œβ”€β”€ app.py                          # Main application
β”œβ”€β”€ admin_cache.py                  # Admin panel
β”œβ”€β”€ cache_manager.py                # Cache management system
β”œβ”€β”€ prewarm_cache.py               # Cache pre-warming script
β”œβ”€β”€ prepare_data.py                # Data preparation utility
β”œβ”€β”€ update_admin_password.py       # Security utility
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ packages.txt                   # System packages
β”œβ”€β”€ students_data.json             # Student database
β”œβ”€β”€ admin_config.json              # Admin credentials
β”œβ”€β”€ foto rev/                      # Reference photos directory
β”œβ”€β”€ persistent_cache/              # Cached embeddings
β”œβ”€β”€ run_admin.bat                  # Windows admin launcher
β”œβ”€β”€ run_admin.sh                   # Linux/Mac admin launcher
└── docs/                          # Documentation
    β”œβ”€β”€ QUICKSTART.md
    β”œβ”€β”€ ADMIN_ACCESS_GUIDE.md
    β”œβ”€β”€ CACHE_SYSTEM_README.md
    β”œβ”€β”€ DEPLOYMENT_SUMMARY.md
    β”œβ”€β”€ HUGGINGFACE_DEPLOYMENT.md
    └── ...

🀝 Contributing

Contributions are welcome! Here's how you can help:

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

Development Setup

bash
# Clone repository
git clone <your-repo-url>
cd "FaceMatch Detector"

# Install dependencies
pip install -r requirements.txt

# Run in development mode
streamlit run app.py --server.runOnSave true

πŸ” Security

Best Practices

  1. 1.Change default admin credentials immediately:
bash
   python update_admin_password.py
  1. 1.Use environment variables for sensitive data:
bash
   export ADMIN_USERNAME=your_username
   export ADMIN_PASSWORD=your_secure_password
  1. 1.Secure admin panel access:
  2. 2.Use strong passwords
  3. 3.Limit network access
  4. 4.Monitor access logs
  1. 1.Protect student data:
  2. 2.Don't commit students_data.json to public repos
  3. 3.Use .gitignore for sensitive files
  4. 4.Encrypt data at rest if needed

πŸ“„ License

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


πŸ™ Acknowledgments

  • β€”DeepFace - Serengil et al. for the amazing face recognition library
  • β€”Streamlit - For the intuitive web framework
  • β€”TensorFlow - Google Brain team for the deep learning framework
  • β€”FAISS - Facebook AI Research for fast similarity search
  • β€”InsightFace - For state-of-the-art face recognition models
  • β€”RetinaFace - For robust face detection

πŸ“ž Support

Need help? Here are your options:

  1. 1.Documentation: Check the docs/ folder for detailed guides
  2. 2.Issues: Open an issue on GitHub
  3. 3.Discussions: Start a discussion for questions and ideas
  4. 4.Email: Contact the maintainer

πŸ—ΊοΈ Roadmap

Planned Features

  • β€”[ ] Real-time video recognition
  • β€”[ ] Mobile app support
  • β€”[ ] REST API for integration
  • β€”[ ] Batch processing for multiple images
  • β€”[ ] Advanced analytics dashboard
  • β€”[ ] Export to Excel/PDF reports
  • β€”[ ] Multi-language support
  • β€”[ ] Cloud storage integration (S3, Google Cloud Storage)
  • β€”[ ] GPU acceleration for faster processing
  • β€”[ ] Automated attendance system

πŸ“ˆ Changelog

Version 2.1 (Current)

  • β€”βœ… Added Extreme Mode with 90-95% accuracy
  • β€”βœ… Multi-detector support (RetinaFace, MTCNN, OpenCV)
  • β€”βœ… Multi-user concurrent access
  • β€”βœ… Persistent cache system
  • β€”βœ… Admin panel with cache management
  • β€”βœ… Second-pass matching with face enhancement
  • β€”βœ… Cross-model verification
  • β€”βœ… Adaptive thresholding

Version 2.0

  • β€”βœ… HardMode with 4-5 model ensemble
  • β€”βœ… Enhanced UI with modern design
  • β€”βœ… Improved accuracy algorithms
  • β€”βœ… Better error handling

Version 1.0

  • β€”βœ… Basic face recognition
  • β€”βœ… Multi-face detection
  • β€”βœ… Student database integration

πŸ’‘ Tips & Best Practices

For Best Results

  1. 1.Photo Quality Matters:
  2. 2.Use high-resolution reference photos
  3. 3.Ensure good lighting
  4. 4.Front-facing photos work best
  1. 1.Choose the Right Mode:
  2. 2.Daily use β†’ Fast Mode
  3. 3.Important events β†’ Accurate or HardMode
  4. 4.Large groups/challenges β†’ Extreme Mode
  1. 1.Optimize Performance:
  2. 2.Pre-warm cache before deployment
  3. 3.Commit cache to avoid rebuild
  4. 4.Use caching for faster subsequent runs
  1. 1.Threshold Tuning:
  2. 2.Start with default (0.35-0.40)
  3. 3.Lower for more matches (risk false positives)
  4. 4.Raise for stricter matching (risk false negatives)
  1. 1.Database Management:
  2. 2.Keep reference photos updated
  3. 3.Remove duplicates
  4. 4.Use consistent naming

<div align="center">

Built with ❀️ using DeepFace, TensorFlow, and Streamlit

⭐ Star this repository if you find it helpful!

</div>