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

Inspiring the Next Generation of Segment Anything Models: Comprehensively Evaluate SAM and SAM 2 with Diverse Prompts Towards Context-Dependent Concepts under Different Scenes

Xiaoqi Zhao, Youwei Pang, Shijie Chang, Yuan Zhao, Lihe Zhang, Huchuan Lu, Jinsong Ouyang, Georges El Fakhri, Xiaofeng Liu · DOI

Abstract

This paper presents the first large-scale, unified evaluation of Segment Anything Models (SAM and SAM 2) specifically focused on "Context-Dependent" (CD) concepts. Unlike traditional "Context-Independent" (CI) objects, CD concepts—such as camouflaged animals, medical lesions, or shadows—are defined by their relationship to their surroundings. By testing across 33 datasets and 11 CD categories, we identify significant performance boundaries and prompt sensitivity in current foundation models. Our findings provide a roadmap for the development of "SAM 3," emphasizing the need for improved contextual reasoning and robustness.

Introduction

The Segment Anything Model (SAM) has revolutionized image segmentation, yet most evaluations focus on Context-Independent (CI) objects. In CI scenarios, an object's identity (e.g., a car or a person) is intrinsic and remains constant regardless of the background. However, many critical real-world tasks involve Context-Dependent (CD) concepts where the definition of the target is inextricably linked to its environment. For instance, visual saliency depends on an object standing out from its specific surroundings, camouflage relies on texture matching with the background, and medical lesions are identified relative to healthy tissue. SAM and SAM 2 were primarily trained on CI data, leaving their performance in complex, context-heavy scenarios like medical imaging and industrial inspection largely underexplored.

Methods

We developed a unified evaluation framework to test SAM and SAM 2 across 2D images, 3D medical volumes, and videos.

Overview of the evaluation framework and CD concepts.

Key methodological innovations include:

  1. Prompting Strategies: We introduced Prediction-Based Propagation for video, using the model's own previous predictions to generate prompts for subsequent frames. For 3D medical scans, we implemented Bidirectional Inference, identifying an "anchor slice" with the largest mask and propagating segmentation forward and backward through the volume.
  2. In-Context Learning (ICL): We evaluated SAM 2’s ability to learn from 20 exemplar image-mask pairs to segment new, unseen images of the same concept.
  3. Prompt Robustness Analysis: To simulate imperfect human input, we applied random perturbations to point, box, and mask prompts to observe performance degradation.

Datasets and Concepts

The study is massive in scope, utilizing 33 datasets covering 11 CD concepts across three domains:

  • Natural Scenes: Salient objects (DUTS, ECSSD), Camouflaged objects (COD10K, NC4K), Shadows (SBU, ISTD), and Transparent objects (Trans10K).
  • Medical Imaging: Polyp lesions (Kvasir, CVC-ClinicDB), Skin lesions (ISIC), Lung infections (COVID-19 CT), Brain tumors (BraTS2020), and Breast lesions (BUSI).
  • Industrial Inspection: Power battery plates (PBD) and Surface anomalies (MVTec-AD, VisA).
Comparison between Context-Independent (CI) and Context-Dependent (CD) concepts.

Key Insights and Results

Our evaluation revealed several critical findings regarding the current state of SAM models:

  • Bounding Box Superiority: Across almost all CD tasks, bounding box prompts significantly outperformed points or "everything" mode. Boxes provide a spatial constraint that helps the model ignore distracting, similar-looking backgrounds—a frequent issue in camouflage and medical tasks.
  • SAM 2 vs. SAM: Surprisingly, SAM 2 is not a strict upgrade for static images. In some single-frame tasks, it performed worse than the original SAM. This suggests that SAM 2’s memory and prompt-attention modules, while excellent for video, can introduce unfavorable inductive bias when temporal context is absent.
  • Temporal Context Advantage: SAM 2 shines in video and 3D. Its ability to maintain temporal consistency allows it to outperform specialized models (like 3D U-Net) in brain tumor segmentation using our bidirectional strategy.
  • The Robustness Gap: SAMs are "brittle." Small shifts in a prompt (just a few pixels) can lead to massive drops in segmentation accuracy. This suggests that while these are foundation models, they still lack the high-level reasoning to understand a concept if the user's "hint" is imperfect.
  • Challenging Targets: Shadows and micro-scale industrial defects remain the hardest tasks. Both models struggled with "non-material" targets like shadows and extremely small irregularities.

Conclusion and Future Outlook

The authors identify several hurdles for the next generation of models (SAM 3). Future research should focus on:

  • Contextual Reasoning: Moving beyond pixel-matching to truly understand the relationship between foreground and background.
  • Multi-modal Prompting: Better integration of text, depth maps, and infrared data to resolve ambiguities in RGB images.
  • Robustness: Developing models that can handle "noisy" or "lazy" prompts from human users without performance collapse.
  • Small/Non-material Objects: Improving architectures to capture extremely small defects or abstract concepts like light and shadow.

Summary updated

BibTeX
@misc{zhao2024inspiring,
  author = {Xiaoqi Zhao and Youwei Pang and Shijie Chang and Yuan Zhao and Lihe Zhang and Huchuan Lu and Jinsong Ouyang and Georges El Fakhri and Xiaofeng Liu},
  title = {{Inspiring the Next Generation of Segment Anything Models: Comprehensively Evaluate SAM and SAM 2 with Diverse Prompts Towards Context-Dependent Concepts under Different Scenes}},
  year = {2024},
  eprint = {2412.01240},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.01240},
}
Figure