WeakMedSAM: Weakly-Supervised Medical Image Segmentation via SAM With Sub-Class Exploration and Prompt Affinity Mining

Haoran Wang, Lian Huai, Wenbin Li, Lei Qi, Xingqun Jiang, Yinghuan Shi

TL;DR

WeakMedSAM is a novel framework that adapts the Segment Anything Model (SAM) for medical image segmentation using only image-level labels instead of expensive pixel-wise masks. By introducing sub-class exploration to handle co-occurring tissues and a prompt-based affinity mining module for structural refinement, it achieves state-of-the-art performance in weakly-supervised medical segmentation.

What Problem Does This Paper Address?

While the Segment Anything Model (SAM) has revolutionized general computer vision, its performance on medical images often falls short due to the "domain gap"—medical scans look nothing like the natural images SAM was trained on. To fix this, researchers usually "fine-tune" SAM, but this typically requires thousands of pixel-perfect manual annotations, which are incredibly labor-intensive and require expert medical knowledge.

The authors tackle two specific hurdles in Weakly-Supervised Segmentation (WSS):

  1. The Co-occurrence Problem: In medical imaging, certain tissues always appear together (e.g., a brain tumor is almost always surrounded by edema). Standard Class Activation Maps (CAMs) often get confused and activate the entire region instead of just the target.
  2. Structural Blur: CAMs generated from image-level labels tend to be "blobby" and only highlight the most discriminative parts of an object, missing fine boundaries and structural details.

Methods

WeakMedSAM introduces two primary modules designed to be "plug-and-play" with any SAM-based backbone (like SAMUS or EfficientSAM):

  • Sub-Class Exploration (SCE): To break the co-occurrence trap, the authors use unsupervised clustering (like K-means) on image features to discover "sub-classes" within a primary category. By training the network to recognize these latent variations, the model learns a more nuanced feature space. This forces the primary classifier to focus on the specific features that distinguish the target from its ever-present neighbors.
  • Prompt Affinity Mining (PAM): This module leverages SAM’s inherent "promptability." The system places a grid of point prompts across the image to generate a series of local masks. These masks are aggregated into a global affinity map that describes how likely any two pixels belong to the same structure. Finally, a "random walk" algorithm uses this map to spread the initial CAM activations across the entire object, following the natural structural boundaries of the anatomy.

Crucially, unlike previous methods that require training auxiliary "affinity networks," PAM uses SAM’s existing parameters, making it computationally efficient.

Datasets

The model was evaluated on three diverse benchmark datasets:

  • BraTS 2019: Multi-modal MRI scans for brain tumor segmentation.
  • AbdomenCT-1K: CT scans for segmenting abdominal organs (liver, kidney, spleen, pancreas).
  • MSD Cardiac: MRI images for left ventricle segmentation.
  • BraTS-Core: A custom subset of BraTS created by the authors to specifically test performance on small, difficult-to-segment tumor cores by removing the surrounding edema.

Key Insights and Ideas

  • Sub-classes as Regularizers: One of the most surprising findings was that optimizing for sub-class classification actually improved the primary class's activation maps. It acts as a form of feature "cleaning," preventing the model from overfitting on spurious background correlations.
  • SAM as its own Refiner: Instead of looking for external structural cues, the authors realized that SAM’s zero-shot prompt response is a goldmine for structural information. Using a simple grid of points to "probe" the image provides a high-quality affinity map for free.
  • Robustness to Small Targets: Weakly supervised methods usually fail on small objects. By combining SCE and PAM, WeakMedSAM showed a significant performance boost on small tumors, which are often the most clinically relevant targets.

Key Results

WeakMedSAM consistently outperformed existing weakly-supervised methods across all benchmarks:

  • BraTS 2019: Achieved a 79.69% Dice score, significantly higher than the previous best WSS method (TOCO at 74.61%).
  • AbdomenCT-1K: Reached 75.87% Dice, proving the method generalizes well to different modalities (CT vs MRI) and multiple organs.
  • Closing the Gap: On the BraTS dataset, WeakMedSAM (79.69%) came remarkably close to the fully-supervised upper bound (80.99%), despite using vastly simpler labels.
  • Interactive Edge: When tested in an interactive setting (using a single point prompt), WeakMedSAM outperformed the original SAM, showing that the weakly-supervised fine-tuning successfully "taught" the model medical domain knowledge.

Limitations and Future Work

While impressive, the authors note a few areas for improvement:

  • Manual Hyperparameters: The number of sub-classes ($K$) and random walk iterations ($t$) currently need to be set manually. Future work could involve an adaptive mechanism to determine these values based on image complexity.
  • The Supervision Gap: While the gap is closing, fully-supervised models still hold the lead in absolute accuracy.
  • End-to-End Integration: Currently, the SCE and PAM modules operate somewhat independently. The authors suggest that a more tightly coupled, end-to-end training synergy could further boost performance and generalizability.

Summary updated

BibTeX
@article{wang2025weakmedsam,
  author = {Haoran Wang and Lian Huai and Wenbin Li and Lei Qi and Xingqun Jiang and Yinghuan Shi},
  title = {{WeakMedSAM: Weakly-Supervised Medical Image Segmentation via SAM With Sub-Class Exploration and Prompt Affinity Mining}},
  journal = {IEEE Trans. Medical Imaging},
  year = {2025},
  url = {https://openreview.net/forum?id=E560S7lvdO},
}
Figure