Source-linked AI summary

DIRE for Diffusion-Generated Image Detection

Zhendong Wang, Jianmin Bao, Wengang Zhou, Weilun Wang, Hezhen Hu, Hong Chen, Houqiang Li

arXiv:2303.09295v1cs.CV

TL;DR

Diffusion-generated images are difficult for existing detectors to distinguish, especially across unseen models. The paper introduces DIRE, a reconstruction-error representation, and reports strong generalization and state-of-the-art detection performance on a benchmark spanning eight diffusion models.

  • Problem

    Existing detectors and naïve CNN classifiers have limited performance or generalization when detecting diffusion-generated images, particularly from unseen models.

  • Method

    DIRE represents the difference between an input image and its reconstruction after diffusion-model inversion and denoising, using a pretrained diffusion model.

  • Results

    DIRE achieves strong diffusion-generated detection performance, including generalization to unseen models and robustness to perturbations, while exceeding competitive state-of-the-art detectors.

  • Takeaways & Limitations

    Diffusion reconstruction error provides an effective representation for distinguishing real images from diffusion-generated images across a broad benchmark.

Abstract

from arXiv · show

Diffusion models have shown remarkable success in visual synthesis, but have also raised concerns about potential abuse for malicious purposes. In this paper, we seek to build a detector for telling apart real images from diffusion-generated images. We find that existing detectors struggle to detect images generated by diffusion models, even if we include generated images from a specific diffusion model in their training data. To address this issue, we propose a novel image representation called DIffusion Reconstruction Error (DIRE), which measures the error between an input image and its reconstruction counterpart by a pre-trained diffusion model. We observe that diffusion-generated images can be approximately reconstructed by a diffusion model while real images cannot. It provides a hint that DIRE can serve as a bridge to distinguish generated and real images. DIRE provides an effective way to detect images generated by most diffusion models, and it is general for detecting generated images from unseen diffusion models and robust to various perturbations. Furthermore, we establish a comprehensive diffusion-generated benchmark including images generated by eight diffusion models to evaluate the performance of diffusion-generated image detectors. Extensive experiments on our collected benchmark demonstrate that DIRE exhibits superiority over previous generated-image detectors. The code and dataset are available at https://github.com/ZhendongWang6/DIRE.

1. Introduction

Diffusion-generated images create an urgent need for detectors that generalize beyond known models, because conventional detectors perform poorly on diffusion outputs. DIRE addresses this gap by comparing an image with its reconstruction by a pretrained diffusion model.

  • Diffusion models raise privacy and deepfake concerns, creating an urgent demand for diffusion-generated image detectors.
  • Existing generated-image detectors are ineffective for diffusion outputs, while naïve CNN classifiers generalize poorly to unseen diffusion models.
  • DIRE measures the difference between an input image and its reconstruction after inversion to noise and denoising by a pretrained diffusion model.
  • Generated images tend to have relatively low DIRE because they and their reconstructions belong to the same distribution, whereas real images tend to have higher DIRE.
  • A binary classifier trained on DIRE can detect diffusion-generated images and generalize to unseen diffusion models.
  • DiffusionForensics benchmarks detection using images from eight diffusion models spanning unconditional, conditional, and text-to-image generation.
  • Experiments report high accuracy, average precision, generalization to unseen models, robustness to perturbations, and performance exceeding competitive state-of-the-art detectors.

2. Related Work

Related work covers diffusion-model advances and established generated-image detectors based on spatial, frequency, and learned features. The paper identifies a gap in general and robust detection across diffusion models.

  • Diffusion research has advanced architectures, sampling speed, downstream applications, and text-to-image generation.
  • Earlier generated-image detectors used hand-crafted color, saturation, blending, and co-occurrence features, as well as CNN classifiers.
  • Frequency-based methods target artifacts associated mainly with upsampling in earlier GAN-generated images and can simulate such artifacts for training.
  • A general and robust detector for diffusion-generated images had not been explored, motivating detection across a wide range of diffusion models.

3. Method

DIRE detects diffusion-generated images by comparing an input with its reconstruction from a pre-trained diffusion model. The method uses inversion, denoising reconstruction, and a classifier trained on reconstruction-error representations, evaluated with the DiffusionForensics dataset.

  • DIRE: DIRE measures the difference between an input image and its reconstruction by a pre-trained diffusion model.The representation is based on the observation that generated images are reconstructed more accurately than real images.
  • Evaluation dataset: DiffusionForensics contains real and generated images spanning LSUN-Bedroom and ImageNet, with unconditional, conditional, and text2image categories.The dataset includes corresponding reconstructed and DIRE images and is designed for comprehensive detector evaluation.
  • Reconstruction process: An input image is inverted into Gaussian noise and then denoised step by step to produce a reconstruction x′.DDIM inversion maps x0 to xT, after which the DDIM generation process reconstructs the image.
  • DIRE: The DIRE representation is the residual image between x0 and x′, computed using inversion I(·) followed by reconstruction R(·).The absolute difference is defined as DIRE(x0) = |x0 − R(I(x0))|.
  • Detection: A binary classifier is trained with binary crossentropy on DIRE representations and classifies source images as real or generated at inference.Inference first reconstructs the image to obtain DIRE, then supplies it to the classifier.

4. Experiment

Experiments on DiffusionForensics compare DIRE with existing detectors and test its generalization, robustness, and design choices. DIRE performs strongly on unseen generators and perturbations, with additional analyses examining inversion steps, input representations, and residual calculation.

  • Comparison to existing detectors: Existing detectors achieve ACC below 60% on diffusion-generated images, while DIRE reaches 99.9% ACC and 100% AP on average across diffusion models.Retraining prior detectors on ADM improves performance for ADM images but remains unsatisfactory on unseen diffusion models.
  • Generalization capability: 98.6% ACC and 100% AP are achieved when iDDPM generates training images and ADM reconstructs them, demonstrating generalization across generation models.DIRE also performs strongly when StyleGAN supplies the generated images.
  • Cross-dataset evaluation: 90.2% ACC and 97.9% AP are obtained in cross-dataset testing when training uses ADM and iDDPM images, while StyleGAN reaches 94.4% AP.Training uses LSUN-Bedroom images and testing uses ImageNet images.
  • Unseen text-to-image generation: 97.2% ACC and 99.8% AP are achieved on unseen Stable Diffusion v1 text-to-image images by a detector trained on ADM images.The Stable Diffusion images are generated from ImageNet class labels.
  • Ablation and robustness analysis: More DDIM inversion steps improve DIRE detection, while DIRE outperforms RGB, reconstructed images, and RGB&DIRE combinations as the detection input.Twenty steps are selected by default for computational reasons, and absolute residuals improve SD-v1 from 87.0%/93.0% to 99.7%/100% ACC/AP.

5. Conclusion

The paper presents DIRE as a reconstruction-error representation for generalizable diffusion-generated image detection and introduces DiffusionForensics for evaluation. Experiments indicate that DIRE provides a strong detector and baseline for this task.

  • DIRE represents reconstruction errors from images inverted and reconstructed by DDIM to detect diffusion-generated images.
  • DiffusionForensics contains unconditional, conditional, and text-to-image diffusion-model images for evaluating diffusion-generated image detectors.
  • Extensive experiments indicate that DIRE contributes to a strong and effective diffusion-generated image detector.
  • The authors position the work as a solid baseline for diffusion-generated image detection.

A. More Details of DiffusionForensics

The DiffusionForensics dataset combines real images from LSUN-Bedroom and ImageNet with generated images produced using multiple diffusion-model pipelines and sampling configurations.

  • Real images in the dataset’s LSUN-Bedroom and ImageNet subsets come from the corresponding source datasets.
  • DIREs for real and generated images are produced with an unconditional ADM model pretrained on LSUN-Bedroom and a DDIM scheduler using 20 steps.
  • The dataset includes LSUN-Bedroom generated images from PNDM, Latent Diffusion, and Stable Diffusion v1 pipelines.
  • ImageNet-ADM uses a pretrained conditional ADM model with DDIM sampling for 50 steps and divides images 8:1:1 into training, validation, and testing.
  • ImageNet-SD-v1 generates images from prompts of the form “A photo of {class}” across 1,000 ImageNet classes.

B. More Explanation of DIRE

The DIRE explanation attributes nonzero reconstruction errors to finite-step approximation in DDIM’s diffusion processes. This approximation produces larger deviations for real images than for diffusion-generated images.

  • DIRE reconstruction errors are explained through DDIM’s approximation of ordinary differential equation solving.
  • When the total number of diffusion steps is sufficiently large, the DDIM reconstruction update can be viewed as Euler integration for an ODE.
  • DDIM inversion proceeds as the reverse of the deterministic reconstruction process.
  • Finite-step approximation introduces deviation because the number of steps is not infinitely large.
  • The approximation deviation is more prominent for real images because their characteristics are more complex, producing the key DIRE signal.

C. More Visualization About DIRE

Visualizations compare source images, reconstructions, and DIREs for real images and images generated by several diffusion models. Across these examples, real-image DIREs tend to have larger values than generated-image DIREs.

  • The visualizations compare source images, corresponding reconstructions, and DIRE representations.
  • Real images tend to produce larger DIRE values than diffusion-generated images in the visualized examples.
  • Figure 6 compares real images with DDPM- and iDDPM-generated images pretrained on LSUN-Bedroom.
  • Figures 7–10 visualize DIREs from ADM, PNDM, Stable Diffusion v1 and v2, Latent Diffusion, VQ-Diffusion, and ImageNet-conditioned examples.
Loading 2303.09295v1…