NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

PatchZero: Defending against Adversarial Patch Attacks by Detecting and Zeroing the Patch

Ke Xu, Yao Xiao, Zhaoheng Zheng, Kaijie Cai, Ram Nevatia

Introduction

Adversarial patch attacks represent a significant security threat to computer vision systems. Unlike traditional adversarial perturbations that affect the entire image, patch attacks are localized, highly textured "stickers" that can be physically applied to objects in the real world. These attacks can mislead neural networks into misclassifying objects or failing to detect them entirely, posing risks to autonomous systems and security infrastructure.

Existing defenses often require task-specific architectures, prior knowledge of patch dimensions, or computationally expensive retraining of the entire vision model. PatchZero introduces a general-purpose, "plug-and-play" defense pipeline that detects adversarial pixels at the granular level and "zeros them out" before they reach the downstream model, maintaining robustness without sacrificing efficiency.

Methodology: Detect and Neutralize

The PatchZero pipeline operates on a simple yet effective principle: identify the malicious region and remove its influence before it can affect the decision-making process.

Pixel-level Detection

The system employs a segmentation network (specifically PSPNet) trained to act as a patch detector. It exploits the observation that adversarial patches typically exhibit high-frequency textures and color distributions that are distinct from natural image features. The detector generates a binary mask identifying the suspected adversarial pixels.

An adversarial patch causes an object detector to misidentify a bicycle as a chair.

Zeroing Out and Dilation

Once the patch region is identified, the pixels are "zeroed out"—replaced with the mean pixel value of the dataset. To prevent "pixel leaking," where adversarial signals at the patch boundary remain undetected, the system applies morphological dilation to slightly enlarge the detected mask, ensuring the entire malicious signal is neutralized.

By detecting and masking the adversarial patch, PatchZero restores the model's ability to correctly detect the bicycle.

Differentiable Defense and Adversarial Training

To maintain robustness against white-box attackers who utilize gradient information, the defense must be differentiable. PatchZero uses Backward Pass Differential Approximation (BPDA), substituting the non-differentiable binary mask with a Sigmoid function during backpropagation.

The defense is further hardened through a two-stage adversarial training scheme. In the first stage, the detector learns to identify standard attacks. In the second stage, it undergoes an "attacker-defender race" against adaptive attacks that specifically attempt to bypass both the detector and the downstream classifier simultaneously.

Evaluation and Results

PatchZero was evaluated across multiple tasks, including image classification (ImageNet, RESISC-45), object detection (PASCAL VOC), and video classification (UCF101).

  • Superior Robustness: On ImageNet, PatchZero significantly outperformed certified defenses like PatchGuard and PatchCleanser by up to 26% and 13%, respectively, under specific attack conditions.
  • Efficiency: The system is approximately 60x faster than exhaustive masking techniques and requires roughly half the GPU memory, making it highly viable for real-time deployment.
  • Generalization: PatchZero demonstrates strong transferability; a detector trained on square patches can effectively identify and neutralize patches of various shapes, such as diamonds or octagons, without a loss in benign accuracy.

Conclusion

PatchZero provides a robust, efficient, and model-agnostic defense against adversarial stickers. By decoupling the defense from the downstream task, it allows for the protection of high-performance vision models without the need for costly retraining. While challenges remain regarding precise boundary detection and potential occlusion of critical object features, PatchZero sets a new standard for practical adversarial defense in computer vision.

Summary updated

BibTeX
@inproceedings{xu2023patchzero,
  author = {Ke Xu and Yao Xiao and Zhaoheng Zheng and Kaijie Cai and Ram Nevatia},
  title = {{PatchZero: Defending against Adversarial Patch Attacks by Detecting and Zeroing the Patch}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2023},
  url = {https://openreview.net/forum?id=bLCqj1CmnK},
}
Figure