DiffForensics: Leveraging Diffusion Prior to Image Forgery Detection and Localization

Zeqin Yu, Jiangqun Ni, Yuzhen Lin, Haoyi Deng, Bin Li

Abstract

Image Forgery Detection and Localization (IFDL) faces significant challenges due to the increasing sophistication of AI-driven editing tools. We present DiffForensics, a novel two-stage framework that leverages the structural priors of diffusion models to identify "mesoscopic" anomalies—subtle structural traces left by both manual and AI-generated manipulations. By employing a denoising pretext task with spatially correlated Simplex noise and a frozen semantic encoder, DiffForensics bridges the gap between high-level semantic context and low-level noise patterns. Our method achieves state-of-the-art performance across multiple benchmarks, demonstrating superior accuracy and robustness to common post-processing operations.

Introduction: The Mesoscopic Challenge

Traditional forensic methods typically operate at two extremes: microscopic analysis of pixel-level artifacts (e.g., sensor noise) or macroscopic analysis of high-level semantic inconsistencies. While microscopic methods are precise, they are easily defeated by "social media laundering" (resizing and re-compression). Macroscopic methods are robust but often lack the granularity required for precise localization.

DiffForensics targets the "mesoscopic" middle ground—intermediate structural properties and noise patterns. The goal is to build a model that integrates semantic understanding with subtle structural cues without sacrificing one for the other.

Methodology

The DiffForensics framework consists of two primary stages: self-supervised pre-training and multi-task fine-tuning.

The two-stage DiffForensics architecture: Stage 1 involves denoising diffusion pre-training with a frozen encoder, while Stage 2 focuses on multi-task fine-tuning for detection and localization.

Stage 1: Denoising Diffusion Pre-training

The model utilizes a Denoising Diffusion Probabilistic Model (DDPM) as a pretext task. A key design choice is the use of a frozen semantic encoder (SegFormer pre-trained on ADE20K), ensuring the model retains macroscopic knowledge of object structures.

A critical innovation in this stage is the replacement of standard Gaussian noise with Simplex noise. Unlike Gaussian noise, Simplex noise is spatially correlated, creating "blob-like" structures. This forces the decoder to learn how to reconstruct structured regions, making it significantly more sensitive to the boundaries and shapes characteristic of forged patches.

Comparison of Simplex and Gaussian noise in the diffusion process. Simplex noise creates structured anomalies that better mimic the mesoscopic traces of actual forgeries compared to spatially independent Gaussian noise.

Stage 2: Multi-task Fine-tuning

The pre-trained model is fine-tuned on labeled forgery datasets to perform both binary classification (detection) and pixel-level masking (localization). To further refine localization, an Edge Cue Enhancement Module (ECEM) is introduced, which computes multi-scale gradients in the decoder to highlight the sharp "seams" often found at the edges of tampered regions.

Evaluation and Results

DiffForensics was evaluated on a wide range of benchmarks, including traditional forgery datasets (CASIA, Columbia, NIST16) and AI-generated (DGM) datasets (AutoSplicing, OpenForensics).

Performance Metrics

The model demonstrated significant improvements over state-of-the-art (SOTA) methods like HiFi-Net and PSCC-Net:

  • Localization: Achieved an average F1 score of 0.466 and an AUC of 0.862 across eight datasets.
  • Detection: Reached the highest average AUC (0.916) and the lowest Equal Error Rate (EER of 0.131).
  • Robustness: The focus on mesoscopic structures allows the model to maintain high performance even after JPEG compression or Gaussian blurring, common operations that typically degrade microscopic forensic features.

Conclusion

DiffForensics effectively leverages diffusion priors to bridge the gap between semantic and structural forensic analysis. By utilizing Simplex noise in a self-supervised denoising task, the model learns to identify the subtle structural traces of image manipulation. This approach provides a robust and accurate solution for detecting both traditional and AI-generated forgeries, setting a new standard for the IFDL task.

Summary updated

BibTeX
@inproceedings{yu2024diffforensics,
  author = {Zeqin Yu and Jiangqun Ni and Yuzhen Lin and Haoyi Deng and Bin Li},
  title = {{DiffForensics: Leveraging Diffusion Prior to Image Forgery Detection and Localization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  doi = {10.1109/cvpr52733.2024.01213},
}
Figure