BadPatch: Diffusion-Based Generation of Physical Adversarial Patches

Zhixiang Wang, Guangnan Ye, Xiaosen Wang · DOI

Abstract

Physical adversarial patches printed on clothing can enable individuals to evade person detectors, but most existing methods prioritize attack effectiveness over stealthiness, resulting in aesthetically unpleasing patches. While generative adversarial networks and diffusion models can produce more natural-looking patches, they often fail to balance stealthiness with attack effectiveness and lack flexibility for user customization. To address these limitations, we propose BadPatch, a novel diffusion-based framework for generating customizable and naturalistic adversarial patches. Our approach allows users to start from a reference image (rather than random noise) and incorporates masks to create patches of various shapes, not limited to squares. To preserve the original semantics during the diffusion process, we employ Null-text inversion to map random noise samples to a single input image and generate patches through Incomplete Diffusion Optimization (IDO). Our method achieves attack performance comparable to state-of-the-art non-naturalistic patches while maintaining a natural appearance. Using BadPatch, we construct AdvT-shirt-1K, the first physical adversarial T-shirt dataset comprising over a thousand images captured in diverse scenarios. AdvT-shirt-1K can serve as a useful dataset for training or testing future defense methods.

Introduction: The Stealthiness Gap in Adversarial Attacks

Adversarial patches are physical artifacts designed to deceive computer vision models. In the context of person detection, wearing such a patch can render a person "invisible" to automated surveillance systems. However, a significant "stealthiness gap" exists in current research. Most existing patches consist of garbled, high-contrast noise or abstract patterns that are immediately conspicuous to human observers.

While some attempts have been made to use Generative Adversarial Networks (GANs) to create more naturalistic patches, these often suffer from reduced attack potency or a lack of user control over the final appearance. BadPatch addresses these challenges by leveraging the generative power of Stable Diffusion to create patches that are not only highly effective at evading detectors like YOLO and Faster R-CNN but are also customizable and visually indistinguishable from standard graphic prints.

Methodology: Leveraging Stable Diffusion for Stealth

BadPatch moves away from the standard "noise-to-image" pipeline of diffusion models, introducing three core technical pillars to balance effectiveness with aesthetic preservation:

1. Incomplete Diffusion Optimization (IDO)

Rather than optimizing the entire 50-step diffusion process, which is computationally intensive and can degrade the image's original meaning, the authors identify a "sweet spot" at the intermediate stage ($T/2$). By mapping a reference image to an intermediate latent state ($z_{T/2}$) and applying adversarial perturbations there, the model retains the core semantics of the image while allowing sufficient flexibility to inject adversarial features during the final denoising steps.

2. Null-text Inversion and Semantic Preservation

To ensure the generated patch precisely matches the user's chosen reference image, BadPatch employs Null-text inversion. This technique optimizes unconditional text embeddings to achieve near-perfect reconstruction of the original image before adversarial training begins. This ensures that the adversarial "noise" is integrated into the natural textures of the image—such as the fur of an animal—rather than appearing as an obvious overlay.

3. IoU-Detection Loss and Shape Control

Standard adversarial losses often target only the most confident detection box. BadPatch introduces a loss function based on Intersection over Union (IoU) that accounts for multiple detected boxes simultaneously, leading to more stable training. Furthermore, the framework supports target mask control, allowing for irregular patch shapes (e.g., animal silhouettes) that blend more naturally into clothing than traditional square patches.

Datasets: Introducing AdvT-shirt-1K

A major contribution of this work is the creation of AdvT-shirt-1K, the first large-scale physical adversarial T-shirt dataset. It consists of 1,131 annotated images featuring 20 participants wearing T-shirts with 9 unique BadPatch designs. These images were captured in diverse real-world environments to test the robustness of the attack.

AdvT-shirt-1K dataset examples across various real-world environments.

Key Results and Physical World Success

BadPatch demonstrates superior performance across both digital and physical evaluations:

  • High Attack Success Rate: The method achieved a 79.1% Attack Success Rate (ASR) against YOLOv4-tiny, significantly outperforming previous naturalistic methods like AdvYOLO by approximately 10%.
  • Robust Transferability: Patches optimized for one architecture (e.g., YOLOv4) remained effective when tested against black-box models like Faster R-CNN and DETR.
  • Real-World Effectiveness: In physical testing, the patches successfully blinded YOLOv5s detectors across various lighting conditions, distances, and camera angles.
A person wearing a BadPatch (right) evades detection, while a standard person (left) is correctly identified.

Conclusion and Future Directions

BadPatch represents a significant advancement in creating stealthy physical adversarial attacks. By utilizing intermediate-stage diffusion optimization, the framework produces patches that are both aesthetically pleasing and functionally potent. While the "Digital-to-Physical" gap remains a challenge due to printing artifacts and fabric textures, the introduction of the AdvT-shirt-1K dataset provides a vital resource for the community to develop more robust detection and defense mechanisms against these increasingly sophisticated deceptions.

Summary updated

BibTeX
@misc{wang2024badpatch,
  author = {Zhixiang Wang and Guangnan Ye and Xiaosen Wang},
  title = {{BadPatch: Diffusion-Based Generation of Physical Adversarial Patches}},
  year = {2024},
  eprint = {2412.01440},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.01440},
}
Figure