PATCHOUT: Adversarial Patch Detection and Localization using Semantic Consistency

Dominic Simon, Sumit Jha, Rickard EwetzNeural Process. Lett 2025

Abstract

Adversarial patches represent a critical vulnerability in computer vision systems, where localized, high-contrast "stickers" can force a model to misclassify an image. Traditional defenses focus on low-level pixel anomalies, which are easily bypassed by sophisticated or adaptive attacks. We introduce PATCHOUT, a novel defense framework that shifts the focus to "semantic consistency"—the logical relationship between a model's top predictions. By analyzing high-level conceptual contradictions, PATCHOUT achieves over 90% detection accuracy and significantly outperforms existing defenses against both standard and adaptive attacks.

Introduction

Adversarial patches are localized perturbations designed to be physically realizable. Unlike global adversarial noise, patches can be printed and placed in the real world to deceive autonomous systems. Current defense strategies typically search for "signatures" of an attack, such as high-intensity pixels or jagged gradients. However, these methods are often brittle; attackers can create "weaker" patches with subtle textures that achieve the same goal without triggering low-level alarms. PATCHOUT addresses this by identifying the fundamental semantic gap: most defenses ignore the meaning of what the model is seeing.

Methodology

The PATCHOUT framework operates in three distinct stages: detection, localization, and restoration.

1. Detection via Class Consistency

The core insight of PATCHOUT is that for benign images, a model’s top predictions are usually semantically related (e.g., "paddlewheel" and "fireboat"). In contrast, an attacked image often yields wildly disparate predictions (e.g., "elephant" and "boat"). PATCHOUT employs a lightweight, five-layer neural network to analyze output logits and determine if the predicted classes are semantically consistent. This approach is orthogonal to gradient-based detectors and proves more robust against varied attack types.

2. Localization via Segment Selection

Once an attack is detected, the system must isolate the patch. Rather than pixel-level analysis, PATCHOUT utilizes the Segment Anything Model (SAM) to generate a coarse-grained segmentation of the image. It then applies Attribution Analysis (using Guided Backpropagation and SmoothGrad) to identify which segment contributes most significantly to the model's incorrect decision. By setting a high confidence threshold in SAM, adversarial patches typically fall into a single, independent segment, simplifying the localization process.

3. Restoration via Inpainting

After identifying the malicious segment, it is removed. To restore the image and allow the classifier to recover the true label, the framework uses DeepGIN, a generative inpainting network. DeepGIN fills the removed area with pixels that match the surrounding context, effectively neutralizing the patch's influence.

Figure 1: (a) An adversarial patch applied to an airplane image. (b) The image after PATCHOUT localization and generative inpainting.

Experimental Evaluation

The framework was evaluated on the ImageNet dataset against four major patch attack types: LaVAN, GDPA, AP, and TPA.

Key Results

  • High Detection Accuracy: PATCHOUT detects a broad range of patches with over 90% accuracy, outperforming state-of-the-art defenses like PatchCleanser and SAC by approximately 20%.
  • Localization Precision: The framework achieved Intersection over Union (IOU) scores between 0.80 and 0.99 for noise-based patches.
  • Robustness to Adaptive Attacks: In white-box scenarios where the attacker is aware of the defense, PATCHOUT reduced the success rate of adaptive attacks from 56% to 24%.
  • Generalization: A detector trained on one patch type (LaVAN) successfully detected unseen attacks (GDPA and AP), demonstrating that the "semantic inconsistency" signature is universal across different generation methods.

Discussion and Limitations

While highly effective, PATCHOUT has a significant computational footprint. The framework requires multiple model calls—including initial detection, 25 passes for SmoothGrad attribution, SAM segmentation, and generative inpainting—making it currently unsuitable for real-time edge applications. Additionally, the localization logic is optimized for single-patch scenarios; performance degrades as the number of patches increases. Future work will focus on extending this semantic consistency approach to object detection and improving computational efficiency.

Conclusion

PATCHOUT demonstrates that high-level semantic logic is a powerful tool for defending against adversarial attacks. By moving beyond pixel-level signatures, the framework provides a more robust and generalizable defense against the evolving landscape of adversarial patches.

Summary updated

BibTeX
@article{simon2025patchout,
  author = {Dominic Simon and Sumit Jha and Rickard Ewetz},
  title = {{PATCHOUT: Adversarial Patch Detection and Localization using Semantic Consistency}},
  journal = {Neural Process. Lett.},
  year = {2025},
  doi = {10.1007/s11063-025-11775-5},
}
Figure