A Production-Grade Forensic Platform for Digital Media Verification
Varun β AI/ML Engineer specializing in computer vision, deep learning, and cybersecurity research.
TrueVision is a state-of-the-art deepfake detection forensic platform engineered for high-precision media verification. Built on a cutting-edge Tri-Model Ensemble Neural Network architecture, it combines specialized deep learning models with robust online active learning to detect sophisticated media manipulation attacks.
The platform seamlessly integrates:
- Local FastAPI Proxy β User-facing gateway with email reporting and dark-themed dashboards
- AWS EC2 Inference Engine β Distributed deep learning processing with real-time face detection and multi-model ensemble classification
- Active Learning Framework β Adaptive fine-tuning that improves accuracy from user-submitted corrections
Key Capabilities:
- β Detects deepfakes, face-swaps, GAN-generated faces, and diffusion-based synthetic media
- β Multi-format support: JPEG, PNG, MP4, AVI, MOV video files
- β Real-time inference with calibrated confidence scoring (80%+ certainty)
- β Forensic reporting with detailed ensemble breakdown analysis
- β Online learning safeguards against adversarial poisoning attacks
TrueVision operates across four interconnected stages, from raw media ingestion through final forensic assessment:
flowchart TB
%% Styling
classDef stage fill:#111,stroke:#7c3aed,stroke-width:2px,color:#fff;
classDef component fill:#1d1b26,stroke:#a78bfa,stroke-width:1px,color:#ddd;
classDef dataset fill:#062016,stroke:#10b981,stroke-width:1px,color:#10b981;
classDef aws fill:#2a1a08,stroke:#ff9900,stroke-width:1px,color:#ff9900;
subgraph STAGE1 ["Stage 1: Input Ingestion & Data Flow"]
A["User Media File<br/>(.jpg, .png, .mp4, .avi, .mov)"] --> B["Local API Proxy<br/>(FastAPI: Port 8000)"]
B -->|POST /process/| C["AWS EC2 Inference Server<br/>(Port 8000)"]
end
class STAGE1,A,B,C stage;
subgraph STAGE2 ["Stage 2: Pre-Processing & Feature Engineering"]
C --> D["Intelligent Frame Extraction<br/>(Skip: Every 15th, Max 30 Frames)"]
D --> E["Facial Detection Pipeline<br/>(Haar Cascade: Max 10 Faces)"]
end
class STAGE2,D,E stage;
subgraph STAGE3 ["Stage 3: Tri-Model Ensemble Classification"]
E -->|Raw Pixels| M1["Model 1: EfficientNet-B0<br/>CNN Architecture<br/>Weight: 33%"]
E -->|Laplacian Edges| M2["Model 2: ResNet50 + ViT<br/>Composite Vision<br/>Weight: 33%"]
E -->|Texture Analysis| M3["Model 3: ETCNN<br/>Texture + Semantic Fusion<br/>Weight: 34%"]
M1 --> F["Ensemble Calibration<br/>(Symmetric Square-Root)"]
M2 --> F
M3 --> F
end
class STAGE3,M1,M2,M3,F stage;
subgraph STAGE4 ["Stage 4: Forensic Output & Active Learning"]
F --> G["Final Classification<br/>(Real or Fake + Confidence %)"]
G --> H["Auto-Archive<br/>(user_dataset/auto/)"]
G -->|User Provides Feedback| I["POST /feedback/"]
I -->|Background Fine-Tune| J["ETCNN Dynamic Update<br/>(3 Epochs, Safeguards Active)"]
J -->|Validates Variance| M3
I -->|Accumulates 100+ Confirmed| K["Full Model Retraining"]
end
class STAGE4,G,H,I,J,K stage;
%% External Resources
subgraph DB ["Training Datasets"]
DATA1[("Celeb-DF v2")]
DATA2[("DFDC")]
DATA3[("FaceForensics++")]
end
class DB,DATA1,DATA2,DATA3 dataset;
M1 -.-> DATA3
M2 -.-> DATA2
M3 -.-> DATA1
subgraph AWS_SERV ["AWS Deployment"]
EC2["EC2 Instance<br/>(3.238.89.41)"]
SES["SES / SMTP Gateway"]
end
class AWS_SERV,EC2,SES aws;
C --- EC2
B -.->|Email Reports| SES
TrueVision's strength lies in its specialized tri-model architecture, where each model captures distinct forensic artifacts:
Detects raw-pixel level anomalies and color blending artifacts typical of face-swaps.
- Input: Raw cropped face pixels (upscaled to 128Γ128 if needed)
- Processing: Standard ImageNet normalization β EfficientNet backbone
- Training Data: FaceForensics++, DFDC, Celeb-DF v2 (3 independent checkpoints)
- Specializes In: DeepFaceLab face-swaps, GAN blending artifacts, compression artifacts
Captures structural inconsistencies via edge analysis and attention mechanisms.
- Input: Laplacian edge-enhanced grayscale face
- Architecture Pipeline:
- ResNet50 backbone β 1024-channel feature maps
- 1Γ1 convolution β 512-dim embeddings
- Transformer Encoder (4 layers, 8 heads) with positional encoding
- MLP classifier head on [CLS] token
- Specializes In: Neural texture replacement, deepfake boundary detection, fine facial edits
Fuses high-frequency texture analysis with global semantic context via attention.
- Input: Residual texture map (original β heavily blurred, Ο=21)
- Dual-Branch Design:
- Texture Branch: Lightweight CNN (3D convolutions) β 384-dim vector
- Semantic Branch: EfficientNet-B0 β 384-dim vector
- Fusion: Sigmoid Channel Attention weighting β classifier head
- Special Role: Dynamic active learner β fine-tuned during online feedback loop
- Specializes In: StyleGAN, Midjourney, Stable Diffusion synthetic faces
Raw ensemble scores often cluster near decision boundaries (0.5 = uncertain). TrueVision applies Symmetric Square-Root Calibration to push predictions toward actionable confidence levels while maintaining fairness:
Effect: A marginal raw prediction (0.65) β calibrated to 77.4% confidence, ensuring clear, decisive verdicts.
TrueVision learns from user feedback in real-time while protecting against adversarial "poisoning" attacks:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Upload & Inference Flow β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
[Inference Output]
β
[ Auto-saved to user_dataset/auto/ ]
β
[User Provides Feedback]
β
[ Face Copied to user_dataset/confirmed/ ]
β
[ ETCNN Fine-Tuning: 3 Epochs ]
lr=1e-5, weight_decay=1e-4
β
[ Variance Safety Check ]
β β
ΟΒ² < 0.0001? ΟΒ² β₯ 0.0001?
β β
[ REJECT ] [ COMMIT WEIGHTS ]
[ RESTORE ] [ Update Model ]
[ BACKUP ]
- User submits feedback (
REALorFAKE) viaPOST /feedback/ - Server copies cropped faces to
user_dataset/confirmed/{real|fake}/ - Background job unfreezes ETCNN Classifier + Attention layers only
- 3-epoch training with Adam optimizer
After fine-tuning, the server validates model integrity:
- Variance Check: Generate 5 random Gaussian inputs, compute ΟΒ²
- Collapse Detection: If ΟΒ² < 0.0001 β model has lost discriminative power
- Bias Detection: If ΞΌ > 0.95 or ΞΌ < 0.05 β extreme class bias detected
- Action: Reject new weights, restore
etcnn_combined.pth.backup, alert administrator
This ensures 100% inference reliability even under adversarial feedback.
- Server: AWS EC2 Instance
3.238.89.41 - Inference Port:
8000(FastAPI Core Engine) - Admin Port:
9000(Directory listing for frame previews & datasets) - Model Storage:
/home/ubuntu/truevision/models/
- Port:
8000(User-facing FastAPI) - Features: Email reporting, dashboard serving, payload routing to EC2
TrueVision/
βββ README.md # This documentation
βββ .gitignore
β
βββ Dataset/ # Local test dataset
β βββ fake/ # Fake face samples
β βββ real/ # Real face samples
β
βββ backend/ # Local Proxy Server
β βββ app.py # FastAPI proxy & email engine
β βββ test_api.py # API endpoint tests
β βββ test_email.py # Email delivery tests
β βββ .env # Secrets (gitignored)
β βββ routes/ # Modular route handlers
β βββ services/ # Business logic
β βββ utils/ # Helpers & logging
β
βββ ec2_server/ # AWS EC2 Deep Learning Server
β βββ app.py # Core inference engine
β βββ inference.py # PyTorch model classes
β βββ inspect_checkpoints.py # Checkpoint diagnostics
β βββ deploy.sh # EC2 deployment automation
β βββ services/ # Preprocessing & face detection
β βββ utils/ # Model loaders
β
βββ frontend/ # Vanilla HTML/CSS/JS Dashboard
β βββ login.html # Authentication gateway
β βββ app.html # Main reporting UI
β βββ app.js # Interactive graphs & analysis
β βββ style.css # Dark-glass glassmorphism theme
β
βββ truevision-app/ # Premium React + Vite + Tailwind
βββ src/ # React components
βββ package.json
| Method | Endpoint | Payload | Description |
|---|---|---|---|
| GET | / |
β | System status & gateway availability |
| POST | /process/ |
file: MultipartFile |
Upload media β Extract frames β Run ensemble |
| POST | /feedback/ |
{"label": "FAKE"|"REAL"} |
Submit user verification β Trigger fine-tuning |
| GET | /model/status/ |
β | Model metadata, dataset paths, limits |
| Method | Endpoint | Payload | Description |
|---|---|---|---|
| POST | /send-welcome-email/ |
{"name": "Varun", "email": "user@example.com", "is_new_user": true} |
Welcome email |
| POST | /send-report-email/ |
{"name": "Varun", "email": "user@...", "file_name": "scan.mp4", "prediction": "FAKE", "confidence": 98.2, "explanation": "..."} |
Forensic report email |
| POST | /send-audit-report/ |
{"name": "Varun", "email": "user@...", "total_real": 12, "total_fake": 5, "history": [...]} |
Activity audit email |
| Method | Endpoint | Description |
|---|---|---|
| GET | /admin/retrain-status/ |
Check confirmed face count; ready: true when β₯ 100 |
| GET | /admin/feedback-log/ |
View feedback history, losses, variance metrics |
TrueVision's tri-model ensemble is pre-trained on three industry-leading forensics benchmarks:
-
Celeb-DF v2 (Kaggle)
- 5,639 high-quality deepfake and real videos
- Gold standard for face-swap detection
- Trains Model 3 (ETCNN)
-
DFDC (Deepfake Detection Challenge) (Meta/Kaggle)
- Extreme lighting, ethnic diversity, variable compression
- Real-world challenge dataset
- Trains Model 2 (ResNet50 + ViT)
-
FaceForensics++ (TUM Munich)
- 4 manipulation methods (Face2Face, FaceSwap, Deepfakes, NeuralTextures)
- Multiple compression profiles (Raw, Light, Heavy)
- Trains Model 1 (EfficientNet-B0)
- OS: Windows, macOS, or Linux
- Python: 3.10+
- PyTorch: CUDA-enabled or CPU wheel
- AWS Credentials (optional): SES keys for email features
# 1. Navigate to backend
cd backend
# 2. Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install fastapi uvicorn requests pydantic python-dotenv
# 4. Configure environment
cp .env.example .env
# Edit .env with your AWS SES & email credentials
# 5. Launch proxy server
python app.pyServer runs on http://localhost:8000
# Navigate to frontend
cd frontend
# Serve static files (lightweight HTTP server)
python -m http.server 5500Open http://localhost:5500 in your browser.
TrueVision is designed exclusively for:
- β Digital forensics & media verification
- β Academic research on deepfake detection
- β Cognitive security defense
- β Investigative journalism & fact-checking
Use Policy: This tool is not intended for creating, distributing, or weaponizing deepfake content. Misuse is subject to legal liability under relevant jurisdictions' digital fraud and impersonation laws.
[Add your chosen license here]
Contributions, bug reports, and feature requests are welcome! Please open an issue or pull request.
Author: Varun
Project: TrueVision β Enterprise Deepfake Detection
Email: [varunvadlakonda4@gmail.com]
GitHub: @VisionStack-404
Last Updated: 2026-05-26