Real-Time AI Face Recognition System developed by Javed (iamjaved026)
Detect โข Recognize โข Register โ all in your browser
Features โข Tech Stack โข Quick Start โข API โข Models โข Credits
|
๐ฏ Real-Time Detection ๐ง AI Recognition ๐ท Live Registration |
๐ Detection Logs ๐จ Premium Dark UI โก One-Command Launch |
| Technology | Purpose |
|---|---|
| Next.js 15 | React framework with App Router, SSR |
| Tailwind CSS 4 | Utility-first CSS framework |
| @vladmandic/face-api | Browser-side face detection (TinyFaceDetector) |
| TypeScript | Type-safe development |
| Technology | Purpose |
|---|---|
| FastAPI | High-performance Python API framework |
| FaceNet-PyTorch | MTCNN detection + InceptionResnetV1 embeddings |
| PyTorch | Deep learning runtime |
| OpenCV | Image processing |
| SQLite | Lightweight embedded database |
- Python 3.9+
- Node.js 18+ and npm
- C++ Build Tools (Windows only): Install "Desktop development with C++" via Visual Studio Installer (required by some native Python packages)
git clone https://github.com/iamjaved026/trueface.git
cd truefacecd backend
# Create virtual environment
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Activate (macOS/Linux)
# source venv/bin/activate
# Install dependencies
pip install -r requirements.txt๐ Note: On first run, FaceNet-PyTorch will automatically download the pretrained model weights (~100MB). This only happens once.
cd frontend
# Install dependencies
npm install
# Build for production
npm run buildFrom the project root directory:
node server.jsThis single command starts both the FastAPI backend and the Next.js frontend!
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TrueFace โ Real-Time Face Recognition โ
โ v1.0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[BACKEND] Starting FastAPI server on port 8000...
[FRONTEND] Starting Next.js on port 3000...
[SERVER] Dashboard: http://localhost:3000
[SERVER] API Docs: http://localhost:8000/docs
Navigate to http://localhost:3000 in your browser and allow camera access.
- Allow camera access when prompted
- Faces are detected in real-time with futuristic bounding boxes
- Detected faces are sent to the backend for recognition
- Known persons show
Name (Role) Confidence%in green/blue - Unknown persons show
Unknownin red
- Click "+ Add Person" in the sidebar
- Enter the person's name and role (Admin/User)
- Capture 3-5 images using the circular capture button
- Click "Register Person"
- The person is instantly recognizable! ๐
- Click "Logs" in the sidebar
- A side panel slides in showing detection history
- Each entry shows name, timestamp, confidence score, and status
Once the backend is running, visit http://localhost:8000/docs for the interactive Swagger UI.
| Method | Endpoint | Description |
|---|---|---|
POST |
/recognize |
Recognize a face from a base64 image |
POST |
/add-person |
Register a new person with face images |
GET |
/persons |
List all registered persons |
DELETE |
/persons/{id} |
Delete a registered person |
GET |
/logs |
Get detection history |
DELETE |
/logs |
Clear all logs |
GET |
/health |
System health check |
curl -X POST http://localhost:8000/recognize \
-H "Content-Type: application/json" \
-d '{"image": "data:image/jpeg;base64,/9j/4AAQ..."}'Response:
{
"name": "Javed Hussain",
"role": "Admin",
"confidence": 0.892,
"status": "known"
}trueface/
โโโ server.js # ๐ Unified launcher (node server.js)
โโโ LICENSE # MIT License
โโโ .gitignore # Git ignore rules
โ
โโโ frontend/ # Next.js 15 App Router
โ โโโ public/models/ # face-api.js model weights
โ โโโ src/app/
โ โโโ components/ # React UI components
โ โ โโโ WebcamFeed.tsx # Live camera + bounding boxes
โ โ โโโ AddPersonModal.tsx # Person registration modal
โ โ โโโ LogsPanel.tsx # Detection history panel
โ โ โโโ Sidebar.tsx # Navigation sidebar
โ โ โโโ StatusIndicator.tsx
โ โโโ hooks/ # Custom React hooks
โ โ โโโ useFaceDetection.ts # Browser face detection
โ โ โโโ useRecognition.ts # Backend API integration
โ โโโ lib/ # Shared utilities
โ โ โโโ api.ts # API client
โ โ โโโ types.ts # TypeScript definitions
โ โโโ globals.css # Design system + theme
โ โโโ layout.tsx # Root layout
โ โโโ page.tsx # Main dashboard page
โ
โโโ backend/ # Python FastAPI
โ โโโ main.py # App entry point
โ โโโ requirements.txt # Python dependencies
โ โโโ routers/ # API endpoint handlers
โ โ โโโ recognize.py # Face recognition endpoint
โ โ โโโ persons.py # Person CRUD endpoints
โ โ โโโ logs.py # Detection log endpoints
โ โโโ services/ # Core business logic
โ โ โโโ face_service.py # FaceNet model wrapper
โ โ โโโ matching.py # Cosine similarity matching
โ โโโ database/ # Data persistence
โ โโโ db.py # SQLite operations
โ โโโ models.py # Pydantic models
โ
| Setting | File | Default | Description |
|---|---|---|---|
| Recognition Threshold | services/matching.py |
0.45 |
Minimum cosine similarity for a match |
| Detection Size | services/face_service.py |
160ร160 |
MTCNN input resolution |
| CORS Origins | main.py |
localhost:3000 |
Allowed frontend origins |
| Setting | File | Default | Description |
|---|---|---|---|
| Frame Skip Rate | hooks/useFaceDetection.ts |
2 |
Process every Nth frame |
| API Base URL | lib/api.ts |
http://localhost:8000 |
Backend API URL |
| Cache TTL | hooks/useRecognition.ts |
1500ms |
Recognition result cache duration |
| Smoothing Factor | hooks/useFaceDetection.ts |
0.35 |
Bounding box EMA smoothing (0-1) |
TrueFace uses the following pre-trained AI models. No training data is included in this repository. Models are downloaded automatically on first run.
| Model | Source | Purpose | License |
|---|---|---|---|
| TinyFaceDetector | @vladmandic/face-api | Real-time face detection in browser | MIT |
| FaceLandmark68Net | @vladmandic/face-api | 68-point facial landmark detection | MIT |
| FaceRecognitionNet | @vladmandic/face-api | Face descriptor extraction | MIT |
@vladmandic/face-apiis a modern ES6/TypeScript rewrite of face-api.js by Vladimir Mandic, licensed under MIT.
| Model | Source | Purpose | License |
|---|---|---|---|
| MTCNN | facenet-pytorch | Multi-task face detection + alignment | MIT |
| InceptionResnetV1 | facenet-pytorch | 512-dim face embedding extraction | MIT |
| Pretrained Weights | VGGFace2 dataset | Face recognition accuracy | CC BY-SA 4.0 |
facenet-pytorchby Tim Esler provides PyTorch implementations of MTCNN and InceptionResnetV1, pretrained on the VGGFace2 dataset. Licensed under MIT.
| Package | Purpose | License |
|---|---|---|
| PyTorch | Deep learning runtime | BSD-3-Clause |
| FastAPI | Python web framework | MIT |
| Next.js | React framework | MIT |
| OpenCV | Image processing | Apache-2.0 |
| Pillow | Python image library | MIT-CMU |
- Multi-face tracking with individual recognition
- GPU-accelerated detection via WebGL
- Face anti-spoofing (liveness detection)
- Export/import person database
- Docker containerization
- Role-based access control
- Real-time alerts & notifications
Contributions are welcome! Please read the Contributing Guidelines before submitting a pull request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License โ see the LICENSE file for details.
You are free to use, modify, and distribute this software for personal and commercial purposes.
|
Full-Stack Developer & AI Enthusiast |
- ๐ Vladimir Mandic โ for the excellent
face-apilibrary - ๐ Tim Esler โ for
facenet-pytorchand pretrained models - ๐ VGGFace2 Team โ for the training dataset
- ๐ Vercel โ for Next.js and the amazing developer experience
- ๐ FastAPI Team โ for the blazing-fast Python framework
โญ If you found TrueFace useful, please consider giving it a star!
TrueFace v1.0 โ Made in India ๐ฎ๐ณ