Memory-Augmented SAM2 for Training-Free Surgical Video Segmentation

Ming Yin, Fu Wang, Xujiong Ye, Yanda Meng, Zeyu Fu

Abstract

Surgical instrument segmentation (SIS) is a critical component of computer-assisted surgery, yet it remains challenging due to rapid tool movements and frequent occlusions. While the Segment Anything Model 2 (SAM2) has set new benchmarks in video segmentation, its reliance on a First-In-First-Out (FIFO) memory bank often leads to tracking drift in surgical environments where the most recent frames are frequently the most unstable. We present Memory-Augmented SAM2 (MA-SAM2), a training-free adaptation that introduces dual memory modules—Context-Aware and Occlusion-Resilient—to enhance temporal consistency. MA-SAM2 outperforms standard SAM2 by up to 6.1% on benchmark datasets without requiring additional parameters or fine-tuning, establishing a new state-of-the-art for zero-shot surgical video segmentation.

Introduction

Surgical instrument segmentation (SIS) is often described as "hard mode" for computer vision. Unlike standard video object tracking, surgical scenes are characterized by jerky movements, instruments that frequently disappear and reappear, and significant occlusions where tools hide behind tissue or other instruments.

Meta’s Segment Anything Model 2 (SAM2) provides a robust foundation for video segmentation; however, its "greedy" memory management strategy is a bottleneck in clinical settings. By prioritizing the most recent frames in a FIFO queue, SAM2 risks storing low-confidence masks or noise (e.g., blood, smoke, or partial occlusions) as ground truth for future frames. This instability propagates through the video, leading to tracking failures. MA-SAM2 addresses this by replacing the simple FIFO structure with a more sophisticated, multi-hypothesis memory strategy.

Methodology

MA-SAM2 operates in a "one-prompt" mode, where a user provides an initial mask for an instrument, and the system tracks it autonomously. The architecture remains training-free, utilizing frozen SAM2 weights and augmenting the memory pipeline with two parallel branches:

Occlusion-Resilient Memory (ORM)

The ORM module is designed to handle frames with high interference, such as when two instruments cross paths. It employs a variation selection mechanism to evaluate multiple segmentation hypotheses simultaneously. Instead of committing to a single potentially flawed mask, ORM selects the primary prediction while refining regions of overlap. To maintain computational efficiency and prevent "distractions" from distant historical data, ORM limits its storage to the five most relevant recent frames.

Context-Aware Memory (CAM)

While ORM handles short-term interference, the CAM branch focuses on long-term stability. It utilizes "collaborative hypothesis pruning" to maintain a curated set of high-quality historical masks. By calculating a cumulative score for different tracking "branches" over time, CAM identifies the most plausible trajectory for an instrument. This allows the model to "remember" the visual characteristics of a tool even after it has been off-screen or obscured for an extended period.

Experimental Results

MA-SAM2 was evaluated on two gold-standard benchmarks: EndoVis2017 (8 video sequences) and EndoVis2018 (15 video sequences featuring seven instrument categories).

Performance Metrics

The model demonstrated superior performance across both datasets compared to standard SAM2 and other zero-shot methods like TrackAnything and PerSAM:

  • EndoVis2017: MA-SAM2 achieved a 62.49% Challenge IoU, representing a 6.1% improvement over the baseline SAM2.
  • EndoVis2018: The model reached a 64.40% Challenge IoU, a 4.36% improvement over the baseline.

Notably, MA-SAM2 outperformed "Surgical SAM2"—a version of the model specifically fine-tuned for surgical data. This suggests that a more intelligent memory strategy can be more effective than domain-specific weight updates in zero-shot scenarios.

Robustness and Observations

The model showed particular strength in tracking Monopolar Curved Scissors (MSC) and Bipolar Forceps (BF), which are notoriously difficult to segment due to their frequent interactions with tissue. The "aha moment" of this research is the realization that in surgery, the most recent frame is often the noisiest. By moving away from recency bias and toward multi-hypothesis scoring, MA-SAM2 maintains consistency where standard models drift.

Discussion and Conclusion

MA-SAM2 provides a powerful, training-free solution for surgical tool tracking. However, its reliance on strict confidence scores can occasionally lead to the rejection of valid masks, particularly during complex maneuvers involving the Large Needle Driver (LND). Future work will explore incorporating semantic "surgical logic" to better distinguish between a lost tool and a complex interaction. Nevertheless, MA-SAM2 demonstrates that smarter memory management is a viable path toward deploying foundation models in high-stakes medical environments without the need for expensive retraining.

Summary updated

BibTeX
@inproceedings{yin2025memory,
  author = {Ming Yin and Fu Wang and Xujiong Ye and Yanda Meng and Zeyu Fu},
  title = {{Memory-Augmented SAM2 for Training-Free Surgical Video Segmentation}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2025},
  doi = {10.1007/978-3-032-05127-1\_32},
}
Figure