System Architecture & Engineering Design
The Deepfake Detection system is engineered with a decoupled microservice architecture, separating the heavy GPU/CPU model inference workloads from the web API layer using asynchronous queues.
Frontend Layer (React + TypeScript)
Built with React 18, TypeScript, and Material-UI. Features real-time frame progress tracking, interactive confidence reports, drag-and-drop file upload, and state management powered by React Query and Axios.
Inference Engine (PyTorch + Celery + Redis)
FastAPI web endpoints delegate heavy video processing jobs to background Celery workers backed by Redis. PyTorch ensemble models analyze facial features, boundary artifacts, and temporal consistency.
[Client Browser (React 18 + TS)] ──(Multipart POST Upload)──► [Nginx Reverse Proxy]
│
▼
[FastAPI REST Server]
│
(Dispatch Job ID to Task Queue)
▼
[Redis Broker & DB]
│
▼
[Celery Worker Nodes]
│
┌─────────────────────────────────────────┴─────────────────────────────────────────┐
▼ ▼
[OpenCV Video Frame Extractor] [PyTorch Ensemble Inference]
• Spatial Artifact Analysis • ResNet-50 Facial Feature Weights
• Temporal Consistency Check • Softmax Forgery Confidence Score
│ │
└─────────────────────────────────────────┬─────────────────────────────────────────┘
▼
[Diagnostic JSON Report]
Key Technical Features
- Image & Video Forgery Analysis: Multi-modal detection supporting both static image inspection and full video frame-by-frame spatial artifact evaluation.
- Ensemble Deep Learning Models: Deep feature extraction combining ResNet-50 convolutional neural networks trained on 100k+ real and synthetic image samples.
- Asynchronous Task Queue: Non-blocking API requests utilizing Celery and Redis to handle large video uploads without timing out HTTP client connections.
- Automatic File Hygiene: Secure server-side storage handling with scheduled automatic file cleanup after report generation.
- Containerized Deployment: Fully Dockerized setup via `docker-compose` orchestrating Frontend, Backend API, Redis, and Celery containers.
Project Directory Structure
├── frontend/ # React TypeScript frontend
│ ├── src/
│ │ ├── components/ # React UI components & scanner
│ │ ├── services/ # Axios API client services
│ │ └── types/ # TypeScript interface definitions
├── backend/ # FastAPI Python backend
│ ├── app/
│ │ ├── api/ # REST API router endpoints
│ │ ├── services/ # PyTorch & OpenCV inference services
│ │ ├── models/ # Data schemas & evaluation metrics
│ │ └── core/ # Redis & Celery app configurations
│ └── tests/ # Pytest backend test suite
└── docker-compose.yml # Multi-container orchestration