Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeepFake Detection

A Python-based deepfake face-swapping toolkit built with TensorFlow and/or PyTorch for creating high-quality synthetic face videos.

🚀 Features

  • End-to-end pipeline: Face detection ➜ Preprocessing ➜ Model training ➜ Face swapping ➜ Postprocessing.
  • Multiple face encoder/decoder models: Support for autoencoder and GAN-based architectures.
  • Flexible training options: Configurable epochs, batch size, learning rate via CLI/flags.
  • High-resolution output: Supports HD face-swap videos.
  • GPU acceleration: Optimized for CUDA-enabled NVIDIA GPUs.

🧭 Table of Contents

  1. Installation
  2. Usage
    • Data preparation
    • Training the model
    • Face swap inference
  3. Examples
  4. Project Structure
  5. Configuration
  6. Troubleshooting
  7. License
  8. Contact

Installation

  1. Clone the repository:
    git clone https://github.com/suyashsachdeva/DeepFake.git
    cd DeepFake

2. (Optional) Create and activate a virtual environment:

   ```bash
   python3 -m venv venv
   source venv/bin/activate
  1. Install dependencies:

    pip install -r requirements.txt
  2. Download any required pre-trained models (links provided below or pop up in the CLI).


Usage

1. Data Preparation

python scripts/extract_faces.py \
  --input_video data/source.mp4 \
  --output_dir data/source_faces \
  --face_size 256

Prepare data from both source (to be swapped in) and target (original video).

2. Train the Model

python train.py \
  --source_dir data/source_faces \
  --target_dir data/target_faces \
  --model_dir models/face_swap \
  --epochs 100

Customize epochs, batch size, learning rate via flags.

3. Perform Inference

python scripts/face_swap.py \
  --model_dir models/face_swap \
  --input_video data/target.mp4 \
  --output_video results/swapped.mp4

Takes the target video and applies the trained face-swapping model.


📸 Examples

Include before/after visuals here! Example: results/swapped_example.mp4


🗂️ Project Structure

DeepFake/
├── data/
│   ├── source/
│   └── target/
├── models/
│   └── face_swap/
├── scripts/
│   ├── extract_faces.py
│   ├── align_faces.py
│   └── face_swap.py
├── train.py
├── requirements.txt
└── README.md

⚙️ Configuration

You can customize the workflow through CLI flags or environment variables:

  • --face_size: Size of face crops (default: 256)
  • --learning_rate, --batch_size, --epochs
  • Paths for input/output and model storage

🛠️ Troubleshooting

  • GPU errors: Verify CUDA toolkit is installed, and GPU drivers are up to date.
  • Poor swap quality: Ensure balanced, varied samples (>2000 per identity) during prep.
  • Execution stalls: Try lowering batch size or face size.

📬 Contact

For bug reports or inquiries, contact Suyash Sachdeva at suyashsachdeva2403@gmail.com. Also open to pull requests!


Happy deepfaking! 🔧🤖


🧩 Next Steps (Optional Enhancements)

  • Web UI frontend for simplified interaction
  • Support for real-time processing
  • Integration of voice deepfake capabilities

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages