Table of Contents
Fetching ...

DIRE for Diffusion-Generated Image Detection

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

TL;DR

This work tackles the challenge of detecting diffusion-generated images, where existing detectors struggle to generalize to unseen diffusion models.It introduces DIffusion REconstruction Error (DIRE), a reconstruction-error based image representation obtained by inverting and reconstructing images with a pre-trained diffusion model, and trains a binary classifier on DIRE to differentiate real from generated images.A new benchmark, DiffusionForensics, encompasses eight diffusion models across LSUN-Bedroom and ImageNet, enabling evaluation of detectors on unseen diffusion models and perturbations.Empirical results show DIRE substantially outperforms prior detectors, achieving near-perfect accuracy and precision in many settings and demonstrating robustness to common degradations, thereby offering a practical baseline for diffusion-generated image detection.

Abstract

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.

DIRE for Diffusion-Generated Image Detection

TL;DR

This work tackles the challenge of detecting diffusion-generated images, where existing detectors struggle to generalize to unseen diffusion models.It introduces DIffusion REconstruction Error (DIRE), a reconstruction-error based image representation obtained by inverting and reconstructing images with a pre-trained diffusion model, and trains a binary classifier on DIRE to differentiate real from generated images.A new benchmark, DiffusionForensics, encompasses eight diffusion models across LSUN-Bedroom and ImageNet, enabling evaluation of detectors on unseen diffusion models and perturbations.Empirical results show DIRE substantially outperforms prior detectors, achieving near-perfect accuracy and precision in many settings and demonstrating robustness to common degradations, thereby offering a practical baseline for diffusion-generated image detection.

Abstract

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.
Paper Structure (18 sections, 14 equations, 10 figures, 6 tables)

This paper contains 18 sections, 14 equations, 10 figures, 6 tables.

Figures (10)

  • Figure 1: The DIRE representation of a real image and four generated images from diffusion models: DDPM DDPM, iDDPM iDDPM, ADM ADM, and PNDM PNDM, respectively. The DIREs of real images tend to have larger values compared to diffusion-generated images.
  • Figure 2: Illustration of the difference between a real sample and a generated sample from the DIRE perspective.$p_g(\mathbf{x})$ represents the distribution of generated images while $p_{r}(x)$ represents the distribution of real images. $\mathbf{x}_g$ and $\mathbf{x}_r$ represent a generated sample and a real sample, respectively. Using the inversion and reconstruction process of DDIM DDIM, $\mathbf{x}_g$ and $\mathbf{x}_r$ become $\mathbf{x}'_g$ and $\mathbf{x}'_r$, respectively. After the reconstruction, $\mathbf{x}'_r$ is actually within the $p_g(\mathbf{x})$, which leads to a noticeably different DIRE in real samples compared to generated samples.
  • Figure 3: Illustration of the process of computing DIRE given an input image $\mathbf{x}_0$. The input image $\mathbf{x}_0$ is first gradually inverted into a noise image $\mathbf{x}_T$ by DDIM inversion DDIM, and then is denoised step by step until getting a reconstruction $\mathbf{x}'_0$. DIRE is simply defined as the residual image got from $\mathbf{x}_0$ and $\mathbf{x}'_0$.
  • Figure 4: Robustness to unseen perturbations. The top rows show the robustness to Gaussian blur, and the bottom rows show the robustness to JPEG compression. * denotes our reproduction training on the ADM subset of DiffusionForensics with AP (%) reported for robustness comparison.
  • Figure 5: Noise pattern and frequency analysis of DIRE of real and generated images. Noise pattern is regular to portray the shape of objects in DIRE of real images, while it is messy in DIRE of diffusion-generated images. For frequency analysis, the frequency bands in DIRE of real images are more abundant than that of diffusion-generated images, i.e., the white regions in the frequency domain are larger.
  • ...and 5 more figures