Attack-Aware Deepfake Detection under Counter-Forensic Manipulations

A dual-stream forensic detector that couples worst-of-K adversarial exposure with auditable spatial evidence, remaining reliable after compression, resampling, regraining, relighting, and platform transcoding.

Noor Fatima1 in  ·  Hasan Faraz Khan1 in  ·  Muzammil Behzad1,2,* in

1King Fahd University of Petroleum & Minerals, Saudi Arabia
2SDAIA-KFUPM Joint Research Center for Artificial Intelligence, Saudi Arabia

Attack-aware dual-stream detector architecture
Attack-aware dual-stream architecture. Semantic and residual features are fused for classification and weak localization; worst-of-K transformations operate during training, and randomized views are aggregated at inference.
Primary result0.9917Worst-case accuracy at the validation-selected operating point
Matched attacks1.0000ROC AUC across clean and all six attacked splits
Controlled run0.9542Worst-attack accuracy at threshold 0.5
Localization0.4988Mean IoU@0.3 across five full-system runs

Abstract

Forensics that survives the edit

The rapid proliferation of AI-generated and manipulated visual content requires forensic detectors that remain reliable after routine processing and deliberate counter-forensic modification. This work presents an attack-aware deepfake detector that combines pretrained semantic features with fixed forensic residual responses through a lightweight fusion module and produces weakly supervised spatial evidence maps. During training, a worst-of-K strategy selects the most damaging transformation from sampled JPEG compression, resampling, regraining, seam processing, color adjustment, and transcoding operations. At inference, predictions from low-cost randomized views are aggregated to reduce sensitivity to processing variations while preserving localized evidence. Five independently seeded runs, controlled component analyses, and matched ResNet-50 and Xception comparisons assess stability and robustness. The experiments identify worst-of-K exposure as the main contributor to counter-forensic operating robustness, while the semantic stream provides the strongest standalone representation and the residual stream remains independently predictive. The resulting heatmaps indicate where forensic evidence is concentrated without requiring pixel-accurate manipulation masks.

Method

Built for the attack surface

The detector separates semantic understanding from manipulation-sensitive residual evidence, then trains on whichever sampled transformation is most damaging to the current mini-batch.

01

Semantic content

An ImageNet-pretrained ResNet-50 captures facial structure and high-level content.

02

Forensic residuals

Five fixed high-pass kernels expose low-level traces through a 15-channel residual tensor.

03

Worst-of-K

The candidate attack with the largest mean batch classification loss supplies the optimization view.

04

Auditable evidence

An FPN-style mask head and randomized aggregation retain localized forensic responses.

Quantitative evidence

Robustness, stability, and attribution

Use the tabs to inspect threshold-free robustness, five-run variation, component analysis, and matched baseline comparisons. All values are those reported in the manuscript.

Threshold-free performance on matched clean and attacked splits. Lower ECE is better.
ConditionROC AUCAverage precisionECE ↓Brier ↓NLL ↓
Clean1.00001.00000.00080.00000.0008
JPEG1.00001.00000.00390.00430.0176
Warp1.00001.00000.00130.00000.0013
Regrain1.00001.00000.01960.03940.1361
Seam1.00001.00000.00070.00000.0007
Gamma1.00001.00000.00070.00000.0007
Transcode1.00001.00000.00180.00010.0018

Visual evidence

Inspect the decision, not just the score

Weakly supervised heatmaps reveal where forensic evidence concentrates. They support auditing without claiming pixel-accurate manipulation boundaries.

Reproduce

From clone to evaluation

The repository separates data acquisition, training, and robustness evaluation while keeping the model and optimization logic faithful to the supplied implementation.

bash
git clone https://github.com/BRAIN-Lab-AI/Attack-Aware-Deepfake-Detection.git
cd Attack-Aware-Deepfake-Detection

conda create -n deepfake-detection python=3.10 -y
conda activate deepfake-detection
pip install -r requirements.txt
pip install -e . --no-deps

python scripts/download_data.py --mode FAST --data-root data
python scripts/train.py --mode FAST --data-root data --output-dir outputs
python scripts/evaluate.py outputs/model.pt --mode FAST --data-root data