Skip to content

Latest commit

Β 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DeepShield πŸ›‘οΈ β€” AI-Powered Deepfake Detection System

Multi-modal deepfake detection with an ensemble AI architecture, Explainable AI forensic reports, and a diversity-aware pipeline that reduces demographic bias across skin tones.

Python PyTorch React FastAPI


🎯 What is DeepShield?

DeepShield is a state-of-the-art forensic AI system that detects manipulated media β€” images, videos, and audio β€” in real time. It doesn't just give you a verdict; it explains exactly why media is fake using LLaMA 3.3 70B-powered natural language analysis.

v2.0 introduces a diversity-aware detection pipeline β€” a multi-layer system tackling a critical gap in AI: demographic bias. Most deepfake detectors are trained on Western-dominated datasets, causing high false-positive rates on Indian and South Asian faces. DeepShield v2.0 solves this with RetinaFace, CLAHE preprocessing, and ViT model finetuning on diverse demographic data.


πŸ”₯ Key Features

Feature Description
Multi-Modal Detection Analyze images, videos (frame-by-frame), and audio files β€” all from one interface
Ensemble Architecture Two neural networks (ViT + SigLIP) target different manipulation types simultaneously
Diversity-Aware Pipeline RetinaFace + CLAHE preprocessing + finetuned weights reduce false positives on Indian/South Asian faces by 40%+
Two-Pass Face Detection If face detection fails (common with darker skin under poor lighting), the image is CLAHE-enhanced and retried
Explainable AI (XAI) LLaMA 3.3 70B generates human-readable forensic explanations of why media is classified as fake
Visual Forensic Breakdown Full ensemble confidence breakdown showing each model's individual prediction
Glassmorphic UI Premium dark-themed React frontend with drag-and-drop, ambient particles, and micro-animations

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Frontend (React + Vite)                   β”‚
β”‚   Drag-and-drop upload β†’ Live analysis β†’ Forensic report        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ HTTP (FastAPI)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Backend (FastAPI + Uvicorn)                   β”‚
β”‚                                                                  β”‚
β”‚  /detect/image ──► Image Pipeline                                β”‚
β”‚  /detect/video ──► Frame Extraction β†’ Image Pipeline Γ— 15        β”‚
β”‚  /detect/audio ──► Wav2Vec2 Audio Classifier                     β”‚
β”‚  /detect/explain β†’ Groq API β†’ LLaMA 3.3 70B                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Image Detection Pipeline (v2.0)                    β”‚
β”‚                                                                  β”‚
β”‚  Input Image                                                     β”‚
β”‚      β”‚                                                           β”‚
β”‚      β–Ό                                                           β”‚
β”‚  RetinaFace (WIDER FACE, 32k+ diverse faces)                     β”‚
β”‚  + Two-pass: retry with CLAHE boost if first pass fails          β”‚
β”‚      β”‚                                                           β”‚
β”‚      β”œβ”€β”€β–Ί CLAHE Preprocessed Face ──► ViT (finetuned, 94% prec) β”‚
β”‚      β”‚                                                           β”‚
β”‚      └──► Original Full Image ──► SigLIP (scene artifacts)       β”‚
β”‚                                                                  β”‚
β”‚  Smart Ensemble (face-detection-aware, recalibrated thresholds)  β”‚
β”‚      β”‚                                                           β”‚
β”‚      β–Ό                                                           β”‚
β”‚  Verdict: FAKE / REAL / UNCERTAIN + confidence + breakdown       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧠 AI Models

Model Role Architecture Training Data
ViT (Vision Transformer) Face forensics β€” detects manipulation artifacts on facial crops ViTForImageClassification (768-dim, 12 layers, 86M params) Finetuned on FairFace (86k diverse faces) + 140k Real/Fake + Indian faces
SigLIP Scene forensics β€” detects fully synthetic images (Midjourney, DALL-E) prithivMLmods/deepfake-detector-model-v1 HuggingFace pretrained
RetinaFace Face detection β€” locates faces across all skin tones insightface/buffalo_sc WIDER FACE (32k+ diverse images)
Wav2Vec2 Audio deepfake detection β€” identifies synthetic speech garystafford/wav2vec2-deepfake-voice-detector HuggingFace pretrained
LLaMA 3.3 70B Explainable AI β€” generates forensic reports Via Groq API (LPU inference) Meta's training corpus

🌍 Diversity & Bias Mitigation (v2.0)

The Problem

Most deepfake detectors fail on non-Western faces because they're trained on Western-dominated datasets:

  • MTCNN fails to detect Indian faces ~30% of the time
  • Real Indian faces classified as "fake" due to training bias
  • No evaluation metrics broken down by demographics

Our Solution β€” A Multi-Layer Approach

Layer Technique Impact
Face Detection RetinaFace (WIDER FACE, 32k+ diverse images) replaces MTCNN >95% detection rate across all skin tones
Two-Pass Detection CLAHE-enhanced retry when first detection pass fails Catches faces under poor lighting
Preprocessing Skin-tone-adaptive CLAHE, white balance, adaptive sharpening Equalizes micro-texture visibility across skin tones
Finetuning ViT finetuned on Indian-prioritized FairFace + 140k dataset Reduces false positives on diverse real faces
Thresholds Ensemble override thresholds recalibrated using per-ethnicity metrics ViT override: 0.65β†’0.72, Verdict: 0.65β†’0.68
Evaluation Per-demographic accuracy table via eval_diversity.py Transparent bias auditing

Training Results

Metric Value
False Positive Rate 3.27% (real faces wrongly called fake)
Fake Precision 94.36% (when it says fake, it's right)
Overall Accuracy 77.22%
Training Time 13 minutes on RTX 3050 (4GB VRAM)

πŸš€ Getting Started

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • NVIDIA GPU (recommended) or CPU
  • Groq API key (get one free)

1. Clone the Repository

git clone https://github.com/your-username/Project-Xero-PICT.git
cd Project-Xero-PICT

2. Backend Setup

cd backend
python -m venv venv
venv\Scripts\activate           # Windows
pip install -r requirements.txt
pip install insightface onnxruntime   # For RetinaFace face detection

Create a .env file in the project root:

GROQ_API_KEY="your_groq_api_key_here"

Start the server:

python main.py

3. Frontend Setup

cd frontend
npm install
npm run dev

Open http://localhost:5173/ β€” drag and drop media files to analyze!

4. (Optional) Finetune for Diversity

# Install dependencies
pip install datasets accelerate

# Download diverse training data (FairFace + Real/Fake faces)
set PYTHONPATH=.
python scripts/download_datasets.py

# Finetune ViT model (~13 min on RTX 3050)
python scripts/finetune.py

# Restart backend to load new weights
cd backend && python main.py

πŸ“‚ Project Structure

Project-Xero-PICT/
β”œβ”€β”€ frontend/                    # React + Vite UI
β”‚   └── src/
β”‚       β”œβ”€β”€ components/          # DetectPanel, HeroSection, Navbar, etc.
β”‚       β”œβ”€β”€ effects/             # Particles, Grain (ambient visuals)
β”‚       β”œβ”€β”€ context/             # ThemeProvider (dark/light mode)
β”‚       └── services/            # API client
β”‚
β”œβ”€β”€ backend/                     # FastAPI server
β”‚   β”œβ”€β”€ main.py                  # Entrypoint β€” loads all models at startup
β”‚   └── app/api/routes.py        # /detect/image, /detect/audio, /detect/video, /detect/explain
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ image/
β”‚   β”‚   β”œβ”€β”€ ensemble.py          # Smart ensemble (v2.0 β€” diversity-aware)
β”‚   β”‚   β”œβ”€β”€ vit_detector.py      # ViT classifier (auto-loads finetuned weights)
β”‚   β”‚   β”œβ”€β”€ siglip_detector.py   # SigLIP scene-level classifier
β”‚   β”‚   β”œβ”€β”€ face_detector.py     # RetinaFace with MTCNN fallback
β”‚   β”‚   └── preprocessing.py     # CLAHE, white balance, adaptive sharpening
β”‚   β”œβ”€β”€ audio/
β”‚   β”‚   └── audio_detector.py    # Wav2Vec2 audio classifier
β”‚   β”œβ”€β”€ video/
β”‚   β”‚   β”œβ”€β”€ frame_extractor.py   # Extract 15 key frames from video
β”‚   β”‚   └── video_utils.py       # Aggregate frame results
β”‚   └── weights/
β”‚       └── finetuned-vit/       # Finetuned ViT weights (343MB)
β”‚
β”œβ”€β”€ ai_service/
β”‚   β”œβ”€β”€ groq_service.py          # Groq API client (LLaMA 3.3 70B)
β”‚   └── prompts.py               # Prompt templates for XAI explanations
β”‚
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ download_datasets.py     # Automated dataset download from HuggingFace
β”‚   β”œβ”€β”€ finetune.py              # Diversity-aware ViT finetuning pipeline
β”‚   └── eval_diversity.py        # Per-ethnicity evaluation metrics
β”‚
└── data/                        # Training datasets (gitignored)
    β”œβ”€β”€ raw/fairface/            # 86k diverse faces with ethnicity labels
    └── raw/fake140k/            # Real vs fake face images

πŸ‘¨β€πŸ’» Team

Built during the PVG Hackathon by:

Name Role
Samarth Raut Team Lead
Atharv Lalage ML Pipeline & Backend
Suyash Pathade Frontend & UI
Shweta Rupnawar Research & Testing

Built with ❀️ for the future of digital trust and media authenticity.

About

Defending truth in digital media. An AI-powered suite for real-time deepfake detection across images, video, and audio.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages