arXiv:2610.25641cs.CVOct 2026

Manuscript Offprint

arXiv:2610.25641

Visual Memory and Textual Alignment for Cross-Modal Few-Shot Segmentation

Tianqi Wei, Zhi Chen, Xin Yu, Scott Chapman, Zi Huang

Tianqi Wei 1^{1}, Zhi Chen 2^{2}, Xin Yu 3^{3}, Scott Chapman 1^{1}, and Zi Huang 1^{1}

1^{1} The University of Queensland, Brisbane, Australia

{tianqi.wei,scott.chapman,helen.huang}@uq.edu.au

2^{2} University of Southern Queensland, Toowoomba, Australia

Zhi.Chen@unisq.edu.au

3^{3} Adelaide University, Adelaide, Australia

xin.yu@adelaide.edu.au

Abstract. Few-shot segmentation (FSS) aims to segment target objects with limited annotated examples. Recent studies have begun to explore large foundation models to improve generalization for this task. In particular, SAM 3 provides strong visual representations and supports text-guided segmentation. However, its performance remains limited in specialized domains, where semantic prompts and visual representations are often poorly aligned. To address this challenge, we propose ViTA-SAM, a framework built upon SAM 3 that integrates visual memory and textual features through cross-modal alignment. Specifically, we construct a visual memory module that encodes support features together with their corresponding masks, providing support-aware visual guidance for query prediction. In parallel, we leverage the text encoder of SAM 3 to extract semantic features as complementary priors. To bridge the gap between semantic and visual representations, we introduce a cross-modal alignment module that conditions textual features on memory-enhanced visual representations, yielding more consistent and visually grounded predictions. In addition, we propose a pseudo-label refinement strategy that updates the memory with predicted query masks, enabling query-adaptive representation learning. Extensive experiments on multiple benchmarks show that ViTA-SAM achieves the best overall performance among the compared methods, outperforming the strongest competing method by over 5% in average mIoU.

Keywords: Few-shot segmentation · SAM 3.

1 Introduction

Semantic segmentation is a core task in computer vision and multimedia applications, with broad applications in medical imaging [27], autonomous system [1, 37], and visual content understanding [31, 35]. Recent advances in deep learning, together with the availability of large-scale annotated datasets, have led to substantial progress in segmentation performance [6, 42]. Despite these successes, pixel-wise annotation is still highly labor-intensive and costly, making large-scale

T. Wei et al.

Figure

(a) Limitations of SAM 3

(b) Traditional Methods

(c) Our Method

Fig. 1: (a) Under text prompts, predictions show large deviations from the ground truth, revealing severe semantic–visual misalignment under domain shifts. (b) Traditional FSS methods rely on prototype matching between support and query features. (c) Our method introduces textual representations and performs cross-modal alignment with visual features to provide complementary semantic cues.

dataset construction difficult in practice. Few-shot segmentation (FSS) [28, 29, 34, 38, 39] has therefore attracted increasing attention as a promising alternative. Its goal is to segment target objects from only a few annotated examples.

Conventional FSS methods mainly focus on constructing representative prototypes (Figure 1b). The pioneering work PANet [34] learns class-specific prototypes from support images and segments the query image via pixel-wise matching in the feature space. CANet [39] performs multi-level feature comparison between query features and global support representations. PFENet [32] leverages support-guided prior masks to encode coarse object locations and uses them to alleviate spatial inconsistency between support and query targets. Despite their effectiveness, the visual matching functions learned by these methods are often biased toward the training distribution, limiting their generalization to diverse scenarios. Subsequent methods improve robustness to such distribution variations. For example, PATNet [14] introduces a prototype alignment module to reduce feature discrepancies. DMTNet [4] addresses distribution variations via a dynamic multi-scale mechanism that adaptively weights features based on input characteristics. ABCDFSS [11] performs task-specific feature adaptation at test time, thereby better aligning representations with the current input.

Meanwhile, recent advances in large-scale foundation models, particularly the Segment Anything Model (SAM) family, have opened new opportunities for generalizable segmentation. The original SAM [12] introduces promptable zero-shot segmentation using visual prompts such as points and bounding boxes. SAM 2 [26] extends this capability to video segmentation by incorporating a temporal memory mechanism for consistent mask propagation. More recently, SAM 3 [3] integrates the memory mechanism from SAM 2 and improves vision-language alignment, enabling the use of both visual concepts and textual prompts. However, SAM models are primarily pretrained on natural images, which limits their generalization to specialized domains. As illustrated in Figure 1a, SAM 3 struggles with specialized imagery (e.g., medical or satellite images) and domain-specific concepts (e.g., “keratosis”), suggesting a misalignment between semantic and visual representations that degrades segmentation performance.

Based on these observations, we propose ViTA-SAM, a novel framework built on SAM 3 that aligns visual memory and textual prompts through cross-modal interaction and enables robust knowledge transfer (Figure 1c). Specifically, we leverage the visual memory module to encode support features and their corresponding masks into a memory bank, producing object-aware representations. During inference, the memory is fused with query features to propagate structural and boundary information from support to query. In parallel, we incorporate textual information using the SAM 3 text encoder to extract task-specific semantic features as complementary priors. To bridge the misalignment between semantic and visual representations under domain shifts, we align textual features with memory-enhanced visual features via cross-attention, yielding visually grounded semantic features. Furthermore, we introduce a pseudo-label refinement strategy that uses predicted query masks to update the memory with query features, constructing a query-adaptive memory for progressively refined predictions. During inference, the memory-enhanced visual features and aligned textual features are fused using prediction-confidence-based weights. Overall, the main contributions of this work are as follows:

– We propose ViTA-SAM, a novel framework for few-shot segmentation. It integrates visual memory and textual features through cross-modal alignment, enabling effective knowledge transfer under domain shifts.

– We introduce a cross-modal alignment mechanism that aligns textual and visual representations via cross-attention, producing visually grounded semantic features and improving support-query alignment. A pseudo-label refinement strategy is also used to obtain query-adaptive representations.

– Extensive experiments on four widely used benchmarks demonstrate the effectiveness of our method, which generally outperforms existing approaches.

References (42)