Spectral Distribution Aware Image Generation

Steffen Jung, Margret Keuper

Abstract

Modern Generative Adversarial Networks (GANs) produce visually stunning images that are often indistinguishable from reality to the human eye. However, these models leave distinct "spectral fingerprints" in the frequency domain—high-frequency artifacts that make them easily detectable by forensic algorithms. This paper introduces a lightweight spectral discriminator designed to force generative models to match the true distribution of frequency spectra in real datasets. By utilizing 1D azimuthal integration of the power spectrum, our method significantly reduces artifacts and improves the "stealthiness" of generated images without compromising visual quality.

Introduction: The Spectral Gap

While GANs have mastered spatial realism, researchers have identified a persistent "spectral gap." When viewed through a Fourier transform, generated images often exhibit subtle grid patterns or energy spikes in high-frequency regions. These artifacts primarily originate from common up-sampling techniques, such as "bed of nails" interpolation, used in generator architectures.

Previous attempts to bridge this gap relied on spectral regularization, which penalizes generators for deviating from the average frequency spectrum of a training set. However, this approach is overly restrictive. Real-world images do not share a single monolithic spectrum; they exhibit a diverse distribution. Forcing every generated image toward a single mean can lead to training instability and suboptimal visual results.

Methodology: Frequency Discrimination

To address the limitations of mean-based regularization, we propose a dual-discriminator framework. In addition to the standard spatial discriminator ($D_S$) that evaluates pixel-level realism, we introduce a Frequency Discriminator ($D_F$).

Spectral Transformation and Integration

The process begins by transforming input images (both real and generated) into the frequency domain using a Discrete Fourier Transform (DFT). To maintain a lightweight architecture, we avoid processing the full 2D spectrum. Instead, we compute an azimuthal integral, which integrates the 2D power spectrum over various radii to produce a 1D power profile. This captures the energy distribution across frequencies while drastically reducing dimensionality.

Spectral clusters in the FFHQ dataset, demonstrating the diversity of frequency profiles that a single mean fails to capture.

Adversarial Learning

The $D_F$ component is a simple, fully connected network that learns to distinguish between the 1D spectral profiles of real and fake images. By treating the frequency domain as a distribution to be learned rather than a fixed target, the generator is incentivized to produce the natural variety of spectral profiles found in real data. This modular approach is compatible with various GAN losses, including DCGAN, LSGAN, and WGAN-GP.

Experimental Setup and Datasets

Our method was evaluated primarily using the FFHQ (Flickr-Faces-HQ) dataset, which contains high-quality human face images. Testing spanned multiple resolutions, from $64^2$ to $256^2$, and included fine-tuning a state-of-the-art StyleGAN2 model at $1024^2$.

High-quality sample from the FFHQ dataset used for training and evaluation.

Key Results

Artifact Reduction and Stealth

The effectiveness of the spectral discriminator was measured using the Spectral Difference (SD) and a new metric called the Cloaking Score (CS). The CS measures how well a simple linear classifier can separate real and fake images based on their frequency profiles; a high CS indicates that generated images are spectrally indistinguishable from real ones.

  • Quantitative Improvements: For a DCGAN at $64^2$ resolution, the SD dropped from 1.293 to 0.042.
  • Fooling Detectors: Images generated with $D_F$ proved significantly harder for state-of-the-art fake image detectors to identify. In several tests, detection accuracy plummeted from near 100% to approximately 50%, effectively reducing the detector to random guessing.
  • StyleGAN2 Integration: Even in the highly optimized StyleGAN2 architecture, the addition of $D_F$ reduced spectral artifacts by a factor of five.

Maintaining Visual Quality

Crucially, these spectral improvements did not come at the cost of visual realism. The Fréchet Inception Distance (FID), the standard metric for image quality, remained stable or showed slight improvements across our experiments, confirming that the spectral discriminator does not interfere with the spatial learning process.

Conclusion and Future Work

By shifting the focus from matching spectral means to matching spectral distributions, we have developed a highly efficient method for eliminating GAN artifacts. The 1D azimuthal integral approach adds negligible computational overhead—adding only $n/\sqrt{2} + 1$ parameters for an image of width $n$.

Future research will explore more complex spectral representations to capture directional frequency information (e.g., horizontal vs. vertical artifacts) that 1D projections might discard. Additionally, we aim to investigate whether this method provides protection against other forensic techniques, such as those analyzing local pixel statistics or sensor noise patterns.

Summary updated

BibTeX
@inproceedings{jung2021spectral,
  author = {Steffen Jung and Margret Keuper},
  title = {{Spectral Distribution Aware Image Generation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i2.16267},
}
Figure