GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - divyaa-s/multi-signal-deepfake-detection: Multi-modal deepfake detection platform combining CNN ensembles, BiLSTM temporal analysis, and forensic signal intelligence for advanced AI-generated media detection.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
backend
backend
 
 
frontend
frontend
 
 
scratch
scratch
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
dct_features.py
dct_features.py
 
 
deepfake_detection.py
deepfake_detection.py
 
 
hybrid_vid_improved.py
hybrid_vid_improved.py
 
 
quality_forensic.py
quality_forensic.py
 
 
requirements.txt
requirements.txt
 
 
run_all.ps1
run_all.ps1
 
 
temporal_analysis.py
temporal_analysis.py
 
 
visualizer_utils.py
visualizer_utils.py
 
 

Repository files navigation

πŸ›‘οΈ DeepFocus β€” Multi-Modal Deepfake Detection System

DeepFocus is an end-to-end deepfake detection platform that combines a 4-model CNN ensemble, BiLSTM temporal analysis, frequency-domain forensics, and a meta-learner fusion layer to classify images and videos as real or AI-generated. It ships with a clinical-grade Next.js forensic dashboard and a FastAPI backend for real-time analysis.

Built as a Major Project for academic research in AI-powered media forensics.


πŸ“‹ Table of Contents

  • Architecture Overview
  • Key Features
  • Tech Stack
  • Project Structure
  • Installation
  • Usage
  • Detection Pipeline
    • Image Analysis
    • Video Analysis
  • Models
  • Frontend Dashboard
  • API Endpoints
  • Screenshots
  • Acknowledgements

πŸ— Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Next.js Frontend Dashboard                   β”‚
β”‚         Upload β†’ Analyze β†’ Forensic Report + PDF Export          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      FastAPI Backend (main.py)                   β”‚
β”‚                 /analyze/image    /analyze/video                 β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  IMAGE PIPELINE     β”‚              β”‚  VIDEO PIPELINE            β”‚
β”‚  deepfake_detection β”‚              β”‚  hybrid_vid_improved.py    β”‚
β”‚  .py                β”‚              β”‚                            β”‚
β”‚                     β”‚              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚              β”‚  β”‚ Temporal Analyzer  β”‚    β”‚
β”‚  β”‚ 4-CNN Ensembleβ”‚  β”‚              β”‚  β”‚ (Blink, Flow,      β”‚    β”‚
β”‚  β”‚ EfficientNet  β”‚  β”‚              β”‚  β”‚  Landmark Jitter)  β”‚    β”‚
β”‚  β”‚ Xception      β”‚  β”‚              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”‚ ViT-Small     β”‚  β”‚              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ ConvNeXt      β”‚  β”‚              β”‚  β”‚ BiLSTM Temporal    β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚              β”‚  β”‚ (Optical Flow RNN) β”‚    β”‚
β”‚          β”‚          β”‚              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”  β”‚              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Watermark     β”‚  β”‚              β”‚  β”‚ Quality Forensics  β”‚    β”‚
β”‚  β”‚ Detection     β”‚  β”‚              β”‚  β”‚ (DCT, Color, Edge) β”‚    β”‚
β”‚  β”‚ (DCT + SVM)   β”‚  β”‚              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚          β”‚          β”‚              β”‚  β”‚ 4-CNN Ensemble     β”‚    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”  β”‚              β”‚  β”‚ (per-keyframe)     β”‚    β”‚
β”‚  β”‚ Meta-Learner  β”‚  β”‚              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”‚ (Stacking     β”‚  β”‚              β”‚           β”‚               β”‚
β”‚  β”‚  Ensemble)    β”‚  β”‚              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚              β”‚  β”‚ Meta-Learner       β”‚    β”‚
β”‚                     β”‚              β”‚  β”‚ (LogReg Fusion)    β”‚    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
                                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Key Features

Feature Description
4-Model CNN Ensemble EfficientNet-B3, Xception, ViT-Small, ConvNeXt-Small β€” each fine-tuned on deepfake datasets
BiLSTM Temporal Branch Optical-flow-based Bidirectional LSTM that detects unnatural motion in videos
Temporal Consistency Analyzer Blink detection, optical flow analysis, and facial landmark stability tracking
Quality Forensics Sharpness mismatch, frequency analysis, edge anomaly, compression artifact, DCT anomaly, and color inconsistency detection
Watermark / Frequency Detection DCT mid-frequency feature extraction + SVM classifier for AI watermark artifacts
Meta-Learner Fusion Stacking ensemble (Logistic Regression / XGBoost) that fuses all signals into a final prediction
GradCAM Visualization Spatial attention heatmaps showing which image regions triggered the detection
Forensic Dashboard Premium Next.js UI with radar plots, bar charts, signal breakdowns, and PDF report export
Analysis History LocalStorage-backed forensic log with export to JSON
Single-Pass Frame Extraction Optimized video decoding β€” reads the video exactly once for both CNN and BiLSTM branches

πŸ›  Tech Stack

Backend

Technology Purpose
Python 3.10+ Core language
PyTorch 2.x Deep learning framework
timm Pre-trained model zoo (EfficientNet, Xception, ViT, ConvNeXt)
FastAPI REST API server
OpenCV Video processing, optical flow, face detection (Haar Cascade)
facenet-pytorch MTCNN face detection
pytorch-grad-cam GradCAM visualization
scikit-learn Meta-learner training and inference
XGBoost Ensemble boosting for meta-learner
joblib Model serialization
Matplotlib Radar plots and bar chart generation

Frontend

Technology Purpose
Next.js 16 React framework
TypeScript Type safety
Tailwind CSS 4 Styling
Framer Motion Animations and transitions
Lucide React Icon library
jsPDF + modern-screenshot PDF report export

πŸ“ Project Structure

deepfocus/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                    # FastAPI server β€” /analyze/image & /analyze/video
β”‚   β”œβ”€β”€ static/                    # Generated visualizations (GradCAM, radar, bar charts)
β”‚   └── uploads/                   # Temporary uploaded files
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/app/page.tsx           # Main forensic dashboard (single-page app)
β”‚   β”œβ”€β”€ src/lib/api.ts             # API client for backend communication
β”‚   β”œβ”€β”€ package.json               # Node.js dependencies
β”‚   └── ...                        # Next.js config files
β”‚
β”œβ”€β”€ final/                         # Pre-trained model weights (not tracked in Git)
β”‚   β”œβ”€β”€ convnext_finetuned_v5.pth
β”‚   β”œβ”€β”€ efficientnet_b3_finetuned_v5.pth
β”‚   β”œβ”€β”€ xception_finetuned_v5.pth
β”‚   β”œβ”€β”€ vit_finetuned_v5.pth
β”‚   β”œβ”€β”€ meta_learner_fusion.pkl
β”‚   β”œβ”€β”€ new_watermark_classifier.pkl
β”‚   β”œβ”€β”€ new_feature_scaler.pkl
β”‚   └── ...
β”‚
β”œβ”€β”€ deepfake_detection.py          # Image analysis pipeline (4-CNN + Watermark + Meta-Learner)
β”œβ”€β”€ hybrid_vid_improved.py         # Video analysis pipeline (CNN + BiLSTM + Temporal + Quality)
β”œβ”€β”€ temporal_analysis.py           # Temporal consistency analyzer (Blink, Flow, Landmark)
β”œβ”€β”€ quality_forensic.py            # Quality forensics (Sharpness, Frequency, DCT, Color)
β”œβ”€β”€ dct_features.py                # DCT mid-frequency feature extraction
β”œβ”€β”€ visualizer_utils.py            # GradCAM, radar plot, and bar chart generation
β”œβ”€β”€ video_meta_learner_v2.pkl      # Video meta-learner model
β”œβ”€β”€ run_all.ps1                    # PowerShell script to launch both servers
β”œβ”€β”€ requirements.txt               # Python dependencies
└── .gitignore

βš™οΈ Installation

Prerequisites

  • Python 3.10+ with pip
  • Node.js 18+ with npm
  • CUDA-capable GPU (recommended, falls back to CPU)

1. Clone the Repository

git clone https://github.com/<your-username>/deepfocus.git
cd deepfocus

2. Set Up Python Backend

# Create and activate virtual environment
python -m venv venv

# Windows
.\venv\Scripts\activate

# Linux/macOS
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

3. Set Up Frontend

cd frontend
npm install
cd ..

4. Download Model Weights

⚠️ Model weights are not included in this repository (.pth, .pkl, .pt files are gitignored due to their large size).

Place the following pre-trained weights in the final/ directory:

File Size Description
convnext_finetuned_v5.pth ~198 MB ConvNeXt-Small fine-tuned weights
efficientnet_b3_finetuned_v5.pth ~43 MB EfficientNet-B3 fine-tuned weights
xception_finetuned_v5.pth ~84 MB Xception fine-tuned weights
vit_finetuned_v5.pth ~87 MB ViT-Small fine-tuned weights
meta_learner_fusion.pkl ~1 KB Stacking meta-learner (image pipeline)
new_watermark_classifier.pkl ~155 MB Watermark SVM classifier
new_feature_scaler.pkl ~492 KB Feature scaler for watermark pipeline

Also place video_meta_learner_v2.pkl in the project root for video analysis.


πŸš€ Usage

Quick Launch (Windows)

.\run_all.ps1

This starts both the backend API and frontend dashboard in separate terminal windows.

Manual Launch

Terminal 1 β€” Backend:

# From project root, with venv activated
python -m uvicorn backend.main:app --host 0.0.0.0 --port 8000

Terminal 2 β€” Frontend:

cd frontend
npm run dev

Access

  • Frontend Dashboard: http://localhost:3000
  • Backend API: http://localhost:8000
  • API Docs (Swagger): http://localhost:8000/docs

πŸ”¬ Detection Pipeline

Image Analysis Pipeline

Input Image
    β”‚
    β”œβ”€β”€β–Ί 4Γ— CNN Inference (EfficientNet-B3, Xception, ViT-Small, ConvNeXt)
    β”‚       └──► Per-model fake probability
    β”‚
    β”œβ”€β”€β–Ί Watermark Detection
    β”‚       β”œβ”€β”€β–Ί DCT mid-frequency feature extraction (8Γ—8 blocks)
    β”‚       β”œβ”€β”€β–Ί Global frequency statistics (energy, variance, flatness, entropy)
    β”‚       └──► SVM classification β†’ watermark probability
    β”‚
    └──► Meta-Learner Fusion (Stacking Ensemble)
            β”œβ”€β”€β–Ί Input: [eff_b3_prob, xception_prob, vit_prob, convnext_prob, watermark_prob]
            └──► Output: Final fake probability + label

Video Analysis Pipeline

Input Video
    β”‚
    β”œβ”€β”€β–Ί Single-Pass Frame Extraction (optimized decode β€” reads video once)
    β”‚       β”œβ”€β”€β–Ί CNN keyframe candidates (evenly sampled)
    β”‚       └──► BiLSTM temporal clip frames
    β”‚
    β”œβ”€β”€β–Ί Temporal Consistency Analyzer
    β”‚       β”œβ”€β”€β–Ί Blink detection (eye brightness changes)
    β”‚       β”œβ”€β”€β–Ί Optical flow analysis (Farneback dense flow)
    β”‚       └──► Facial landmark stability (normalized eye jitter)
    β”‚
    β”œβ”€β”€β–Ί BiLSTM Temporal Branch
    β”‚       β”œβ”€β”€β–Ί Optical flow feature extraction (12-dim per frame pair)
    β”‚       β”œβ”€β”€β–Ί Multi-clip inference (3 clips Γ— 48 frames)
    β”‚       └──► Attention-weighted BiLSTM β†’ temporal fake score
    β”‚
    β”œβ”€β”€β–Ί Smart Keyframe Selection (MTCNN face detection + quality ranking)
    β”‚       └──► 4Γ— CNN Ensemble on top-N face crops
    β”‚
    β”œβ”€β”€β–Ί Quality Forensics Analyzer
    β”‚       β”œβ”€β”€β–Ί Sharpness mismatch (face vs. body Laplacian variance)
    β”‚       β”œβ”€β”€β–Ί Frequency mismatch (FFT high-frequency energy)
    β”‚       β”œβ”€β”€β–Ί Edge anomaly (Canny edge density at face boundary)
    β”‚       β”œβ”€β”€β–Ί Compression mismatch (JPEG blocking artifacts)
    β”‚       β”œβ”€β”€β–Ί DCT anomaly (mid-frequency coefficient patterns)
    β”‚       └──► Color inconsistency (LAB color space face/boundary comparison)
    β”‚
    └──► Meta-Learner Fusion (Logistic Regression)
            β”œβ”€β”€β–Ί Input: [eff_b3, xception, vit, convnext, quality, flow, blink, landmark]
            └──► Output: Final fake probability + label

🧠 Models

CNN Architectures

Model Input Size Architecture Strength
EfficientNet-B3 300Γ—300 Compression artifact detection, mobile-scale forensics
Xception 299Γ—299 Depthwise separable convolutions for phase inconsistencies
ViT-Small 224Γ—224 Global self-attention for long-range pixel dependencies
ConvNeXt-Small 224Γ—224 Modern ConvNet for texture and geometric anomalies

BiLSTM Temporal Model

  • Architecture: 2-layer Bidirectional LSTM with attention mechanism
  • Input: 12-dimensional optical flow features per frame pair
  • Sequence Length: 48 frames per clip, 3 clips per video
  • Features: Flow magnitude, direction, boundary scores, spatial entropy, quadrant correlation

Meta-Learner

  • Image pipeline: Stacking ensemble (trained on CNN + watermark outputs)
  • Video pipeline: Logistic Regression meta-learner (trained on CNN + temporal + quality outputs)

πŸ–₯ Frontend Dashboard

The forensic dashboard provides:

  • Drag-and-drop upload for images and videos
  • Real-time analysis with animated progress tracking
  • Verdict display β€” large, clear Real/Fake classification with confidence score
  • Meta-Learner Inputs panel β€” per-model signal bars with weights and status
  • Visual Diagnostics β€” GradCAM heatmap, radar plot, and ensemble bar chart
  • CNN Ensemble Deep-Dive β€” cross-architectural agreement analysis
  • BiLSTM Motion Forensics (video only) β€” temporal inconsistency breakdown
  • Biological Sync (video only) β€” blink rate and landmark jitter analysis
  • Forensic Artifacts β€” DCT anomaly, sharpness mismatch, color inconsistency details
  • PDF Export β€” full forensic report download
  • Analysis History β€” LocalStorage log with JSON export

πŸ“‘ API Endpoints

POST /analyze/image

Analyze a single image for deepfake indicators.

Request: multipart/form-data with file field (image)

Response:

{
  "label": "Fake",
  "confidence": 0.9523,
  "final_score": 0.9523,
  "gradcam_url": "/static/grad_cams/gradcam_Fake_0.9523_a1b2c3d4.jpg",
  "radar_url": "/static/radar_plots/radar_fake_0.9523_e5f6g7h8.png",
  "barchart_url": "/static/bar_charts/barchart_fake_0.9523_i9j0k1l2.png",
  "forensic_report": { ... },
  "ensemble_fake_probability": 0.8912,
  "watermark_probability": 0.7634,
  "decision_source": "meta_learner_stacking",
  "models": { ... }
}

POST /analyze/video

Analyze a video for deepfake indicators using the full hybrid pipeline.

Request: multipart/form-data with file field (video)

Response:

{
  "label": "Fake",
  "confidence": 0.8765,
  "final_score": 0.8765,
  "gradcam_url": "/static/grad_cams/...",
  "radar_url": "/static/radar_plots/...",
  "barchart_url": "/static/bar_charts/...",
  "forensic_report": {
    "ai_consensus": { ... },
    "motion_integrity": { ... },
    "forensic_artifacts": { ... },
    "biological_signals": { ... },
    "metadata": { ... },
    "interpretation": { ... }
  }
}

πŸ“Έ Screenshots

Screenshots of the dashboard can be added here after deployment.


πŸ™ Acknowledgements

  • timm β€” PyTorch Image Models
  • facenet-pytorch β€” MTCNN face detection
  • pytorch-grad-cam β€” GradCAM visualization
  • FastAPI β€” Modern Python web framework
  • Next.js β€” React framework for the frontend dashboard

πŸ“„ License

This project is developed for academic purposes. See LICENSE for details.


Built with πŸ”¬ by the DeepFocus Team

About

Multi-modal deepfake detection platform combining CNN ensembles, BiLSTM temporal analysis, and forensic signal intelligence for advanced AI-generated media detection.

multi-signal-deepfake-detection.vercel.app

Topics

ai-forensicscomputer-visioncybersecuritydeepfake-detectiondigital-forensicsfastapinextjspytorchvideo-analysisxai

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.