Skip to content

XitijShinde/Deepfake-Detection-Models

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deepfake Detection Banner

🔍 Deepfake Detection Models

Advanced Face Anti-Spoofing & Deepfake Detection using Machine Learning, Deep Learning, and GANs

Python Jupyter Notebook Scikit-Learn TensorFlow License: MIT


📖 Overview

As synthetic media generation becomes increasingly sophisticated, the need for robust Deepfake Detection mechanisms is more critical than ever. This repository presents a comprehensive evaluation of various algorithms—from classical Machine Learning to state-of-the-art Deep Learning—for identifying deepfakes and spoofed facial images.

The project evaluates architectures across multiple datasets to provide a holistic view of what works best for facial security in real-world scenarios.

🎯 Aim & Motive

As a passionate student and a rapid learner with a strong interest in Artificial Intelligence, I developed this project to showcase my progression and proficiency in Machine Learning.

My goal was not just to use out-of-the-box solutions, but to demonstrate a deep understanding of model evolution:

  • Starting from the Basics: Implementing foundational Machine Learning algorithms (SVM, Random Forest, XGBoost) to understand feature extraction and baseline metrics.
  • Scaling to the Maximum: Progressing to highly complex Deep Learning architectures (FaceNet, DenseNet) and advanced Ensembles to push accuracy to the limit.

This repository serves as a testament to my ability to research, implement, and evaluate a wide spectrum of algorithms to solve a complex, real-world security problem.


📂 Project Structure

To maintain a clean and modular codebase, the models and data are organized systematically:

Deepfake-Detection/
│
├── assets/                  # Images and banners for README
├── datasets/                # Dataset loaders and raw files
│   └── nuaa_dataset/        # NUAA Imposter Database
│
├── evaluation/              # Flattened testing and evaluation scripts
│
├── models/                  # Core Models Directory
│   ├── machine_learning/    # SVM, Random Forest, XGBoost
│   ├── deep_learning/       # FaceNet, DenseNet, DNN, HuggingFace integration
│   ├── ensemble/            # Advanced model blending techniques
│   └── gan/                 # Generative Adversarial Network based models
│
└── README.md                # Project documentation

📊 Datasets Used

This project leverages industry-standard datasets to benchmark the models:

  1. NUAA Imposter Database

    • Focuses on 2D face spoofing attacks (print attacks).
    • Contains real face images and corresponding spoofed images captured under various lighting conditions.
  2. CelebA-Spoof

    • A large-scale face anti-spoofing dataset.
    • Contains diverse spoofing types including print, replay, and 3D mask attacks.

(Note: Raw large dataset files are not tracked in this repository. Please download them from their respective sources and place them in the datasets/ directory).


🧠 Model Architectures

We experimented with multiple paradigms to determine the most effective deepfake detection strategy.

1. Classical Machine Learning

Effective for engineered features and tabular representations of image data.

  • Support Vector Machines (SVM)
  • Random Forest
  • XGBoost

2. Deep Learning

Leveraging Convolutional Neural Networks (CNNs) for automatic feature extraction.

  • Deep Neural Networks (DNN)
  • DenseNet
  • FaceNet
  • HuggingFace Pre-trained Models

3. Ensemble Methods

Combining predictions from multiple models (e.g., SVM + XGBoost) to achieve higher accuracy and reduce variance.

4. Generative Adversarial Networks (GANs)

Exploring adversarial techniques to detect sophisticated generated media.


🏆 Results & Accuracy

Our models achieved highly competitive results across various benchmarks. Below are some of the key accuracy metrics extracted from the experiments:

Model Architecture Dataset Accuracy Notes
FaceNet + DenseNet CelebA / Mixed 99.96% Exceptional feature extraction; best performing Deep Learning model.
Random Forest NUAA 98.97% High precision (99.71%) on print attacks.
Hybrid Ensemble (SVM + XGB) CelebA / Mixed 98.33% Best performing traditional ML ensemble.
Support Vector Machine (SVM) CelebA / Mixed 98.27% Strong baseline performance.
XGBoost CelebA / Mixed 98.14% Fast and highly accurate.

(For detailed confusion matrices and classification reports, please refer to the specific .ipynb files in the models/ directory).


🚀 Getting Started

Prerequisites

Ensure you have Python 3.8+ installed. You can install the required dependencies using:

pip install -r requirements.txt

Running the Notebooks

  1. Clone the repository:
    git clone https://github.com/YourUsername/Deepfake-Detection.git
    cd Deepfake-Detection
  2. Navigate to your desired model directory:
    cd models/machine_learning
  3. Launch Jupyter Notebook:
    jupyter notebook
  4. Open any .ipynb file and run the cells sequentially.

🤝 Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

Distributed under the MIT License. See LICENSE for more information.


Built with ❤️ for the open-source community.

About

A comprehensive evaluation of face anti-spoofing and deepfake detection models, comparing classical Machine Learning, state-of-the-art Deep Learning, and GAN architectures.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages