A real-time Face Authentication System built using Flask, MediaPipe, InsightFace (ArcFace), and MongoDB. SecureFace AI authenticates users using both traditional credentials and biometric facial recognition for enhanced security.
- π€ User Registration
- π Secure Login using Face + Password
- π· Real-Time Webcam Face Capture
- π Face Detection using MediaPipe
- π§ Face Recognition using InsightFace (ArcFace)
- π 512-D Face Embeddings
- π Cosine Similarity & Euclidean Distance Matching
- π Password Hashing (Werkzeug - Scrypt)
- πΎ MongoDB Database Integration
- π Automatic User ID Generation
- β³ Session-based Authentication (2 Days)
- π± Responsive User Interface
- π§ͺ Face Similarity Testing Module
- Project Introduction
- Features Overview
- Login/Register Navigation
- User Details
- Live Face Capture
- Face Embedding Generation
- Secure Password Storage
- User ID Verification
- Email Verification
- Password Verification
- Live Face Verification
- Dashboard Access
- User Profile
- Project Information
- Authentication Status
- Technology Stack
SecureFace AI
β
βββ app
β β
β βββ api
β β βββ detect.py
β β βββ register.py
β β βββ login.py
β β βββ dashboard.py
β β
β βββ core
β β βββ face_detector.py
β β βββ get_embedings.py
β β βββ check_similarity.py
β β βββ anti_spoof.py (Future)
β β
β βββ db
β β βββ mongodb.py
β β βββ user_repo.py
β β
β βββ __init__.py
β
βββ image
βββ static
βββ templates
βββ test
β
βββ .env
βββ requirements.txt
βββ run.py
βββ README.md
- Python
- Flask
- REST API
- HTML5
- CSS3
- JavaScript
- Fetch API
- OpenCV
- MediaPipe
- InsightFace
- ArcFace (buffalo_sc)
- NumPy
- MongoDB Atlas
- Werkzeug Security (Scrypt)
- Flask Sessions
- Environment Variables
User
β
βΌ
Capture Face
β
βΌ
MediaPipe Face Detection
β
βΌ
Face Crop
β
βΌ
InsightFace Embedding
β
βΌ
Generate User ID
β
βΌ
Hash Password
β
βΌ
Store User Data
β
βΌ
MongoDB
User
β
βΌ
Capture Live Face
β
βΌ
MediaPipe Detection
β
βΌ
Generate Face Embedding
β
βΌ
Verify Email
β
βΌ
Verify User ID
β
βΌ
Verify Password
β
βΌ
Compare Face Embeddings
β
βΌ
Authentication Success
β
βΌ
Dashboard
Input Image
β
βΌ
MediaPipe Face Detection
β
βΌ
Face Crop
β
βΌ
InsightFace ArcFace
β
βΌ
512-D Face Embedding
β
βΌ
Cosine Similarity
β
βΌ
Euclidean Distance
β
βΌ
Authentication Result
The system compares two facial embeddings using:
- Cosine Similarity
- Euclidean Distance
Authentication is successful only if both similarity metrics satisfy predefined thresholds.
- Password Hashing using Scrypt
- Session Authentication
- Environment Variables
- Face Authentication
- User ID Validation
- Email Validation
Each registered user contains:
| Field | Description |
|---|---|
| User ID | Unique Generated ID |
| Name | User Name |
| User Email | |
| Password | Hashed Password |
| Face Embedding | 512-D Vector |
| Created At | Registration Date |
The project includes testing modules for:
- Detect face successfully
- Face crop validation
- Generate 512-dimensional embeddings
Tests include:
- Same Person Matching
- Different Person Matching
Outputs:
- Cosine Similarity
- Euclidean Distance
- Match Decision
Results are stored in:
similarity_results.csv
git clone https://github.com/yourusername/SecureFace-AI.git
cd SecureFace-AIpython -m venv faceenvActivate
Windows
faceenv\Scripts\activateLinux/Mac
source faceenv/bin/activatepip install -r requirements.txtCreate a .env file
MONGO_URI=your_mongodb_connection_string
SECRET_KEY=your_secret_keypython run.pyApplication will run at
http://127.0.0.1:10000
- Anti-Spoof Detection (MiniFASNet)
- JWT Authentication
- PostgreSQL Support
- Qdrant Vector Database
- Docker Deployment
- Redis Session Storage
- Admin Dashboard
- Authentication Logs
- Email Verification
- Password Reset
- Face Registration History
- Multi-Factor Authentication
- Real-Time Face Authentication
- Secure User Registration
- Face + Password Login
- InsightFace ArcFace Recognition
- MediaPipe Face Detection
- MongoDB Integration
- Flask Modular Architecture
- Session-Based Authentication
- Face Similarity Evaluation
- Production-Oriented Design
Kumar Shanu
B.Tech Computer Science Engineering (AI & ML)
Machine Learning & Full Stack Developer
GitHub: https://github.com/kumar-shanu-1881/
LinkedIn: https://www.linkedin.com/in/kumar-shanu-9219a5293/