← index
ai security / media forensics · ongoing · research

AI-Based Deepfake Content Detection

AI system for detecting deepfake media content using visual and auditory analysis algorithms to combat media manipulation and verify digital content authenticity.

AIDeepfake DetectionMedia ForensicsComputer Vision

Overview

As deepfake technology becomes more accessible, the need for reliable detection grows. This project develops AI-based methods for identifying manipulated visual and audio content, focusing on both proactive detection and forensic analysis.

Detection Architecture

The system employs a multi-modal detection pipeline that analyses media across three complementary domains to maximise robustness against diverse manipulation techniques:

  • Spatial analysis — A modified XceptionNet backbone pre-trained on ImageNet serves as the primary spatial feature extractor, operating on individual video frames. The architecture replaces the final classification layer with a custom head that outputs per-frame manipulation probabilities. Spatial branch features capture low-level artefacts such as interpolation inconsistencies, colour bleed, and abnormal blending boundaries commonly introduced by generative face-swapping models.

  • Temporal analysis — Frame-level features extracted by the spatial branch are passed through a two-layer bidirectional LSTM with 256 hidden units, capturing inter-frame inconsistencies in blinking patterns, lip-sync timing, and head pose dynamics that single-frame analysis would miss. A temporal attention mechanism weights frame contributions, emphasising segments where manipulation artefacts are most pronounced.

  • Frequency domain analysis — Each frame is transformed via FFT and DCT to expose spectral anomalies. Manipulated content often introduces high-frequency artefacts (GAN checkerboard patterns) or abnormal low-frequency distributions (blurring from face blending). Band-pass energy ratios and spectral coherence metrics are fed through a lightweight fully-connected subnetwork whose outputs are fused with the spatial-temporal stream via learned weighted averaging.

The three branches are fused at the decision level using a gated mixture-of-experts mechanism, producing a unified detection score for each video clip.

Dataset and Training

Models are trained and evaluated on a composite of three benchmark datasets:

  • FaceForensics++ — ~1.8 million frames from 1,000 videos manipulated by FaceSwap, Face2Face, DeepFakes, and NeuralTextures, provided at three compression levels (c0, c23, c40).
  • DFDC (Deepfake Detection Challenge) — ~120,000 videos from 3,426 paid actors, featuring 16 distinct manipulation methods including GAN-based and autoencoder-based generation.
  • Celeb-DF — ~6,200 high-quality deepfake videos with minimal visual artefacts, serving as the primary out-of-distribution generalisation benchmark.

Training Methodology

Training proceeds in two stages. First, the spatial branch is pre-trained on static frames with binary cross-entropy loss. The entire pipeline is then fine-tuned end-to-end on short 16-frame clips using a compound loss function combining focal loss (to address class imbalance — genuine content outnumbers deepfakes 3:1 in the training mix) and a triplet margin loss (to enforce separable embeddings in feature space).

Cross-dataset generalisation is evaluated by training on FaceForensics++ and testing on Celeb-DF without fine-tuning, simulating real-world deployment where the target manipulation type is unknown at training time. To bridge domain gaps, an unsupervised domain adaptation head using maximum mean discrepancy (MMD) alignment is applied in an ablation setting.

Augmentation Strategies

Aggressive data augmentation during training improves robustness to post-processing and compression:

  • Random JPEG compression (quality factor 10–90)
  • Gaussian blur and noise injection
  • Random crops and horizontal flips
  • Colour jitter (brightness, contrast, saturation shifts)
  • Frame dropping and temporal jittering to simulate variable frame-rate inputs

Adversarial Robustness

Deepfake detection systems are vulnerable to adversarial examples — small, imperceptible perturbations crafted to flip the model’s prediction. We evaluate robustness against:

  • FGSM (Fast Gradient Sign Method) — Single-step, gradient-guided perturbation at ε ∈ 0.1 (normalised pixel space).
  • PGD (Projected Gradient Descent) — Iterative multi-step attack with 40 steps, step size α = ε/10, and random restart initialisation.
  • Defensive distillation — The detection model is trained on soft targets produced by a teacher model at temperature T = 10, smoothing the decision boundary and reducing gradient magnitude available to an attacker. Distilled models show 15–22% higher accuracy under PGD-40 attacks compared to undefended baselines at ε = 0.05.

Audio Branch

For audio deepfakes (voice cloning, text-to-speech synthesis), a parallel branch processes the audio track through a pipeline of:

  1. Mel-spectrogram extraction — 128 mel-frequency bins over 46 ms windows with 50% overlap.
  2. 2D CNN — Four convolutional blocks with batch normalisation and max-pooling, operating on the time–frequency representation to capture spectral textures characteristic of vocoder artefacts.
  3. Temporal aggregation — A lightweight GRU layer correlates frame-level audio embeddings across time.

The audio branch output is fused with the visual branch at the score level using a learned logistic regression weighting, enabled only when an audio track is present (clean audio separates spectrogram-based detection accuracy of 91.3% on the ASVspoof 2019 logical-access subset).

Confidence Scoring and Explainability

Every prediction is accompanied by a calibrated confidence score derived via temperature-scaling on a held-out validation set. To make decisions interpretable, the system generates Grad-CAM heatmaps over the final convolutional feature maps of the spatial branch, highlighting regions of the input frame that most influenced the detection decision. These heatmaps consistently localise to facial boundaries, eyes, and mouth regions — the areas most frequently impacted by face-swapping and re-enactment pipelines. Heatmap overlays are returned alongside the prediction for downstream forensic review.

Key Contributions

  • Designed and implemented a multi-modal detection pipeline fusing spatial, temporal, and frequency-domain features for robust deepfake classification
  • Trained and evaluated detection models on standard benchmarks (FaceForensics++, DFDC, Celeb-DF) with rigorous cross-dataset generalisation protocols
  • Evaluated robustness against adversarial perturbations (FGSM, PGD) and applied defensive distillation to improve resilience
  • Built an audio detection branch using mel-spectrogram CNNs for voice deepfake identification
  • Integrated Grad-CAM-based explainability heatmaps and calibrated confidence scores for human-in-the-loop forensic analysis
  • Developed a media authentication pipeline with confidence scoring

Impact

Contributes to the defence against misinformation and media manipulation — critical as generative AI tools become mainstream.