Region-Guided Attack on the Segment Anything Model (SAM)

Xiaoliang Liu, Furao Shen, Jian Zhao

Abstract

The Segment Anything Model (SAM) is a cornerstone of image segmentation, demonstrating exceptional performance across various applications, particularly in autonomous driving and medical imaging, where precise segmentation is crucial. However, SAM is vulnerable to adversarial attacks that can significantly impair its functionality through minor input perturbations. Traditional techniques, such as FGSM and PGD, are often ineffective in segmentation tasks due to their reliance on global perturbations that overlook spatial nuances. Recent methods like Attack-SAM-K and UAD have begun to address these challenges, but they frequently depend on external cues and do not fully leverage the structural interdependencies within segmentation processes. This limitation underscores the need for a novel adversarial strategy that exploits the unique characteristics of segmentation tasks. In response, we introduce the Region-Guided Attack (RGA), designed specifically for SAM. RGA utilizes a Region-Guided Map (RGM) to manipulate segmented regions, enabling targeted perturbations that fragment large segments and expand smaller ones, resulting in erroneous outputs from SAM. Our experiments demonstrate that RGA achieves high success rates in both white-box and black-box scenarios, emphasizing the need for robust defenses against such sophisticated attacks. RGA not only reveals SAM's vulnerabilities but also lays the groundwork for developing more resilient defenses against adversarial threats in image segmentation.

Introduction

The Segment Anything Model (SAM) has emerged as a foundational tool in computer vision, lauded for its zero-shot generalization and ability to segment virtually any object via simple prompts. However, its integration into safety-critical domains like autonomous driving and medical diagnostics necessitates a rigorous evaluation of its security. While adversarial attacks—imperceptible perturbations designed to deceive AI—are well-documented in image classification, they often struggle in the context of segmentation.

Traditional adversarial methods, such as the Fast Gradient Sign Method (FGSM), typically apply global noise that ignores the spatial relationships between pixels. Furthermore, existing attacks tailored for SAM often rely on specific external prompts or fail to generalize across different model architectures. This research addresses this gap by introducing the Region-Guided Attack (RGA), a strategy that exploits the structural logic of the segmentation task itself to create devastating and transferable adversarial examples.

Methodology

The Region-Guided Attack (RGA) operates through a systematic three-step pipeline designed to disrupt the spatial coherence of SAM's output.

The Segment Anything Model (SAM) architecture, featuring the image encoder, prompt encoder, and mask decoder.
  1. Initial Query: The process begins by querying SAM with a clean image to establish "ground truth" segmentation regions.
  2. Region-Guided Map (RGM) Generation: Utilizing a novel Segmentation and Dilation (SAD) strategy, the attack generates a "malicious blueprint." Large regions are subdivided into a grid to force the model to perceive a single object as fragmented, unrelated parts. Conversely, small regions are dilated, compelling the model to expand minor details into large, erroneous segments.
  3. Optimization: RGA employs gradient-based optimization to identify the minimal image perturbation required to shift SAM’s internal feature representations from the original image toward the malicious RGM blueprint.

To enhance transferability in black-box scenarios, the optimization process incorporates 2D transformations (such as random scaling and rotation) and scale-invariant strategies. The effectiveness of RGA was evaluated using a subset of the SAM-1B dataset, comprising 1,000 images and approximately 98,875 individual masks.

Key Insights and Results

The primary innovation of RGA lies in its structural exploitation. Rather than attempting to change an object's class (e.g., turning a "car" into a "tree"), RGA destroys the model's sense of spatial coherence. By shattering a road segment or bloating a small artifact, the attack renders the segmentation output useless for downstream tasks like navigation. Notably, RGA is prompt-agnostic; by targeting the image encoder directly, the attack remains effective regardless of whether the user provides a point, box, or text prompt.

Experimental results demonstrate that RGA consistently outperforms state-of-the-art baselines like UAD and PATA++:

  • mIoU (Mean Intersection over Union): On the SAM-B model, RGA reduced the mIoU to 26.64%, significantly lower than the 51.53% achieved by the strongest baseline (UAD).
  • Attack Success Rate (ASR@50): RGA achieved a 72.08% success rate in white-box settings.
  • Black-Box Transferability: When attacking the FastSAM architecture, RGA achieved a 96.91% success rate, indicating that it exploits fundamental vulnerabilities in regional information processing common across different segmentation models.

Conclusion and Future Work

While RGA proves highly effective, the authors identify areas for further refinement. The current SAD strategy utilizes binary transformations that may struggle with complex, multi-layered scenes involving overlapping tissues. Future research will explore hierarchical perturbation strategies to address these complexities. Additionally, while RGA excels at regional fragmentation, optimizing it for subtle, high-precision boundary shifts remains a goal for applications like satellite imagery analysis.

Ultimately, the Region-Guided Attack underscores the necessity of moving beyond simple noise-based defenses. As models like SAM become integral to real-world systems, developing defenses robust against structured, region-aware manipulations is paramount.

Summary updated

Abstract

The Segment Anything Model (SAM) is a cornerstone of image segmentation, demonstrating exceptional performance across various applications, particularly in autonomous driving and medical imaging, where precise segmentation is crucial. However, SAM is vulnerable to adversarial attacks that can significantly impair its functionality through minor input perturbations. Traditional techniques, such as FGSM and PGD, are often ineffective in segmentation tasks due to their reliance on global perturbations that overlook spatial nuances. Recent methods like Attack-SAM-K and UAD have begun to address these challenges, but they frequently depend on external cues and do not fully leverage the structural interdependencies within segmentation processes. This limitation underscores the need for a novel adversarial strategy that exploits the unique characteristics of segmentation tasks. In response, we introduce the Region-Guided Attack (RGA), designed specifically for SAM. RGA utilizes a Region-Guided Map (RGM) to manipulate segmented regions, enabling targeted perturbations that fragment large segments and expand smaller ones, resulting in erroneous outputs from SAM. Our experiments demonstrate that RGA achieves high success rates in both white-box and black-box scenarios, emphasizing the need for robust defenses against such sophisticated attacks. RGA not only reveals SAM's vulnerabilities but also lays the groundwork for developing more resilient defenses against adversarial threats in image segmentation.
BibTeX
@misc{liu2024region,
  author = {Xiaoliang Liu and Furao Shen and Jian Zhao},
  title = {{Region-Guided Attack on the Segment Anything Model (SAM)}},
  year = {2024},
  eprint = {2411.02974},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.02974},
}

Loading related content...

Figure