Skip to content

LAWSA07/DeepFake-Detection

Repository files navigation

Certainly! I'll complete the README with additional details and placeholders for images. You can then replace the image placeholders with actual screenshots or diagrams from your project.

DeepFake Detection using EfficientNet

Project Overview

This project implements a deepfake detection system using EfficientNet as the backbone of a convolutional neural network (CNN). The model is designed to classify video frames as either real or fake (deepfake).

DeepFake Detection Overview

Features

  • Utilizes EfficientNetB0 for efficient and accurate image classification
  • Implements data augmentation techniques to improve model robustness
  • Supports training, validation, and testing phases
  • Includes early stopping and model checkpointing for optimal performance

Requirements

  • Python 3.7+
  • TensorFlow 2.x
  • Keras
  • NumPy
  • Pandas
  • OpenCV
  • Matplotlib (for visualization)

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/deepfake-detection.git
    cd deepfake-detection
    
  2. Install the required packages:

    pip install -r requirements.txt
    

Dataset Structure

Organize your dataset as follows:

deepFake_detection_new/
├── split_dataset/
│   ├── train/
│   │   ├── real/
│   │   └── fake/
│   ├── val/
│   │   ├── real/
│   │   └── fake/
│   └── test/
│       ├── real/
│       └── fake/

Dataset Structure

Usage

  1. Prepare your dataset as described above.

  2. Train the model:

    python train.py
    
  3. Evaluate the model:

    python evaluate.py
    
  4. For inference on new images:

    python predict.py --image_path path/to/your/image.jpg
    

Model Architecture

  • Base: EfficientNetB0 (pre-trained on ImageNet)
  • Additional layers:
    • Global Max Pooling
    • Dense layer (512 units, ReLU activation)
    • Dropout layer
    • Dense layer (128 units, ReLU activation)
    • Output Dense layer (1 unit, Sigmoid activation)
efficient_net = EfficientNetB0(
    weights='imagenet',
    input_shape=(128, 128, 3),
    include_top=False,
    pooling='max'
)

Data Augmentation

We use the following augmentation techniques:

  • Random rotation (±10 degrees)
  • Width and height shifts
  • Zoom
  • Horizontal flip
train_datagen = ImageDataGenerator(
    rescale=1/255,
    rotation_range=10,
    width_shift_range=0.1,
    height_shift_range=0.1,
    shear_range=0.2,
    zoom_range=0.1,
    horizontal_flip=True,
    fill_mode='nearest'
)

Data Augmentation Examples

Training Process

  • Optimizer: Adam (learning rate: 0.0001)
  • Loss function: Binary crossentropy
  • Metrics: Accuracy
  • Callbacks: EarlyStopping, ModelCheckpoint
custom_callbacks = [
    EarlyStopping(monitor='val_loss', patience=5, mode='min'),
    ModelCheckpoint(filepath='best_model.h5', save_best_only=True, monitor='val_loss', mode='min')
]

history = model.fit_generator(
    train_generator,
    epochs=20,
    steps_per_epoch=len(train_generator),
    validation_data=val_generator,
    validation_steps=len(val_generator),
    callbacks=custom_callbacks
)

Training Metrics

Results

Our model achieved an accuracy of XX% on the test set. Below is a confusion matrix showing the model's performance:

Final Result

Additional performance metrics:

  • Precision: XX%
  • Recall: XX%
  • F1-Score: XX%

Future Work

  • Implement video-level classification
  • Explore other EfficientNet variants (B1-B7)
  • Integrate attention mechanisms for improved performance
  • Investigate the impact of different pre-processing techniques

Contributing

Contributions to this project are welcome! Please fork the repository and submit a pull request with your proposed changes. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • The EfficientNet implementation is based on the TensorFlow Keras Applications.
  • Thanks to the deepfake research community for insights and datasets.
  • Special thanks to [list any specific individuals or organizations that provided significant help]

For any questions or issues, please open an issue on the GitHub repository or contact [your contact information].

About

finding Tom Cruise.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published