SANSA: Unleashing the Hidden Semantics in SAM2 for Few-Shot Segmentation

Abstract

Few-shot segmentation aims to segment unseen categories from just a handful of annotated examples. This requires mechanisms to identify semantically related objects across images and accurately produce masks. We note that Segment Anything 2 (SAM2), with its prompt-and-propagate mechanism, provides strong segmentation capabilities and a built-in feature matching process. However, we show that its representations are entangled with task-specific cues optimized for object tracking, which impairs its use for tasks requiring higher level semantic understanding. Our key insight is that, despite its class-agnostic pretraining, SAM2 already encodes rich semantic structure in its features. We propose SANSA (Semantically AligNed Segment Anything 2), a framework that makes this latent structure explicit, and repurposes SAM2 for few-shot segmentation through minimal task-specific modifications. SANSA achieves state-of-the-art on few-shot segmentation benchmarks designed to assess generalization and outperforms generalist methods in the popular in-context setting. Additionally, it supports flexible promptable interaction via points, boxes, or scribbles, and remains significantly faster and more compact than prior approaches. Code at: https://github.com/ClaudiaCuttano/SANSA.

Cite

Text

Cuttano et al. "SANSA: Unleashing the Hidden Semantics in SAM2 for Few-Shot Segmentation." Advances in Neural Information Processing Systems, 2025.

Markdown

[Cuttano et al. "SANSA: Unleashing the Hidden Semantics in SAM2 for Few-Shot Segmentation." Advances in Neural Information Processing Systems, 2025.](https://mlanthology.org/neurips/2025/cuttano2025neurips-sansa/)

BibTeX

@inproceedings{cuttano2025neurips-sansa,
  title     = {{SANSA: Unleashing the Hidden Semantics in SAM2 for Few-Shot Segmentation}},
  author    = {Cuttano, Claudia and Trivigno, Gabriele and Averta, Giuseppe and Masone, Carlo},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2025},
  url       = {https://mlanthology.org/neurips/2025/cuttano2025neurips-sansa/}
}