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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Cuttano, Claudia, Trivigno, Gabriele, Averta, Giuseppe, Masone, Carlo
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917082477625344
author Cuttano, Claudia
Trivigno, Gabriele
Averta, Giuseppe
Masone, Carlo
author_facet Cuttano, Claudia
Trivigno, Gabriele
Averta, Giuseppe
Masone, Carlo
contents Few-shot segmentation aims to segment unseen object categories from just a handful of annotated examples. This requires mechanisms that can both identify semantically related objects across images and accurately produce segmentation masks. We note that Segment Anything 2 (SAM2), with its prompt-and-propagate mechanism, offers both 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 performance on few-shot segmentation benchmarks specifically designed to assess generalization, outperforms generalist methods in the popular in-context setting, supports various prompts flexible interaction via points, boxes, or scribbles, and remains significantly faster and more compact than prior approaches. Code is available at https://github.com/ClaudiaCuttano/SANSA.
format Preprint
id arxiv_https___arxiv_org_abs_2505_21795
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SANSA: Unleashing the Hidden Semantics in SAM2 for Few-Shot Segmentation
Cuttano, Claudia
Trivigno, Gabriele
Averta, Giuseppe
Masone, Carlo
Computer Vision and Pattern Recognition
Few-shot segmentation aims to segment unseen object categories from just a handful of annotated examples. This requires mechanisms that can both identify semantically related objects across images and accurately produce segmentation masks. We note that Segment Anything 2 (SAM2), with its prompt-and-propagate mechanism, offers both 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 performance on few-shot segmentation benchmarks specifically designed to assess generalization, outperforms generalist methods in the popular in-context setting, supports various prompts flexible interaction via points, boxes, or scribbles, and remains significantly faster and more compact than prior approaches. Code is available at https://github.com/ClaudiaCuttano/SANSA.
title SANSA: Unleashing the Hidden Semantics in SAM2 for Few-Shot Segmentation
topic Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2505.21795