SAMora: Enhancing SAM through Hierarchical Self-Supervised Pre-Training for Medical Images

Shuhang Chen, Hangjie Yuan, Pengwei Liu, Hanxue Gu, Tao Feng, Dong Ni

TL;DR

This paper introduces SAMora, a novel framework that enhances the Segment Anything Model (SAM) for medical image segmentation by leveraging hierarchical self-supervised learning. SAMora effectively fuses multi-level features from unlabeled medical data, significantly improving segmentation performance in both few-shot and fully supervised settings while drastically reducing fine-tuning time.

What Problem Does This Paper Address?

The Segment Anything Model (SAM) has revolutionized general image segmentation with its impressive adaptability. However, its direct application to medical imaging is hampered by the inherent complexity of medical data and the scarcity of labeled datasets. While existing methods like SAMed and H-SAM adapt SAM for medical use, they often overlook the vast amounts of unlabeled medical data available, which contain rich hierarchical information crucial for accurate segmentation. This paper aims to bridge this gap by developing a method that effectively utilizes this unlabeled hierarchical data to boost SAM's performance in the medical domain.

Methods

SAMora employs a two-stage approach:

  • Stage 1: Hierarchical Self-Supervised Pre-Training: This stage focuses on extracting hierarchical medical knowledge from unlabeled data. It utilizes three distinct self-supervised learning (SSL) objectives at different levels:
  • Image-Level: Contrastive learning (SimCLRv2) is used to capture global anatomical features.
  • Patch-Level: Masked Autoencoder (MAE) is employed to learn regional characteristics by reconstructing masked image patches.
  • Pixel-Level: A denoising autoencoder is used to capture fine-grained details. Crucially, SAMora uses a teacher-student framework with continual pre-training (CPT) to adapt pre-trained models (like SimCLRv2 and MAE) to the medical domain. LoRA (Low-Rank Adaptation) experts are pre-trained at each level.

  • Stage 2: Hierarchical Fusion and Fine-Tuning: In this stage, the pre-trained LoRA experts are integrated into SAM. A novel Hierarchical LoRA Attention (HL-Attn) module is introduced to fuse features from the different levels. HL-Attn uses a hierarchical cross-attention mechanism, progressively integrating features from pixel to patch to image levels. This allows the model to adaptively combine information while preserving the distinct characteristics of each level. During fine-tuning, the SAM encoder and pre-trained LoRA weights are frozen, and only the HL-Attn module and the decoder are updated, leading to efficient training.

Datasets

  • Pre-training (Unlabeled Data): 100,000 CT images from the Amos22, LiTS, KiTS, and Decathlon Challenge datasets.
  • Fine-tuning and Evaluation:
    • Synapse (multi-organ CT)
    • Left Atrial (LA) (cardiac MRI)
    • PROMISE12 (prostate MRI)

Key Insights and Ideas

  • Hierarchical Knowledge is Key: Medical images possess inherent hierarchical structures (global, regional, fine-grained) that are vital for accurate segmentation. SAMora's success stems from explicitly capturing and fusing this multi-level information.
  • SSL for Medical Domain Adaptation: Leveraging unlabeled medical data through SSL is a powerful strategy to overcome the limitations of small labeled datasets and adapt general models like SAM to the specific nuances of medical imaging.
  • Complementary SSL Objectives: Using different SSL methods (contrastive, MAE, denoising) at different hierarchical levels effectively captures diverse feature types, leading to a more comprehensive understanding of the image.
  • Hierarchical Attention for Fusion: A simple concatenation or linear combination of features from different levels is insufficient. The proposed HL-Attn module, using cross-attention, effectively fuses these hierarchical features, preserving their distinctiveness and maximizing their combined benefit.
  • Efficiency Gains: By pre-training LoRA experts and then fine-tuning only the fusion module and decoder, SAMora achieves state-of-the-art performance with significantly fewer fine-tuning epochs and parameters.

Key Results

  • State-of-the-Art Performance: SAMora consistently outperforms existing prompt-free SAM variants and other SOTA methods on the Synapse, LA, and PROMISE12 datasets in both fully supervised and few-shot settings.
  • Few-Shot Superiority: Achieves impressive results even when fine-tuned on only 10% of the training data. For example, on the Synapse dataset, SAMora achieved a Mean Dice boost of 4.09% using only 10% of the training data.
  • Efficiency: Reduces fine-tuning epochs by up to 90% compared to other methods.
  • Improved Segmentation Quality: Qualitative results (heatmaps) show SAMora has more focused attention on critical anatomical structures compared to SAMed.
  • Compatibility: SAMora is compatible with various SAM variants, including SAM2, SAMed, and H-SAM, leading to models like SAMora-2 and H-SAMora.

Limitations and Future Work

  • Limitations: The paper primarily focuses on CT and MRI datasets. The effectiveness on other medical imaging modalities (e.g., X-ray, ultrasound) is not explicitly discussed. While the paper demonstrates efficiency, the computational cost of the multi-level pre-training stage might still be significant.
  • Future Work: The authors suggest that the hierarchical fusion strategy is key to handling complex medical imaging tasks, implying that further exploration of fusion orders and attention mechanisms could yield even better results. The compatibility with different SAM variants also opens avenues for integrating future SAM improvements into the SAMora framework.

Summary updated

BibTeX
@inproceedings{chen2025samora,
  author = {Shuhang Chen and Hangjie Yuan and Pengwei Liu and Hanxue Gu and Tao Feng and Dong Ni},
  title = {{SAMora: Enhancing SAM through Hierarchical Self-Supervised Pre-Training for Medical Images}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
}
Figure