CNN and Transformer-coordinated deepfake detection

Ying Li, Shan Bian, Chuntao Wang, Wei LuJournal of Image and Graphics 2023

Deepfakes are becoming increasingly sophisticated, making them harder to distinguish from reality. While Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) have both shown promise in detecting these forgeries, they often struggle with two real-world hurdles: the heavy computational cost of training and a dramatic loss in accuracy when videos are compressed (as they usually are on social media) or come from a different source than the training data.

In this paper, researchers from South China Agricultural University and Sun Yat-sen University propose a hybrid model that combines the local texture-capturing power of CNNs with the global relationship-modeling of Transformers to create a more robust and efficient detector.

TL;DR

The authors present a dual-branch hybrid model that uses EfficientNet for local feature extraction and a Transformer for global context, specifically targeting the "accuracy drop" seen in compressed videos. By analyzing both spatial (RGB) and frequency domains and using a novel attention-guided data augmentation strategy, they achieved state-of-the-art results on compressed datasets while significantly reducing training time.

What Problem Does This Paper Address?

Most deepfake detection research happens in "clean" environments with high-quality video. However, in the real world, videos uploaded to platforms like WeChat or TikTok undergo heavy compression, which wipes out the subtle pixel-level artifacts that CNNs rely on.

Furthermore, CNNs have a limited "receptive field"—they are great at looking at local textures but struggle to understand the relationship between distant parts of a face. Conversely, Transformers are great at global context but are computationally expensive and require massive amounts of data. This paper aims to bridge that gap, creating a model that is both efficient and "compression-proof."

Methods

The researchers developed a joint detection model with several key innovations:

  1. Dual-Branch Feature Extraction:
    • Spatial Branch: Uses a truncated EfficientNet-B0 to extract RGB features. Crucially, they embed an attention module in the shallow layers to capture low-level forgery artifacts (like unnatural skin textures) before they are lost in deeper semantic layers.
  2. Frequency Branch: Since compression destroys spatial details but often leaves frequency-domain "fingerprints," this branch uses Discrete Cosine Transform (DCT) and learnable filters to identify anomalies in the frequency spectrum.
  3. Transformer-Based Fusion: Instead of simple concatenation, the features from both branches are fed into a Transformer Encoder to model global dependencies across the face. A Cross-Attention mechanism is used to allow the spatial and frequency features to "talk" to each other, reinforcing the detection signal.
  4. Attention-Guided Data Augmentation: To train the model to handle low-quality video, they designed a strategy that uses the model's own attention maps to apply random blurring to the most "suspicious" regions during training, forcing the model to find more robust features.
  5. Efficiency: By using only the first 15 blocks of EfficientNet and a modified Transformer structure, the model is much lighter than many competitors.

Datasets

The model was evaluated on two primary benchmarks:

  • FaceForensics++ (FF++): Includes four types of forgeries (Deepfakes, Face2Face, FaceSwap, and NeuralTextures) at three compression levels (Raw, C23/High Quality, and C40/Low Quality).
  • Celeb-DF: A high-quality dataset used primarily for cross-dataset evaluation (training on FF++ and testing on Celeb-DF) to measure how well the model generalizes to unseen forgery techniques.

Key Insights and Ideas

  • Shallow Attention Matters: Most models put attention at the end. This paper argues that for deepfakes, the "smoking gun" is often in the shallow, high-resolution texture features.
  • Frequency is the Safety Net: When spatial pixels are blurred by JPEG compression, the frequency domain often retains the underlying mathematical traces of the generative model used to create the fake.
  • Hybrid is Faster: By using the CNN as a "pre-processor" for the Transformer, the authors reduced training time by roughly 82% compared to other high-performing models like MADD, without sacrificing accuracy.

Key Results

The hybrid model outperformed nine state-of-the-art methods in challenging cross-compression scenarios:

  • Cross-Compression Accuracy (C23 to C40): On the difficult C40 (low quality) version of FaceForensics++, the model achieved 90.35% accuracy for Deepfakes and 81.78% for FaceSwap, significantly higher than previous benchmarks.
  • Cross-Dataset Generalization: When trained on FF++ and tested on the entirely different Celeb-DF dataset, the model achieved an AUC of 67.81%, outperforming specialized models like M2TR (65.7%) and F3-Net (65.2%).
  • Computational Efficiency: The model's training time per epoch was approximately 1,240 seconds, compared to 6,802 seconds for the MADD model on the same hardware.

Limitations and Future Work

The authors note that while their model excels at generalization and handling low-quality video, its "in-dataset" performance (testing on the same high-quality distribution it was trained on) is slightly lower than some "heavyweight" models. This is a trade-off for the speed and efficiency gained by using a truncated backbone.

Future Work: The team plans to explore more aggressive data augmentation (like random erasing) and more complex feature interaction layers to further improve the model's ability to catch "perfect" high-resolution forgeries.

Summary updated

Abstract

目的深度伪造视频检测是目前计算机视觉领域的热点研究问题。卷积神经网络和Vision Transformer(ViT)都是深度伪造检测模型中的基础结构,二者虽各有优势,但都面临训练和测试阶段耗时较长、跨压缩场景精度显著下降问题。针对这两类模型各自的优缺点,以及不同域特征在检测场景下的适用性,提出了一种高效的CNN(convolutional neural network)结合Transformer的联合模型。方法设计基于EfficientNet的空间域特征提取分支及频率域特征提取分支,以丰富单分支的特征表示。之后与Transformer的编码器结构、交叉注意力结构进行连接,对全局区域间特征相关性进行建模。针对跨压缩、跨库场景下深度伪造检测模型精度下降问题,设计注意力机制及嵌入方式,结合数据增广策略,提高模型在跨压缩率、跨库场景下的鲁棒性。结果在FaceForensics++的4个数据集上与其他9种方法进行跨压缩率的精度比较,在交叉压缩率检测实验中,本文方法对Deepfake、Face2Face和Neural Textures伪造图像的检测准确率分别达到90.35%、71.79%和80.71%,优于对比算法。在跨数据集的实验中,本文模型同样优于其他方法,并且同设备训练耗时大幅缩减。结论本文提出的联合模型综合了卷积神经网络和Vision Transformer的优点,利用了不同域特征的检测特性及注意力机制和数据增强机制,改善了深度伪造检测在跨压缩、跨库检测时的效果,使模型更加准确且高效。
BibTeX
@article{li2023cnn,
  author = {Ying Li and Shan Bian and Chuntao Wang and Wei Lu},
  title = {{CNN and Transformer-coordinated deepfake detection}},
  journal = {Journal of Image and Graphics},
  year = {2023},
  doi = {10.11834/jig.220519},
}
Figure