Skip to content

ManamoyB/Deepfake-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Deepfake Detection System | AI-Powered Video Authentication

Python PyTorch ResNext LSTM Django Docker License


๐Ÿ“Œ Project Overview

Deepfake Detection System is an AI-powered forensic authentication solution that detects manipulated facial videos and images with 93.58% accuracy. Using advanced deep learning techniques (ResNext CNN + LSTM RNN), it identifies media tampering through temporal and spatial feature extraction.

Key Highlights:

  • โœ… High Accuracy: 93.58% detection on 100 frames per video
  • โœ… Production-Ready: Django web interface + Docker containerization
  • โœ… Transfer Learning: Pre-trained ResNext backbone for efficient training
  • โœ… Temporal Analysis: LSTM layer captures video sequence patterns
  • โœ… Scalable Architecture: Supports batch processing and real-time predictions

๐ŸŽฏ Why This Matters

Deepfakes pose critical threats to:

  • Media Authenticity: Verify video authenticity in journalism & broadcasting
  • Security & Fraud Detection: Combat synthetic identity theft & voice spoofing
  • Digital Forensics: Support legal investigations & forensic analysis
  • Social Platform Safety: Content moderation at scale

This project demonstrates production-grade deep learning for media authentication.


๐Ÿ“ธ Screenshots & Demo

System Workflow

System Architecture

Live Detection Demo

Deepfake Detection GIF

Watch Full YouTube Demo | View Step-by-Step Setup Playlist


โœจ Key Features

  • Dual-Stage Detection Pipeline

    • ResNext CNN: Extracts spatial features from video frames
    • LSTM RNN: Learns temporal patterns across frame sequences
  • Transfer Learning Architecture

    • Pre-trained ResNext backbone reduces training time
    • Fine-tuned for deepfake classification
  • Web Interface (Django)

    • Video upload & analysis
    • Real-time prediction results
    • Confidence scores & visualization
  • Docker Support

    • One-click deployment
    • No dependency conflicts
    • Tested on CPU & GPU systems
  • Flexible Frame Processing

    • 10, 20, 40, 60, 80, 100 frames per video
    • Accuracy improves with more frames
    • Trade-off between speed & precision
  • Cross-Platform Compatibility

    • CPU inference (standard systems)
    • GPU acceleration (CUDA)
    • AMD GPU support

๐Ÿ“Š Model Performance

Model Training Videos Frames/Video Accuracy Detection Speed
Base Model 6,000 10 84.21% โšกโšกโšก
Enhanced 6,000 20 87.79% โšกโšก
Standard 6,000 40 89.35% โšกโšก
Optimized 6,000 60 90.59% โšก
Advanced 6,000 80 91.50% โšก
Production Grade 6,000 100 93.59% Standard

๐Ÿ› ๏ธ Tech Stack

Deep Learning & Computer Vision

  • PyTorch - Deep learning framework
  • ResNext-50 - Convolutional neural network (pre-trained ImageNet)
  • LSTM - Long Short-Term Memory for sequence learning
  • OpenCV - Video processing & frame extraction
  • Scikit-learn - Model evaluation & metrics

Web Framework

  • Django - Backend web server
  • Django REST Framework - API endpoints
  • HTML/CSS/JavaScript - Frontend interface

DevOps & Deployment

  • Docker - Container orchestration
  • CUDA/cuDNN - GPU acceleration (optional)
  • pip - Python package management

Data & Preprocessing

  • NumPy - Array operations
  • Pandas - Data handling
  • Pillow (PIL) - Image processing

๐ŸŽฎ What You Can Do

  • Upload Videos - Submit any video file (MP4, AVI, MOV)
  • Get Predictions - Receive real/fake classification with confidence score
  • View Analysis - Visualize detected manipulations frame-by-frame
  • Download Results - Export detection reports
  • Batch Processing - Analyze multiple videos simultaneously
  • Train Custom Models - Retrain on custom datasets

๐Ÿ”ง Installation & Setup

Prerequisites

โœ“ Python 3.8+
โœ“ pip (Python package manager)
โœ“ 4GB+ RAM
โœ“ Git
โœ“ (Optional) CUDA 11.8+ for GPU acceleration

Clone Repository

git clone https://github.com/ManamoyB/Deepfake-Detection.git
cd Deepfake-Detection

Install Dependencies

pip install -r requirements.txt

Run Django Application (Local)

cd "Django Application"
python manage.py runserver

Visit http://localhost:8000 in your browser.

Run with Docker (Recommended)

cd "Django Application"
docker build -t deepfake-detector .
docker run -p 8000:8000 deepfake-detector

Train Custom Model

cd "Model Creation"
jupyter notebook
# Open and run the training notebooks

๐Ÿ“‚ Project Structure

Deepfake-Detection/
โ”œโ”€โ”€ Django Application/          # Web interface for predictions
โ”‚   โ”œโ”€โ”€ manage.py               # Django project manager
โ”‚   โ”œโ”€โ”€ Dockerfile              # Container configuration
โ”‚   โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”‚   โ””โ”€โ”€ templates/              # HTML templates
โ”‚
โ”œโ”€โ”€ Model Creation/              # Training & development notebooks
โ”‚   โ”œโ”€โ”€ 1_Data_Preparation.ipynb
โ”‚   โ”œโ”€โ”€ 2_ResNext_Feature_Extraction.ipynb
โ”‚   โ”œโ”€โ”€ 3_LSTM_Training.ipynb
โ”‚   โ”œโ”€โ”€ 4_Model_Evaluation.ipynb
โ”‚   โ””โ”€โ”€ trained_models/         # Pre-trained model weights
โ”‚
โ”œโ”€โ”€ Documentation/               # Project documentation
โ”‚   โ”œโ”€โ”€ Architecture.md
โ”‚   โ”œโ”€โ”€ Dataset_Information.md
โ”‚   โ”œโ”€โ”€ Installation_Guide.md
โ”‚   โ””โ”€โ”€ API_Reference.md
โ”‚
โ”œโ”€โ”€ github_assets/              # Demo images & GIFs
โ”œโ”€โ”€ README.md                   # This file
โ””โ”€โ”€ LICENSE                     # GPL v3.0 License

๐ŸŽ“ Development Process

Phase 1: Research & Planning

  • Analyzed deepfake detection literature
  • Identified ResNext + LSTM as optimal architecture
  • Designed two-stage detection pipeline

Phase 2: Data Preparation

  • Sourced 6,000+ real & fake videos
  • Extracted frames with temporal spacing
  • Normalized & augmented training data

Phase 3: Model Development

  • Transfer learning with pre-trained ResNext
  • LSTM tuning for sequence classification
  • Hyperparameter optimization for accuracy

Phase 4: Testing & Validation

  • Cross-validated on hold-out test set
  • Analyzed failure cases & edge scenarios
  • Benchmarked inference speed

Phase 5: Deployment

  • Containerized with Docker
  • Created Django web interface
  • Tested on CPU & GPU systems

๐Ÿง  Architecture Explanation

Video Input
    โ†“
[Frame Extraction]
    โ†“
[ResNext CNN] โ† Pre-trained on ImageNet
    โ†“
[Feature Vectors] (2048-D per frame)
    โ†“
[LSTM Layer] โ† Learns temporal patterns
    โ†“
[Classifier]
    โ†“
Real/Fake Prediction + Confidence Score

Why This Approach?

  1. ResNext: Powerful spatial feature extractor (proven on ImageNet)
  2. LSTM: Captures temporal dependencies across frames (deepfakes have telltale patterns)
  3. Transfer Learning: Reduces training data needs & computational cost
  4. Ensemble Effect: Combining CNN + RNN catches both spatial & temporal anomalies

๐Ÿ“ˆ Key Learnings

  • Transfer Learning Impact: Pre-trained ResNext reduced training time by 60%
  • Frame Count Trade-off: More frames = higher accuracy but slower inference
  • LSTM Effectiveness: Sequential modeling improved accuracy by 8-10%
  • Docker Benefits: Eliminated dependency hell, streamlined deployment
  • Data Augmentation: Critical for robust generalization across video qualities

๐Ÿš€ Future Improvements

  • Real-Time Video Stream Processing - Support live webcam input
  • Attention Mechanisms - Add self-attention for temporal focus
  • Ensemble Models - Combine with FaceForensics++ models
  • Mobile Deployment - TensorFlow Lite for edge devices
  • API Service - REST API for third-party integrations
  • Explainability - GradCAM visualization of detection regions
  • Multi-Language Support - Localized web interface
  • Cloud Deployment - AWS/GCP/Azure integration

๐Ÿ’ป Keyboard Shortcuts (Django Web UI)

Action Shortcut
Upload File Ctrl + U
Start Analysis Enter
View Results Ctrl + R
Download Report Ctrl + S
Dark Mode Toggle Ctrl + T

๐Ÿ“š Documentation & Resources


๐Ÿค Contributing

This project welcomes contributions! Potential areas:

  • Improving model accuracy on diverse datasets
  • Optimizing inference speed
  • Creating open-source API
  • Adding batch video processing
  • Improving UI/UX
  • Writing additional tests

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Commit changes (git commit -m "Add improvement")
  4. Push to branch (git push origin feature/improvement)
  5. Open a Pull Request

๐Ÿ“‹ License

This project is licensed under the GNU General Public License v3.0 - see LICENSE file for details.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

๐Ÿ“ž Contact & Support

Author: Manamoy B

Connect With Me:

Questions or Issues?


โญ If You Found This Helpful

If this project helped you or you found it useful for learning, please:

  • โญ Star this repository to increase visibility
  • ๐Ÿด Fork if you plan to build on it
  • ๐Ÿ’ฌ Share with your network
  • ๐Ÿ“ง Mention in your portfolio/resume

๐Ÿ‘ฅ Contributors & Acknowledgments

Lead Developer: Manamoy Banerjee

Thank you to the open-source community for PyTorch, Django, and all dependencies!


๐Ÿ“ˆ Project Stats

GitHub Stars GitHub Forks GitHub Watchers


Last Updated: June 2026 | Status: Active Maintenance | Python 3.8+ | PyTorch 1.9+

About

AI-powered deepfake detection system using Deep Learning and Computer Vision to identify manipulated facial images and videos with high accuracy.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages