ForgeryTTT: Zero-Shot Image Manipulation Localization with Test-Time Training

Weihuang Liu, Xi Shen, Chi-Man Pun, Xiaodong CunarXiv 2024 · DOI

Abstract

Image manipulation localization remains a challenging task due to the rapid evolution of forgery techniques and the inherent domain shift between training and real-world data. We present ForgeryTTT, the first framework to apply Test-Time Training (TTT) to this domain. By fine-tuning a model on individual test images via a self-supervised classification task, ForgeryTTT achieves a 20.1% improvement in localization accuracy over existing zero-shot methods, even outperforming state-of-the-art supervised models.

Introduction

Detecting image forgeries is a persistent challenge. While deep learning models can identify specific traces of splicing or copy-pasting, they often fail when encountering new manipulation techniques or different camera sensors. This brittleness stems from the impossibility of creating a truly exhaustive dataset of all possible forgeries, particularly with the emergence of sophisticated generative AI.

Most existing models are static, applying the same learned weights to every test image. ForgeryTTT shifts this paradigm by proposing that a model should adapt to the specific characteristics of the image it is currently analyzing.

Methodology

ForgeryTTT utilizes a multi-task framework that combines pixel-level localization with a self-supervised classification task. The process is divided into two primary stages.

The Two-Stage Process

  1. Training-Time Training: The model, built on a Swin Transformer encoder, is pre-trained on the massive synthetic SynCOCO dataset. It learns to generate forgery masks and classify image "tokens" as either manipulated or authentic.
  2. Test-Time Training (TTT): Upon receiving a new test image, the model predicts an initial coarse mask. Using this mask, image tokens are partitioned into "manipulated" and "authentic" sets. The model then undergoes a few iterations of gradient descent to fine-tune its encoder, optimizing its ability to distinguish between these two groups. The final localization is performed by this adapted model.
Overview of the ForgeryTTT framework showing training-time training, test-time training, and inference stages.

Technical Innovations

To ensure efficiency and robustness, the authors introduced several key features:

  • Mask-based Token Dropout: Redundant tokens are randomly dropped during TTT, reducing computational load and acting as a regularizer to prevent overfitting to noise.
  • One-to-Batch Query Generation (TTT-OBQG): Instead of requiring multiple image augmentations, ForgeryTTT processes the image once and constructs a "batch" of different token subsets. This speeds up adaptation by 4.8x, bringing the overhead down to approximately 260ms per frame.

Key Results

The framework was evaluated across five standard benchmarks: CASIA, Coverage, Columbia, NIST16, and CocoGlide. The latter is particularly significant as it contains images manipulated via diffusion-based generative AI.

ForgeryTTT demonstrated remarkable performance, achieving a 20.1% improvement in F1 score ($F_{fix}$) compared to other zero-shot methods. Furthermore, it outperformed the previous state-of-the-art supervised method, UnionFormer, by 4.3% on average across all benchmarks. On the CocoGlide dataset, ForgeryTTT surpassed the next best method by nearly 20% in balanced accuracy, highlighting its efficacy against modern AI-generated fakes.

Qualitative comparison of localization results with and without the ForgeryTTT adaptation.

Discussion and Future Work

The core insight of ForgeryTTT is that global-local consistency serves as a powerful signal for forgery detection. If a model cannot globally distinguish between the "fake" and "real" pixels it has identified, its local boundaries are likely inaccurate. TTT enforces this consistency on-the-fly.

While highly effective, the model's performance can still degrade under extreme conditions like heavy Gaussian blur or severe JPEG compression. Future research may explore incorporating more diverse data augmentations during the TTT phase and extending the framework to other forensic tasks such as video forgery and deepfake detection.

Summary updated

BibTeX
@misc{liu2024forgeryttt,
  author = {Weihuang Liu and Xi Shen and Chi-Man Pun and Xiaodong Cun},
  title = {{ForgeryTTT: Zero-Shot Image Manipulation Localization with Test-Time Training}},
  year = {2024},
  eprint = {2410.04032},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.04032},
}
Figure