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.
✨ Three scripts, three power levels.
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
Features:
- Loads photos from a folder
- Extracts embeddings automatically
- Real‑time recognition from webcam
Install dependencies:
pip install insightface opencv-python numpyIf using GPU (optional):
pip install onnxruntime-gpuCreate needed folders:
mkdir saved_faces
mkdir photospython basic.py- Add photos inside
photos/ - The script auto‑detects and saves faces
python semiadvance.pyMenu options:
1→ Webcam2→ IP Camera3→ MP4 File
Drop images directly into saved_faces/ to auto‑add people.
python advance.pyControls:
S→ Save current faceQ→ Quit
This mode is ideal for:
- Long‑distance recognition
- Crowd scanning
- Fast real‑time processing
- InsightFace detects the face
- A 512‑D embedding vector is generated
- The embedding is compared with saved
.npzfiles - If the distance < threshold (0.68–0.75), the identity is shown
Press S or N depending on script.
Just place .jpg/.png images in:
saved_faces/
The system converts them on next run.
Drop photos into:
photos/
The basic.py script will process them.
- Dynamic text scaling based on face size
- FPS counter
- Clear color‑coded labels
- Auto‑reloading camera if disconnected
- 0.68 → Accurate long‑range recognition
- 0.75 → Flexible real‑world lighting
project/
│── advance.py
│── semiadvance.py
│── basic.py
│── saved_faces/
│ └── person_name.npz
│── photos/
│ └── image.jpg
│── README.md ← this file
- InsightFace for face detection & embeddings
- OpenCV for real‑time video processing
Need improvements, optimizations, or a GUI version? Reach out using the contact details below.
- Email: kadamamit462@gmail.com
- Instagram: @piyush_kadam96k