xdfdet: explainable deepfake detection with EfficientNet-B4 and Grad-CAM

xdfdet detects manipulated face videos and shows which facial regions influence each prediction. The released aug-cutout-black detector scores 0.8981 AUC; the baseline detector scores 0.8684 on FaceForensics++. Each checkpoint used its own random test split, so read these as separate run results.

Quick facts

Item Value
Architecture EfficientNet-B4, 8 released checkpoints
FaceForensics++ AUC, aug-cutout-black 0.8971 mean of 3 runs; 0.8981 released checkpoint (single run)
FaceForensics++ AUC, baseline 0.8678 mean of 3 runs; 0.8684 released checkpoint (single run)
Cross-dataset DFDC AUC 0.60 to 0.66 on 398 unseen videos
Hugging Face downloads 727 (as of 2026-10-15)
GitHub stars 8

Project links

Cite this

@inproceedings{kaya2026augmentation,
  title     = {Augmentation and Cutout in Deepfake Detection: A Comparative Study of Accuracy, Calibration, and Attention},
  author    = {Kaya, Mert and Adanova, Venera},
  booktitle = {11th International Conference on Computer Science and Engineering (UBMK 2026)},
  year      = {2026},
  note      = {Accepted; to appear in IEEE Xplore}
}

@mastersthesis{kaya2025xdfdet,
  title  = {Explainable Deepfake Detection Using Frame Level CNN Models: A Comparative Study of Augmentation and Cutout Techniques},
  author = {Kaya, Mert},
  school = {TED University},
  year   = {2025},
  doi    = {10.5281/zenodo.18998566}
}

Detect a video

pip install git+https://github.com/mertkayacs/xdfdet && xdfdet predict video.mp4 --gradcam cam.png

The command downloads the default aug-cutout-black model, prints the probability that the video is real and saves a Grad-CAM heatmap. Select another detector with --model baseline. Use Python 3.10 to 3.12.

import xdfdet

model = xdfdet.load_model("aug-cutout-black")

Use the package for face detection, alignment and normalization. Each Keras model takes 12 RGB face crops, shaped (batch, 12, 224, 224, 3), and outputs real probabilities shaped (batch, 12, 1). Average the frames for a video score; below 0.5 is classified as fake.

Released detectors

File Augmentation and cutout AUC
aug-cutout-black.keras standard augmentation, black-fill cutout 0.8981
aug-cutout-random.keras standard augmentation, random-fill cutout 0.8820
aug-cutout-white.keras standard augmentation, white-fill cutout 0.8734
cutout-white.keras white-fill cutout 0.8700
baseline.keras none 0.8684
cutout-black.keras black-fill cutout 0.8669
cutout-random.keras random-fill cutout 0.8642
aug-standard.keras standard augmentation 0.8616

AUC measures how well a detector separates real and fake examples: 0.5 is chance and 1.0 is perfect. The eight weights study how augmentation and masking parts of a face during training change detection and attention. Grad-CAM shows where the model looks.

The released checkpoints also retain F1, Brier and log-loss measurements from their own test runs:

File AUC F1 Brier Log loss
aug-cutout-black.keras 0.8981 0.8431 0.1247 0.4710
aug-cutout-random.keras 0.8820 0.7950 0.1451 0.4656
aug-cutout-white.keras 0.8734 0.7883 0.1451 0.4761
cutout-white.keras 0.8700 0.7703 0.1463 0.5244
baseline.keras 0.8684 0.7781 0.1523 0.4827
cutout-black.keras 0.8669 0.7911 0.1537 0.4989
cutout-random.keras 0.8642 0.7774 0.1526 0.5241
aug-standard.keras 0.8616 0.8025 0.1576 0.5719

Each row is the released checkpoint's single run on its own 150-pair FaceForensics++ test split. The paper reports three-run means and standard deviations. The checkpoints use different random splits, so these rows do not form a controlled head-to-head ranking.

Four detectors attend to different regions of the same real face

Research and limits

The UBMK 2026 paper by Mert Kaya and Venera Adanova is accepted, with no DOI yet. Its results average three runs per setting; the table above reports the released checkpoints' single runs. A ninth setting, aug-intense, is in the paper but its checkpoint was lost. Research code and full metrics | MSc thesis.

Training uses 1,000 real/fake FaceForensics++ pairs. On 398 unseen DFDC videos, AUC drops to 0.60 to 0.66, and most fakes pass as real. DFDC evaluation. Performance across age, sex and skin tone was not measured. A score alone cannot establish whether a video is authentic or justify a decision about a person.

The released weights are float32 copies of mixed-float16 training runs. For evaluation in the original GPU precision, use xdfdet.load_model(name, mixed_precision=True).

Training details

The study pairs 1,000 real FaceForensics++ videos with one manipulated version each, rotating FaceSwap, Face2Face, FaceShifter and Deepfakes. Each run uses a 70/15/15 split. MTCNN detects and aligns faces. The pipeline samples 32 frames per video and uses 12 per training sample.

Cutout uses an SSIM map to locate a region where the manipulated frame resembles its real source, then fills a landmark polygon covering 2% to 5% of the frame with black, white or random pixels. Real frames receive a small star-shaped cutout with the same fill. Each cutout is applied with probability 0.5. Albumentations adds noise, blur, colour shifts, flips and small rotations at standard or intense probability levels.

Each detector uses ImageNet-initialized EfficientNet-B4 per frame, global average pooling, dropout 0.55 (0.25 for aug-cutout-random), a sigmoid output and L2 regularization of 1e-3. Binary cross-entropy is computed on the frame-averaged prediction. Optimization uses Adam with cosine decay from 1e-3 over 1,000 steps, gradient clipping at 1.0, batches of four pairs and early stopping on validation loss with patience five, for at most 20 epochs. Training used TensorFlow 2.19 and Keras 3.10 on a Colab T4 in mixed precision.

Cutout on fake frames follows the approach from the winning Deepfake Detection Challenge solution. The paired cutout on real frames prevents a blank region alone from identifying a fake. Grad-CAM analysis groups activation into eight facial regions.

Limitations

  • The models were trained and tested on FaceForensics++. Expect lower accuracy on other datasets, newer manipulation methods and heavily compressed video.
  • Each setting used its own random split. A shared-split re-score would measure a different experiment.
  • Cross-dataset DFDC AUC is 0.60 to 0.66 on 398 videos, and most fake videos pass as real.
  • Performance across age, sex and skin tone was not measured.
  • A detector score cannot establish authenticity or justify a decision about a person on its own.

License and citation

Weights: CC BY-NC 4.0, for non-commercial research and education under the FaceForensics++ terms. Code: MIT.

Cite the paper and thesis
@inproceedings{kaya2026augmentation,
  title     = {Augmentation and Cutout in Deepfake Detection: A Comparative Study of
               Accuracy, Calibration, and Attention},
  author    = {Kaya, Mert and Adanova, Venera},
  booktitle = {11th International Conference on Computer Science and Engineering (UBMK 2026)},
  year      = {2026},
  note      = {To appear}
}

@mastersthesis{kaya2025xdfdet,
  title  = {Explainable Deepfake Detection Using Frame Level CNN Models:
            A Comparative Study of Augmentation and Cutout Techniques},
  author = {Kaya, Mert},
  school = {TED University},
  year   = {2025},
  doi    = {10.5281/zenodo.18998566}
}

Project and demonstrations | Kaggle weights and quickstart.

An Eschatia Labs project. Mert Kaya.

Downloads last month
755
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using mertkayacs/xdfdet 1

Collections including mertkayacs/xdfdet