Assefa Seyoum Wahd , Banafshe Felfeliyan , Yuyue Zhou , Shrimanti Ghosh , Adam McArthur , Jiechen Zhang , Jacob L. Jaremko , Abhilash Hareendranathan
{"title":"Sam2Rad: A segmentation model for medical images with learnable prompts","authors":"Assefa Seyoum Wahd , Banafshe Felfeliyan , Yuyue Zhou , Shrimanti Ghosh , Adam McArthur , Jiechen Zhang , Jacob L. Jaremko , Abhilash Hareendranathan","doi":"10.1016/j.compbiomed.2025.109725","DOIUrl":null,"url":null,"abstract":"<div><div>The Segment Anything Model and its variants, such as MedSAM, have demonstrated potential for medical image segmentation. However, they heavily rely on high-quality manual prompts, which are both time-consuming and require domain expertise. Even when using manual prompts, including sparse prompts like boxes, points, or text, and dense prompts such as masks, SAM and its variants like MedSAM (fine-tuned on medical images) fail to segment bones in ultrasound images due to significant domain shift.</div><div>To address these limitations, we propose <strong>Sam2</strong> for <strong>Rad</strong>iology (Sam2Rad), a framework that extends SAM and its recent iteration SAM2 to segment bony regions in ultrasound images without requiring manual prompts. At the core of our approach is a Prompt Predictor Network (PPN) that uses a lightweight cross-attention mechanism to generate bounding box coordinates, mask prompts, and high-dimensional embeddings to be used as prompts. Specifically, PPN leverages hierarchical feature maps extracted from SAM’s image encoder as keys and values, and learnable object embeddings as queries. The output of the cross-attention is then used to predict the bounding box coordinates, mask prompts, and high-dimensional prompts. These predicted prompts are subsequently fed to SAM’s mask decoder to generate the final segmentation mask. By aligning the learned prompts with SAM’s original training scheme, PPN enhances compatibility with SAM’s architecture, requiring no additional standalone encoders.</div><div>To preserve SAM’s extensive world knowledge, we keep all SAM modules frozen and train PPN only. This approach enables efficient parameter utilization while retaining SAM’s generalization capabilities. Additionally, Sam2Rad can operate in three modes: fully autonomous without human supervision, semi-autonomous with <em>human-in-the-loop</em> for iterative refinement, and fully manual for tasks like data labeling.</div><div>We tested the proposed model – Sam2Rad on 3 musculoskeletal US datasets – wrist (3822 images), shoulder rotator cuff (1605 images), and hip (4849 images). Without Sam2Rad, all SAM2 variants failed to segment shoulder US in zero-shot generalization with bounding box prompts. Our model, Sam2Rad, improved the performance of all SAM base networks in all datasets, without requiring manual prompts. The improvement in dice score ranged from a 2.2%–5.8% for hip, 19.6%–32.8% for wrist wrist, and up to 51.3% improvement in Dice score (from 25.2% to 76.5% Sam2 large) on shoulder data. Notably, Sam2Rad could be trained with as few as 10 labeled images and it is compatible with any SAM architecture.</div><div>The code is available at <span><span>https://github.com/aswahd/SamRadiology</span><svg><path></path></svg></span>.</div></div>","PeriodicalId":10578,"journal":{"name":"Computers in biology and medicine","volume":"187 ","pages":"Article 109725"},"PeriodicalIF":7.0000,"publicationDate":"2025-02-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computers in biology and medicine","FirstCategoryId":"5","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0010482525000757","RegionNum":2,"RegionCategory":"医学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"BIOLOGY","Score":null,"Total":0}
引用次数: 0
Abstract
The Segment Anything Model and its variants, such as MedSAM, have demonstrated potential for medical image segmentation. However, they heavily rely on high-quality manual prompts, which are both time-consuming and require domain expertise. Even when using manual prompts, including sparse prompts like boxes, points, or text, and dense prompts such as masks, SAM and its variants like MedSAM (fine-tuned on medical images) fail to segment bones in ultrasound images due to significant domain shift.
To address these limitations, we propose Sam2 for Radiology (Sam2Rad), a framework that extends SAM and its recent iteration SAM2 to segment bony regions in ultrasound images without requiring manual prompts. At the core of our approach is a Prompt Predictor Network (PPN) that uses a lightweight cross-attention mechanism to generate bounding box coordinates, mask prompts, and high-dimensional embeddings to be used as prompts. Specifically, PPN leverages hierarchical feature maps extracted from SAM’s image encoder as keys and values, and learnable object embeddings as queries. The output of the cross-attention is then used to predict the bounding box coordinates, mask prompts, and high-dimensional prompts. These predicted prompts are subsequently fed to SAM’s mask decoder to generate the final segmentation mask. By aligning the learned prompts with SAM’s original training scheme, PPN enhances compatibility with SAM’s architecture, requiring no additional standalone encoders.
To preserve SAM’s extensive world knowledge, we keep all SAM modules frozen and train PPN only. This approach enables efficient parameter utilization while retaining SAM’s generalization capabilities. Additionally, Sam2Rad can operate in three modes: fully autonomous without human supervision, semi-autonomous with human-in-the-loop for iterative refinement, and fully manual for tasks like data labeling.
We tested the proposed model – Sam2Rad on 3 musculoskeletal US datasets – wrist (3822 images), shoulder rotator cuff (1605 images), and hip (4849 images). Without Sam2Rad, all SAM2 variants failed to segment shoulder US in zero-shot generalization with bounding box prompts. Our model, Sam2Rad, improved the performance of all SAM base networks in all datasets, without requiring manual prompts. The improvement in dice score ranged from a 2.2%–5.8% for hip, 19.6%–32.8% for wrist wrist, and up to 51.3% improvement in Dice score (from 25.2% to 76.5% Sam2 large) on shoulder data. Notably, Sam2Rad could be trained with as few as 10 labeled images and it is compatible with any SAM architecture.
The code is available at https://github.com/aswahd/SamRadiology.
期刊介绍:
Computers in Biology and Medicine is an international forum for sharing groundbreaking advancements in the use of computers in bioscience and medicine. This journal serves as a medium for communicating essential research, instruction, ideas, and information regarding the rapidly evolving field of computer applications in these domains. By encouraging the exchange of knowledge, we aim to facilitate progress and innovation in the utilization of computers in biology and medicine.