Learning on Gradients: Generalized Artifacts Representation for GAN-Generated Images Detection

Chuangchuang Tan, Yao Zhao, Shikui Wei, Guanghua Gu, Yunchao Wei

Abstract

Generative Adversarial Networks (GANs) have reached a level of sophistication where their outputs are often indistinguishable from real photographs. However, existing detection methods frequently fail to generalize to "unseen" GAN architectures or image categories. This paper introduces Learning on Gradients (LGrad), a novel framework that shifts the detection focus from raw pixels to the gradients of a pre-trained CNN. By utilizing these gradients as a generalized artifact representation, LGrad achieves a significant 11.4% improvement in mean accuracy over previous state-of-the-art methods in cross-model and cross-category detection tasks.

Introduction

The rapid advancement of GANs poses significant risks regarding digital forgery and misinformation. While detectors can be trained to recognize specific GAN "fingerprints," they often suffer from poor generalization. A detector trained on ProGAN-generated faces, for instance, may fail when tasked with identifying StyleGAN-generated landscapes. This paper addresses the core challenge of cross-domain generalization by proposing a transformation-model-driven approach rather than a purely data-driven one.

Methodology: Learning on Gradients

The LGrad framework operates on the principle that a fixed, pre-trained model will "react" differently to the subtle structural artifacts present in GAN-generated images compared to real ones.

The LGrad framework pipeline for training and testing stages.

The process involves three main steps:

  1. Transformation Model: A fixed, pre-trained CNN (e.g., ResNet-50 or a GAN discriminator) is used as a "lens" through which images are viewed.
  2. Gradient Extraction: Instead of using the model's output directly, the framework calculates the gradient of the model's response with respect to the input pixels. This effectively filters out semantic content (the "what") and emphasizes structural artifacts (the "how").
  3. Classification: A simple binary classifier is trained on these normalized gradient maps to distinguish between real and fake images.

Key Insights and Results

The shift to gradient-based analysis allows the detector to focus on unnatural pixel relationships that generative models leave behind, which are often invisible in the raw pixel domain or frequency spectra.

Visualization of input images and their corresponding gradient maps across different GAN architectures.

Performance Highlights

  • State-of-the-Art Accuracy: LGrad outperforms FrePGAN, a leading frequency-based method, by 11.4% in mean accuracy across various test sets.
  • Cross-Model Generalization: When trained solely on ProGAN, the LGrad detector achieved 99.4% accuracy on StyleGAN and 99.2% on StyleGAN2.
  • Cross-Category Robustness: A model trained only on "fake horses" successfully detected fake airplanes, bicycles, and birds, achieving an average accuracy of 87.8% across 20 diverse categories.

Conclusion and Future Work

LGrad demonstrates that gradients of pre-trained models provide a robust, generalized representation of GAN artifacts. While highly effective against GAN-based up-sampling artifacts, the method currently struggles with Deepfakes that utilize blending techniques rather than pure generative up-sampling. Future research will focus on extending this framework to non-GAN generative models, such as diffusion models, and improving robustness against heavy JPEG compression and noise.

Summary updated

BibTeX
@inproceedings{tan2023learning,
  author = {Chuangchuang Tan and Yao Zhao and Shikui Wei and Guanghua Gu and Yunchao Wei},
  title = {{Learning on Gradients: Generalized Artifacts Representation for GAN-Generated Images Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  doi = {10.1109/cvpr52729.2023.01165},
}
Figure