🌟🔥 Ultimate Face Recognition System 🔥🌟
High-performance. Real‑time. Beautifully engineered.
Designed for creators who want power and style.
A complete face recognition toolkit built with InsightFace and OpenCV, including three modules:
- Basic face recognition from stored photos
- Semi‑Advanced face recognition with manual/automatic photo addition
- Advanced long‑distance, smooth, CPU‑optimized real‑time recognition
This README summarizes all three scripts and how to use them.
📂 File Overview
🗂️ Modules At a Glance
✨ Three scripts, three power levels.
1. advance.py – Long‑Distance + Smooth Real‑Time Recognition
Features:
- CPU‑optimized for stability
- Long‑range face detection
- Ultra‑smooth 60 FPS camera processing
- Dynamic text scaling
- Auto‑save embeddings
Features:
- Automatically converts dropped photos to embeddings
- Supports webcam, IP camera, and MP4
- Live saving with keypress
- Auto face indexing
3. basic.py – Photo Imports + Simple Recognition
Features:
- Loads photos from a folder
- Extracts embeddings automatically
- Real‑time recognition from webcam
🚀 Installation
🔧 Quick Setup
Install dependencies:
pip install insightface opencv-python numpy
If using GPU (optional):
pip install onnxruntime-gpu
Create needed folders:
mkdir saved_faces
mkdir photos
▶️ Running the Scripts
🎬 Choose Your Mode
Basic Mode
- Add photos inside
photos/
- The script auto‑detects and saves faces
Semi‑Advanced Mode
Menu options:
1 → Webcam
2 → IP Camera
3 → MP4 File
Drop images directly into saved_faces/ to auto‑add people.
Advanced Mode
Controls:
S → Save current face
Q → Quit
This mode is ideal for:
- Long‑distance recognition
- Crowd scanning
- Fast real‑time processing
🧠 How Recognition Works
🧩 Behind the Magic
- InsightFace detects the face
- A 512‑D embedding vector is generated
- The embedding is compared with saved
.npz files
- If the distance < threshold (0.68–0.75), the identity is shown
📸 Saving New Faces
Method A (Camera)
Press S or N depending on script.
Method B (Drop Photos)
Just place .jpg/.png images in:
The system converts them on next run.
Method C (Photos Folder)
Drop photos into:
The basic.py script will process them.
🎨 UI Features
💎 What You See
- Dynamic text scaling based on face size
- FPS counter
- Clear color‑coded labels
- Auto‑reloading camera if disconnected
⚙️ Recommended Threshold Values
🎯 Tuning for Accuracy
- 0.68 → Accurate long‑range recognition
- 0.75 → Flexible real‑world lighting
📌 Folder Structure
🗃️ Project Layout
project/
│── advance.py
│── semiadvance.py
│── basic.py
│── saved_faces/
│ └── person_name.npz
│── photos/
│ └── image.jpg
│── README.md ← this file
🙌 Credits
❤️ Contributors & Tech
- InsightFace for face detection & embeddings
- OpenCV for real‑time video processing