Features โข Installation โข Usage โข API Documentation โข Model Details
Deepfake Detection Platform is a comprehensive full-stack application that leverages state-of-the-art deep learning to identify manipulated videos in real-time. Built with a hybrid ResNet50 + LSTM architecture, the platform combines spatial feature extraction with temporal sequence modeling to achieve high accuracy in detecting deepfake content.
- ๐ฅ Real-time Video Analysis - Upload and analyze videos instantly
- ๐ง Advanced AI Model - ResNet50 + LSTM architecture with 80%+ accuracy
- ๐จ Modern Web Interface - Beautiful, responsive React frontend with dark mode
- โก RESTful API - FastAPI backend with comprehensive endpoints
- ๐ Privacy-First - Files processed securely and deleted after analysis
- ๐ Detailed Analytics - Confidence scores and visual feedback
- ๐จ Modern UI/UX - Built with Tailwind CSS and Framer Motion animations
- ๐ Dark Mode - Comfortable viewing in any lighting condition
- ๐ค Drag & Drop Upload - Intuitive file upload with progress tracking
- ๐ Visual Results - Interactive confidence meters and analytics charts
- ๐ฑ Responsive Design - Works seamlessly on desktop, tablet, and mobile
- ๐ Help & Documentation - Comprehensive guides and FAQ sections
- ๐ญ Smooth Animations - Polished user experience with Framer Motion
- ๐ฅ Video Processing - Supports multiple formats (MP4, AVI, MKV, MOV, WEBM)
- ๐งฉ Face Detection - MTCNN-based face extraction before analysis
- โก High Performance - Optimized inference pipeline with GPU support
- ๐ Confidence Scoring - Sigmoid-based probability outputs
- ๐ Batch Processing - Analyze multiple videos simultaneously
- ๐ก RESTful Endpoints - Well-documented API with OpenAPI/Swagger docs
- ๐ฅ Health Monitoring - System health and model status endpoints
| Component | Technology | Purpose |
|---|---|---|
| Deep Learning | PyTorch, TorchVision | Model architecture and inference |
| API Framework | FastAPI, Uvicorn | REST API server |
| Video Processing | OpenCV, Pillow | Video frame extraction and preprocessing |
| Face Detection | facenet-pytorch (MTCNN) | Face detection and alignment |
| Language | Python 3.10+ | Backend development |
| Component | Technology | Purpose |
|---|---|---|
| Framework | React 18.2 | UI framework |
| Styling | Tailwind CSS | Utility-first CSS framework |
| Routing | React Router DOM | Client-side routing |
| Animations | Framer Motion | Smooth UI animations |
| Icons | Lucide React | Icon library |
| Charts | Recharts | Data visualization |
| File Upload | React Dropzone | Drag-and-drop file handling |
- Python 3.10 or higher
- Node.js 16+ and npm
- CUDA-capable GPU (optional, for faster inference)
git clone https://github.com/Dipakk7/DeepfakeDetect.git
cd DeepfakeDetectCreate and activate a virtual environment:
# Windows
python -m venv venv
venv\Scripts\activate
# Linux/Mac
python -m venv venv
source venv/bin/activateInstall Python dependencies:
pip install -r requirements.txtInstall Node.js dependencies:
npm installThe pretrained model weights are required for inference. Download them from:
๐ Google Drive Link
Or use command line:
pip install gdown
gdown 1ZSp7lvbaQhoN51nsaO8Oi0WA1cMFYnb6 -O model_epoch_30.pthSet the model path (optional, defaults to model_epoch_30.pth):
# Windows
set MODEL_PATH=model_epoch_30.pth
# Linux/Mac
export MODEL_PATH=model_epoch_30.pthTerminal 1 - Start Backend Server:
python backend.pyโ
Backend API running at http://localhost:8000
Terminal 2 - Start Frontend Development Server:
npm startโ
Frontend app running at http://localhost:3000
๐ก Tip: Make sure both servers are running simultaneously. The frontend is configured to proxy API requests to the backend.
- Navigate to
http://localhost:3000in your browser - Click "Analyze Now" or go to the Upload page
- Drag and drop a video file or click to browse
- Wait for the analysis to complete (typically 3-5 seconds)
- View detailed results with confidence scores and visualizations
curl -X POST "http://localhost:8000/predict" \
-F "file=@path/to/your/video.mp4"Response:
{
"video_name": "video.mp4",
"prediction": "REAL",
"confidence": 0.87,
"is_fake": false,
"frames_analyzed": 12,
"raw_score": 1.95
}curl -X POST "http://localhost:8000/predict/batch" \
-F "files=@video1.mp4" \
-F "files=@video2.mp4"curl http://localhost:8000/health| Method | Endpoint | Description | Response |
|---|---|---|---|
GET |
/ |
Basic health check | Status and device info |
GET |
/health |
Detailed system health | Model status and configuration |
POST |
/predict |
Single video prediction | Prediction results with confidence |
POST |
/predict/batch |
Batch video analysis | Array of prediction results |
GET |
/info |
Model information | Architecture and configuration details |
GET |
/docs |
API documentation | Interactive Swagger UI |
Visit http://localhost:8000/docs for interactive API documentation powered by Swagger UI.
The detection model combines the strengths of convolutional and recurrent neural networks:
Input Video โ Frame Extraction โ Face Detection (MTCNN) โ ResNet50 Feature Extraction
โ LSTM Temporal Modeling โ Classification Head โ Output (Real/Fake + Confidence)
Architecture Details:
- Spatial Feature Extractor: ResNet50 (pretrained on ImageNet)
- Temporal Model: Bidirectional LSTM (256 hidden units)
- Input: 12 frames per video, 224ร224 resolution
- Output: Binary classification (Real/Fake) with confidence score
- Dataset: Deepfake Detection Challenge (DFDC) by Meta
- Training Strategy: Class-imbalance handling (weighted loss + oversampling)
- Optimization: Adam optimizer with learning rate scheduling
- Validation: 5-fold cross-validation
| Metric | Value |
|---|---|
| Accuracy | 80.% |
| Precision | 74.% |
| Recall | 54.% |
| F1-Score | 51.% |
DeepfakeDetect/
โโโ backend.py # FastAPI backend server
โโโ requirements.txt # Python dependencies
โโโ package.json # Node.js dependencies
โโโ .gitignore # Git ignore rules
โ
โโโ src/ # React frontend source
โ โโโ components/ # Reusable UI components
โ โ โโโ Button.js
โ โ โโโ Card.js
โ โ โโโ FileUpload.js
โ โ โโโ VideoPlayer.js
โ โ โโโ ...
โ โโโ pages/ # Page components
โ โ โโโ LandingPage.js
โ โ โโโ UploadPage.js
โ โ โโโ ResultsPage.js
โ โ โโโ AboutPage.js
โ โ โโโ HelpPage.js
โ โโโ context/ # React context providers
โ โ โโโ DarkModeContext.js
โ โโโ App.js # Main app component
โ โโโ index.js # Entry point
โ
โโโ public/ # Static assets
โ โโโ index.html
โ โโโ images/
โ
โโโ Backend/ # Additional backend files
โ โโโ ...
โ
โโโ model_epoch_30.pth # Pretrained model weights (download separately)
| Variable | Description | Default |
|---|---|---|
MODEL_PATH |
Path to model weights file | model_epoch_30.pth |
PREDICTION_THRESHOLD |
Classification threshold (0-1) | 0.5 |
HOST |
Backend server host | 0.0.0.0 |
PORT |
Backend server port | 8000 |
# Windows
set MODEL_PATH=model_epoch_30.pth
set PREDICTION_THRESHOLD=0.5
set PORT=8000
# Linux/Mac
export MODEL_PATH=model_epoch_30.pth
export PREDICTION_THRESHOLD=0.5
export PORT=8000The model was trained on the Deepfake Detection Challenge (DFDC) dataset, released by Meta (Facebook) and partners. This dataset contains:
- Thousands of real and manipulated videos
- Diverse deepfake generation techniques
- Various video qualities and resolutions
- Real-world scenarios and conditions
Dataset Access:
- Kaggle Competition
- Download using Kaggle API:
kaggle competitions download -c deepfake-detection-challenge
# Backend tests (if available)
python -m pytest tests/
# Frontend tests
npm testFrontend:
npm run buildBackend: The FastAPI server can be deployed using:
- Docker
- Gunicorn with Uvicorn workers
- Cloud platforms (AWS, GCP, Azure)
Contributions are welcome! Please feel free to submit a Pull Request. Here's how you can help:
- ๐ Report Bugs - Open an issue describing the bug
- ๐ก Suggest Features - Share your ideas for improvements
- ๐ง Submit Pull Requests - Fix bugs or add new features
- ๐ Improve Documentation - Help make the docs better
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Model weights need to be downloaded separately (due to GitHub file size limits)
- GPU recommended for faster inference (CPU works but slower)
- Large video files may take longer to process
- Real-time video stream analysis
- Image deepfake detection
- Model explainability features
- User authentication and history
- API rate limiting and usage analytics
- Docker containerization
- CI/CD pipeline setup
- Meta (Facebook) for the Deepfake Detection Challenge dataset
- PyTorch team for the excellent deep learning framework
- FastAPI creators for the modern Python web framework
- React team for the powerful UI library
- All open-source contributors whose libraries made this project possible
Built with โค๏ธ using FastAPI, PyTorch, React, and OpenCV to ensure digital media authenticity.