Skip to content

The official PyTorch implementation for "SAM-Guided Prompt Learning for Multiple Sclerosis Lesion Segmentation" (PRLETTERS 11/2025)

License

Notifications You must be signed in to change notification settings

perceivelab/MS-SAM-LESS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SAM-Guided Prompt Learning for Multiple Sclerosis Lesion Segmentation

F. Proietto Salanitri, G. Bellitto, S.Calcagno, U.Bagci, C. Spampinato, M.Pennisi

prl

๐Ÿ” Overview

The official PyTorch implementation for "SAM-Guided Prompt Learning for Multiple Sclerosis Lesion Segmentation".

MS-SAMLess is a training-time distillation framework for Multiple Sclerosis lesion segmentation that leverages SAM only during training to learn dense task-specific prompts. At inference, SAM is fully removed and replaced with a lightweight aggregator that transforms the learned prompts into segmentation masks, eliminating manual prompting and drastically reducing computational cost. The method achieves state-of-the-art performance on MSLesSeg while remaining compact, fast, and easily deployable.

Method

๐Ÿ“„ Paper abstract

Accurate segmentation of Multiple Sclerosis (MS) lesions remains a critical challenge in medical image analysis due to their small size, irregular shape, and sparse distribution. Despite recent progress in vision foundation modelsโ€”such as SAM and its medical variant MedSAMโ€”these models have not yet been explored in the context of MS lesion segmentation. Moreover, their reliance on manually crafted prompts and high inference-time computational cost limits their applicability in clinical workflows, especially in resource-constrained environments. In this work, we introduce a novel training-time framework for effective and efficient MS lesion segmentation. Our method leverages SAM solely during training to guide a prompt learner that automatically discovers task-specific embeddings. At inference, SAM is replaced by a lightweight convolutional aggregator that maps the learned embeddings directly into segmentation masksโ€”enabling fully automated, low-cost deployment. We show that our approach significantly outperforms existing specialized methods on the public MSLesSeg dataset, establishing new performance benchmarks in a domain where foundation models had not previously been applied. To assess generalizability, we also evaluate our method on pancreas and prostate segmentation tasks, where it achieves competitive accuracy while requiring an order of magnitude fewer parameters and computational resources compared to SAM-based pipelines. By eliminating the need for foundation models at inference time, our framework enables efficient segmentation without sacrificing accuracy. This design bridges the gap between large-scale pretraining and real-world clinical deployment, offering a scalable and practical solution for MS lesion segmentation and beyond.

Read the full paper on PRLettersw.

๐Ÿ“‚ Repository details

This repo relies on the AutoSAM Framework which has been modified to include the features described in the MS-SAMLess paper.

๐Ÿ’ช Training

The general command to launch a training is:

python 

๐Ÿ“œ Citation

@article{PROIETTOSALANITRI2026205,
title = {SAM-guided prompt learning for Multiple Sclerosis lesion segmentation},
journal = {Pattern Recognition Letters},
volume = {199},
pages = {205-211},
year = {2026},
issn = {0167-8655},
doi = {https://doi.org/10.1016/j.patrec.2025.11.018},
author = {Federica {Proietto Salanitri} and Giovanni Bellitto and Salvatore Calcagno and Ulas Bagci and Concetto Spampinato and Manuela Pennisi},
keywords = {Multiple Sclerosis, Segment Anything Model (SAM), Dense Prompt Learner, Brain MRI}
}

About

The official PyTorch implementation for "SAM-Guided Prompt Learning for Multiple Sclerosis Lesion Segmentation" (PRLETTERS 11/2025)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published