Skip to content

Arnav000/DeepFake-Detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeepFake-Detector

PyTorch-based Deep Learning project that uses Transfer Learning (ResNet50) to classify images as "Real" or "Fake". This repository implements a binary classification model to distinguish between genuine and AI-generated faces. It includes data loading utilities, a training script, and a Streamlit-based web interface for easy inference.

Dataset Setup

This project uses the "140k Real and Fake Faces" dataset from Kaggle (https://www.kaggle.com/datasets/xhlulu/140k-real-and-fake-faces)

Features

  • Transfer Learning: Fine-tunes a pre-trained ResNet50 model on deepfake datasets.
  • PyTorch Training Pipeline: Custom data loaders, binary cross-entropy loss, and metrics tracking tracking (Accuracy & F1-Score).
  • Streamlit Web UI: A simple local web interface to upload images and run inference in real-time.
image
111.mp4

Project Structure

  • app.py: Streamlit application for inference
  • src/dataset.py: PyTorch dataset loaders and transformations
  • src/model.py: ResNet50 architecture definition
  • src/train.py: Training and evaluation loops

Training the Model

To train the ResNet50 model from scratch, run the train.py script:

python src/train.py

This will train the model and save the best weights to best_deepfake_model.pth.

Running Inference via Streamlit

To test the trained model interactively using the web interface:

streamlit run app.py

This will launch a local server where you can upload images and see the prediction confidence scores.

About

PyTorch-based Deep Learning project that uses Transfer Learning (ResNet50) to classify images as "Real" or "Fake".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages