ShanmukhaDesu/identix-facial-landmarks
IDENTIX - Facial Landmark Detection & Deepfake Analysis
๐ Production-Ready Deployment Package
What is IDENTIX?
IDENTIX is an advanced AI-powered web application that performs:
- Facial Landmark Detection - 11-class segmentation using BiSeNet architecture
- Deepfake Detection - Multi-factor analysis for video authenticity
- User Authentication - Secure MongoDB-backed user management
- Real-time Processing - Image and video analysis with instant results
๐ฏ Key Features
- โ High-accuracy facial landmark segmentation (trained BiSeNet model)
- โ Multi-person detection and tracking
- โ Deepfake detection with confidence scoring
- โ Secure user registration and authentication
- โ Beautiful responsive UI with light/dark themes
- โ MongoDB Atlas integration for user data
- โ Production-ready Flask application
- โ Optimized for Render deployment
๐ Quick Start
For deployment instructions, see [DEPLOYMENT.md](DEPLOYMENT.md)
Local Testing
- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .env
# Edit .env with your MongoDB connection string- Run the application:
python app.py- Open browser:
http://localhost:5000๐๏ธ Architecture
Tech Stack
- Backend: Flask (Python web framework)
- ML Framework: PyTorch (BiSeNet model)
- Database: MongoDB Atlas (user authentication)
- Image Processing: OpenCV, PIL
- Server: Gunicorn (production)
Model Details
- Architecture: BiSeNet (Bilateral Segmentation Network)
- Backbone: ResNet-50
- Classes: 11 facial landmarks
- Skin
- Left Eyebrow
- Right Eyebrow
- Left Eye
- Right Eye
- Nose
- Upper Lip
- Inner Mouth
- Lower Lip
- Hair
- Background
Security Features
- SHA256 password hashing (upgradable to bcrypt)
- Email validation with regex
- Input sanitization (XSS prevention)
- Unique email constraint in MongoDB
- Session-based authentication
- Environment variable configuration
๐ Project Structure
identix-deploy/
โโโ app.py # Main Flask application
โโโ mongodb_utils.py # Database connection utilities
โโโ deepfake_detector.py # Deepfake analysis module
โโโ best_model.pth # Trained BiSeNet model (~95MB)
โโโ requirements.txt # Python dependencies
โโโ render.yaml # Render deployment config
โโโ .env.example # Environment template
โโโ .gitignore # Git ignore rules
โโโ DEPLOYMENT.md # Detailed deployment guide
โโโ README.md # This file
โโโ templates/ # HTML templates
โโโ index.html # Landing page
โโโ image_analysis.html # Image upload page
โโโ video_analysis.html # Video upload page
โโโ deepfake_detection.html
โโโ ... (other pages)๐ Environment Variables
Required variables (see .env.example):
๐งช API Endpoints
Authentication
POST /register- Create new user accountPOST /login- Authenticate userPOST /logout- End user sessionGET /check-auth- Check authentication status
Analysis
POST /predict- Analyze image for facial landmarksPOST /predict_video- Process video framesPOST /detect_deepfake- Analyze video for deepfake
Other
GET /health- Health check endpointGET /- Landing pageGET /facial-landmarks- Image analysis UIGET /video-analysis- Video analysis UI
๐ก๏ธ Security Considerations
Current Implementation
โ Password hashing (SHA256) โ Input validation โ XSS prevention โ Secure session management โ Environment-based secrets
Recommended Improvements
โ ๏ธ Upgrade to bcrypt/argon2 password hashing โ ๏ธ Add rate limiting (Flask-Limiter) โ ๏ธ Add CSRF protection (Flask-WTF) โ ๏ธ Implement password reset functionality โ ๏ธ Add email verification
See DEPLOYMENT.md for implementation details.
๐ Performance
Model Performance
- Input Size: 256ร256 pixels
- Output: 11-class segmentation mask
- Inference Time: ~100-300ms per image (CPU)
Resource Requirements
- RAM: ~1GB minimum
- Storage: ~500MB (model + dependencies)
- CPU: Single core sufficient for free tier
Render Free Tier
- 750 hours/month
- Sleeps after 15 minutes inactivity
- First request after sleep: ~30 seconds
๐ Known Issues & Limitations
- Free Tier Sleep: App sleeps on inactivity (Render limitation)
- Model Size: Large model file (~95MB) affects cold start
- SHA256 Hashing: Basic password security (upgrade recommended)
- No Rate Limiting: Vulnerable to brute force (mitigation available)
- CPU Inference: Slower than GPU (acceptable for free tier)
๐ Updates & Maintenance
Updating Code
git add .
git commit -m "Update description"
git push origin main
# Render auto-deploysMonitoring
- Check Render dashboard for logs
- Monitor
/healthendpoint - Review MongoDB Atlas metrics
๐ Documentation
- Deployment Guide: DEPLOYMENT.md
- Render Setup Summary:
- Build:
pip install --upgrade pip && pip install -r requirements.txt - Start:
gunicorn app:app -b 0.0.0.0:$PORT -w 2 - Health:
/health - Env vars:
MONGODB_URI,SECRET_KEY,FLASK_ENV=production - Plan:
standardrecommended for PyTorch model - Code Documentation: Inline docstrings in Python files
- API Reference: See "API Endpoints" section above
๐ค Contributing
This is a capstone project. For modifications:
- Test locally first
- Update requirements.txt if adding dependencies
- Document changes in commit messages
- Check security implications
๐ License
Educational/Academic Project - Capstone 4-1
๐ฅ Authors
Capstone Team - Facial Landmark Detection Project
๐ Acknowledgments
- BiSeNet architecture inspiration
- MongoDB Atlas free tier
- Render free hosting
- PyTorch framework
- Flask community
Ready to deploy? Follow the comprehensive guide in DEPLOYMENT.md
Questions? Check troubleshooting section in deployment guide.
Need help? Review the security and performance sections above.
