Towards Universal GAN Image Detection

Davide Cozzolino, Diego Gragnaniello, Giovanni Poggi, Luisa Verdoliva

Abstract

Recent advances in Generative Adversarial Networks (GANs) have made it increasingly difficult for humans to distinguish synthetic images from real ones. This paper presents a robust, universal GAN image detector designed to generalize across diverse architectures and remain effective under common image impairments like compression and resizing. By leveraging contrastive learning and preserving high-frequency spatial features, the proposed method achieves state-of-the-art performance with a stable decision threshold across multiple unseen GAN models.

Introduction: The Challenge of Synthetic Imagery

Generative Adversarial Networks (GANs) have reached a level of sophistication where untrained human observers can no longer reliably identify synthetic content, often performing at chance levels (50% accuracy). While forensic tools have been developed, they typically struggle with two major issues: the "generalization gap"—where a detector trained on one GAN fails on another—and "image impairments"—where social media processing (resizing, JPEG compression) erases the subtle digital fingerprints used for detection. Furthermore, most existing detectors require model-specific decision thresholds, making them impractical for real-world scenarios where the source of an image is unknown.

High-fidelity synthetic images, like this face, are now virtually indistinguishable from real photographs to the human eye.

Methodology

The proposed solution utilizes a modified ResNet50 architecture focused on two key technical innovations:

Preserving High-Frequency Traces

Standard convolutional neural networks (CNNs) typically employ striding in the initial layers to reduce computational load. However, this process discards high-frequency information. By removing the initial stride, the network retains access to the minute, high-frequency artifacts characteristic of GAN generation processes.

Robust Training Strategy

The model is trained in two stages:

  1. Contrastive Learning: A self-supervised pre-training phase where the model learns to associate different augmented versions of the same image. This forces the network to develop features invariant to common distortions like blurring or compression.
  2. Supervised Fine-Tuning: The pre-trained backbone is then fine-tuned on a labeled dataset (real vs. fake) to perform binary classification.

During both stages, intense data augmentation (JPEG compression, Gaussian blur, color jittering, and CutOut) is applied to ensure the learned features are robust rather than brittle.

Experimental Setup and Datasets

The model was trained exclusively on a dataset of 724,000 images (half real from LSUN, half fake from ProGAN). To evaluate its "universal" capabilities, it was tested against a wide array of architectures it had never encountered during training, including StyleGAN, StyleGAN2, BigGAN, CycleGAN, StarGAN, RelGAN, and GauGAN.

The evaluation benchmark includes a diverse range of categories (cars, bicycles, horses, faces, cats, churches) across various GAN architectures to test universal generalization.

Results and Discussion

The proposed method demonstrates exceptional generalization and robustness:

  • Generalization: It achieved an average AUC of 0.997 and 95.6% accuracy across all unseen GAN architectures.
  • Threshold Stability: Unlike previous methods that require shifting thresholds for different GANs, this model produces stable scores, allowing a single fixed threshold to be used universally.
  • Social Media Robustness: The detector maintains high accuracy even after aggressive JPEG compression and resizing, conditions that typically cause competing methods to fail.
  • Forensic Reliability: At a strict 1% false alarm rate, the model maintains a 93.4% detection rate, significantly outperforming the previous state-of-the-art (79.6%).

Conclusion

By prioritizing high-frequency feature preservation and utilizing contrastive learning for distortion invariance, this research moves closer to a truly universal forensic tool for synthetic image detection. While the system is robust against standard image processing, future work will address resilience against intentional adversarial attacks designed to deceive detectors.

Summary updated

BibTeX
@inproceedings{cozzolino2021towards,
  author = {Davide Cozzolino and Diego Gragnaniello and Giovanni Poggi and Luisa Verdoliva},
  title = {{Towards Universal GAN Image Detection}},
  booktitle = {VCIP},
  year = {2021},
  doi = {10.1109/vcip53242.2021.9675329},
}
Figure