MemorySAM: Memorize Modalities and Semantics with Segment Anything Model 2 for Multi-modal Semantic Segmentation

Chenfei Liao, Xu Zheng, Yuanhuiyi Lyu, Haiwei Xue, Yihong Cao, Jiawen Wang, Kailun Yang, Xuming HuarXiv 2025

Abstract

Research has focused on Multi-Modal Semantic Segmentation (MMSS), where pixel-wise predictions are derived from multiple visual modalities captured by diverse sensors. Recently, the large vision model, Segment Anything Model 2 (SAM2), has shown strong zero-shot segmentation performance on both images and videos. When extending SAM2 to MMSS, two issues arise:

  1. How can SAM2 be adapted to multi-modal data?
  2. How can SAM2 better understand semantics? Inspired by cross-frame correlation in videos, we propose to treat multi-modal data as a sequence of frames representing the same scene. Our key idea is to "memorize" the modality-agnostic information and "memorize" the semantics related to the targeted scene. To achieve this, we apply SAM2's memory mechanisms across multi-modal data to capture modality-agnostic features. Meanwhile, to memorize the semantic knowledge, we propose a training-only Semantic Prototype Memory Module (SPMM) to store category-level prototypes across training for facilitating SAM2's transition from instance to semantic segmentation. A prototypical adaptation loss is imposed between global and local prototypes iteratively to align and refine SAM2's semantic understanding. Extensive experimental results demonstrate that our proposed MemorySAM outperforms SoTA methods by large margins on both synthetic and real-world benchmarks (65.38% on DELIVER, 52.88% on MCubeS).

Introduction

While RGB cameras are standard in computer vision, they often fail in challenging environments such as night scenes, heavy fog, or high-speed motion. To build robust systems for autonomous driving and robotics, researchers utilize Multi-Modal Semantic Segmentation (MMSS), integrating data from Depth, LiDAR, Thermal, and Event cameras.

The challenge lies in effectively fusing these diverse modalities and leveraging powerful foundation models like Segment Anything Model 2 (SAM 2). SAM 2 excels at zero-shot instance segmentation in videos but faces two major hurdles for MMSS: the modality gap (it is pre-trained primarily on RGB) and the semantic gap (it identifies object instances rather than semantic categories). MemorySAM addresses these by treating multi-modal data as a temporal sequence and introducing a semantic memory mechanism.

Methods

MemorySAM adopts a "modality-as-time" paradigm. Instead of complex parallel fusion architectures, it treats paired multi-modal data as a sequence of frames. By feeding RGB, Depth, and LiDAR data into SAM 2 sequentially, the model utilizes its built-in temporal memory mechanism to capture modality-agnostic scene structures.

The detailed MemorySAM architecture featuring the LoRA fine-tuned encoder, memory mechanism, and Semantic Prototype Memory Module (SPMM).

Semantic Prototype Memory Module (SPMM)

To bridge the gap between instance and semantic segmentation, the SPMM stores category-level prototypes (e.g., "road," "car") during training. A Prototypical Adaptation Loss forces the model to align local pixel features with these global prototypes, guiding SAM 2 to understand semantic classes. This module is training-only and adds no overhead during inference.

Efficient Adaptation

The model employs Low-Rank Adaptation (LoRA) to fine-tune the Hiera-based image encoder, allowing it to adapt to non-RGB data without losing its pre-trained knowledge. A Memory Residual Connection is also used to average prediction masks across all modalities, preventing bias toward the final sensor in the sequence.

Results and Discussion

MemorySAM was evaluated on the DELIVER (synthetic driving) and MCubeS (real-world material) benchmarks.

Quantitative performance comparison on DELIVER and MCubeS benchmarks, showing MemorySAM's superior scaling with additional modalities.

Performance and Scaling

MemorySAM achieved state-of-the-art (SoTA) results, with 65.38% mIoU on DELIVER and 52.88% mIoU on MCubeS. A key insight is the model's ability to scale: unlike some previous models that lose accuracy when noisy modalities are added, MemorySAM’s performance consistently improves as more sensors are integrated. More modalities simply provide more "memory" for the model to draw from.

Efficiency and Robustness

MemorySAM is highly efficient, using significantly fewer trainable parameters (14.50M) than competitors like MLE-SAM (20.79M). Qualitative analysis confirms its robustness in sensor failure cases and night scenes where RGB-only models typically fail, demonstrating the effectiveness of its multi-modal memory mechanism.

Conclusion

MemorySAM reframes multi-modal fusion as a sequential memory problem, successfully adapting SAM 2 for semantic segmentation tasks. By treating modalities as temporal frames and introducing semantic prototypes, it sets new records on major benchmarks. Future work will focus on optimizing sequential latency for real-time applications and exploring zero-shot multi-modal capabilities.

Summary updated

BibTeX
@misc{liao2025memorysam,
  author = {Chenfei Liao and Xu Zheng and Yuanhuiyi Lyu and Haiwei Xue and Yihong Cao and Jiawen Wang and Kailun Yang and Xuming Hu},
  title = {{MemorySAM: Memorize Modalities and Semantics with Segment Anything Model 2 for Multi-modal Semantic Segmentation}},
  year = {2025},
  eprint = {2503.06700},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.06700},
}
Figure