PatchHead: Learning Spatial Patch Evidence for Generalizable AI-Generated Image Detection

2026-08-10Computer Vision and Pattern Recognition

Computer Vision and Pattern Recognition
AI summary

The authors found that existing AI detectors struggle to recognize AI-generated images when tested on new data because they rely on a single global summary of image features. They created PatchHead, a method that keeps the spatial layout of image parts intact and combines nearby information to better spot AI-generated traces. By only updating a small part of the model during training, PatchHead improved detection accuracy across many different datasets. Their analysis shows that PatchHead helps the model focus more on subtle signs of fakeness spread across the image rather than just important objects. This approach leads to more reliable detection when encountering images from different sources.

AI-generated imagesimage detectorsvision foundation modelsDINOCLS tokenspatial aggregationPatchHeadLoRA adapterscross-dataset generalizationbalanced accuracy
Authors
Shengbo Qi, Hongyi Fang, Benjia Zhou, Rui Mao
Abstract
AI-generated image detectors generalize poorly when their training and test images originate from different generators or datasets. Despite the rich spatial representations produced by vision foundation models like DINO, existing detectors typically classify images using only the globally aggregated CLS token. We hypothesize that globally aggregating DINO features into a single CLS token obscures spatially distributed generation traces. To test this hypothesis, we introduce PatchHead, a lightweight spatial aggregation head that preserves the two-dimensional organization of DINO patch tokens and integrates evidence across neighboring regions. During training, we freeze the pretrained DINO backbone and optimize only the inserted LoRA adapters, PatchHead, and auxiliary projection head. Across nine cross-dataset benchmarks spanning manually curated and in-the-wild settings, PatchHead ranks first on seven datasets and second on the remaining two. It improves the strongest prior method from 91.6% to 94.6% in average balanced accuracy (+3.0 points) and raises the worst-case accuracy from 82.4% to 89.4% (+6.9 points), while introducing only 8.6% more trainable parameters and 0.08% additional FLOPs. Further qualitative analysis suggests that PatchHead (i) reduces class-conditional domain discrepancy, and (ii) redirects the representation from content-dominated saliency toward spatially distributed authenticity evidence. Together, these observations provide a representation-level account of why spatial patch aggregation transfers more reliably across generators and datasets than a single CLS-based global representation. Our code and models will be made available upon acceptance.