MESAM: Enhancing SAM2 for Few-Shot Segmentation through Semantic-Visual Memory Generation and Refinement

Tianyu Zou, Shengwu Xiong, Rui Wu, Ruilin Yao, Yi Rong
11/6/2026
cs.CV

Official code: tianyu-zou/MESAM (1 star, Python, Apache-2.0, last commit 2026-07-23).

Abstract

This paper investigates how to leverage the powerful capabilities of the Segment Anything Model 2 (SAM2) to tackle few-shot segmentation (FSS) tasks. One major challenge lies in the substantial appearance differences between the support and query images, which may diminish the effectiveness of the memory-matching process in SAM2.

Show full abstract

Through systematic analysis, we find that the memory generated based on the categorical semantic information is robust to this appearance divergence and is more compatible with SAM2. Based on these observations, we propose a new Memory-Enhanced SAM2 (MESAM) method, which first introduces a Semantic-Visual Memory Generation (SVMG) module to separately construct a query semantic memory, a query foreground visual memory, and a support adaptive visual memory. Then, in our designed Interactive Semantic Memory Refinement (ISMR) module, we further enrich the obtained semantic memory with fine-grained visual details, and suppress its misatcivated background responses. Extensive experiments on the PASCAL-$5^i$, COCO-$20^i$, and LVIS-$92^i$ datasets demonstrate that MESAM consistently outperforms existing FSS methods, achieving new state-of-the-art segmentation performance. Our source code is available at: \href{https://github.com/tianyu-zou/MESAM}{https://github.com/tianyu-zou/MESAM}.

View on arXivView PDF

Code Implementations(1)

tianyu-zou/MESAMOfficial100%
Apache-2.0

MESAM: Enhancing SAM2 for Few-Shot Segmentation through Semantic-Visual Memory Generation and Refinement (ACM MM'26)

10Python, CudaJul 23, 20264 months agoApache-2.0

Similar Papers

Cite this paper

@article{zou2026mesam,
  title  = {MESAM: Enhancing SAM2 for Few-Shot Segmentation through Semantic-Visual Memory Generation and Refinement},
  author = {Tianyu Zou and Shengwu Xiong and Rui Wu and Ruilin Yao and Yi Rong},
  year   = {2026},
  eprint = {2611.08943},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.08943v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.08943.svg)](https://codeofpaper.com/paper/2611.08943)

Discussion