Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deepfake Detection — Depth-Wise Separable CNN

Reference implementation accompanying the IEEE ICETCI 2023 paper:

Detecting DeepFakes: A Deep Convolutional Neural Network Approach with Depth-Wise Separable Convolutions Regatte Varshith Reddy (first author), Anish Nethi, Sanatan Sukhija, Yayati Gupta — Mahindra University 2023 International Conference on Emerging Techniques in Computational Intelligence (ICETCI), pp. 33–38 IEEE Xplore · DOI: 10.1109/ICETCI58599.2023.10331449

License Python TensorFlow


Overview

Face-swap and fully synthetic video are now trivial to produce and hard to spot. This project detects them with an Xception convolutional network — an architecture built almost entirely from depth-wise separable convolutions, which give most of the representational power of a full CNN at a fraction of the parameters and FLOPs.

The paper reports 98.8% image-level and 97.4% video-level accuracy on Celeb-DF v2.

Approach

  • Backbone: Xception, ImageNet-pretrained, defined from scratch with the Keras functional API — entry flow, 8× middle-flow residual blocks, exit flow, global average pooling.
  • Head: GlobalAveragePooling2D → Dense(1024, ReLU) → Dense(1, sigmoid) for binary real/fake classification.
  • Transfer learning: early layers frozen; the rest fine-tuned with Adam (lr 1e-4) and binary cross-entropy.
  • Inference: per-frame classification; a video is scored by aggregating its sampled-frame predictions.
  • Explainability: Grad-CAM heatmaps over the last convolutional layer show which facial regions drove each decision (blending boundaries, eyes, teeth).

Repository contents

File What it is
XceptionNet.py Builds the Xception network, loads ImageNet weights, attaches the binary head, freezes early layers, and fine-tunes on an image-folder dataset (tf.data); saves the model and a training-accuracy plot.
Grad_Cam.py GradCAM class + CLI — computes a class-activation heatmap for one image and writes an `[original
GUI.py Minimal Tkinter desktop app: load an image, get a REAL / FAKE prediction.
requirements.txt Pinned-minimum dependencies.
LICENSE MIT

Datasets

  • Celeb-DF v2 — used for the results in the paper. Access is by request: https://github.com/yuezunli/celeb-deepfakeforensics
  • XceptionNet.py expects an image-folder split — train/{real,fake} and valid/{real,fake} — so any real-vs-fake face dataset in that layout works (e.g. the "140k Real and Fake Faces" set on Kaggle).

Running it

The scripts were tidied up from the original 2021 project: paths and hyper-parameters are CLI flags, imports target current tf.keras, the data pipeline uses tf.data, and the Xception ImageNet weights download on first run. Needs TensorFlow ≥ 2.13.

python -m venv .venv && source .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# tkinter ships with CPython on Windows/macOS; on Debian/Ubuntu: sudo apt install python3-tk

Train — arrange the dataset as <root>/train/{real,fake} and <root>/valid/{real,fake}, then:

python XceptionNet.py --data <root> --epochs 10 --image-size 256 --out xception_deepfake.keras

Explain a prediction (Grad-CAM)

python Grad_Cam.py --model xception_deepfake.keras --image face.jpg --out gradcam.jpg

Desktop demo

python GUI.py --model xception_deepfake.keras

Citation

@inproceedings{reddy2023deepfakes,
  title     = {Detecting DeepFakes: A Deep Convolutional Neural Network Approach
               with Depth Wise Separable Convolutions},
  author    = {Reddy, Regatte Varshith and Nethi, Anish and
               Sukhija, Sanatan and Gupta, Yayati},
  booktitle = {2023 International Conference on Emerging Techniques in
               Computational Intelligence (ICETCI)},
  pages     = {33--38},
  year      = {2023},
  publisher = {IEEE},
  doi       = {10.1109/ICETCI58599.2023.10331449}
}

Future work (from the paper)

  • Extend detection to AI-generated audio.
  • Ship the detector as a browser extension that flags deepfakes inline on social and messaging platforms.

License

MIT © 2021 Varshith Reddy Regatte

About

Code for our IEEE ICETCI 2023 paper — depth-wise separable CNN for deepfake image/video detection (Celeb-DF v2; 98.8%/97.4% acc). DOI: 10.1109/ICETCI58599.2023.10331449

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages