cs.CVNov 23, 2026

Segment Anything In-Context via Visual Demonstrations

Authors: Yuzhu Wang, Manni Duan, Hongliang Ye, Shu Kong

Abstract

We present the Segment Anything Model via Visual Demonstrations (SAYD), a foundation model for in-context segmentation. Given visual demos comprising prompt images and their segmentation masks, SAYD segments coherent regions (e.g., objects or their parts) in a query image by establishing visual correspondences between the prompts and the query. SAYD generalizes to previously-unseen segmentation tasks, including those requiring tacit visual knowledge or involving concepts that are difficult to articulate unambiguously in language. We train SAYD on 12 public datasets originally curated for panoptic segmentation using our proposed techniques, including a lightweight mask decoder for prompt-agnostic mask generation and a learning mechanism for recognizing novel query classes absent in the prompts. These innovations enhance both computational efficiency and out-of-domain generalization. Consequently, SAYD significantly outperforms existing methods of in-context segmentation and open-vocabulary segmentation across 24 out-of-domain benchmarks, spanning natural, biological, ecological, cosmological, medical, pathological, and satellite imagery.

Figures & tables

Appendix figures & tables9 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Prompting Diffusion Models for Zero-Shot Instance Segmentation

    Jun 21, 2026Irem Zeynep Alagöz, Nils Morbitzer, Andrea Ramazzina +3Interactive Image SegmentationInstance Segmentation

  2. SegRAG: Retrieval Augmented Spatial Prompting for Open Vocabulary Semantic Segmentation

    May 17, 2026Abderrahmene Boudiaf, Irfan Hussain, Sajid JavedImage SegmentationPromptable Image Segmentation

  3. LlamaSeg: Image Segmentation via Autoregressive Mask Generation

    May 26, 2025Jiru Deng, Tengjin Weng, Tianyu Yang +3Image SegmentationText-Guided Image Segmentation