Source-linked AI summary

Segment Anything Model for Medical Images?

Yuhao Huang, Xin Yang, Lian Liu, Han Zhou, Ao Chang, Xinrui Zhou, Rusi Chen, Junxuan Yu, Jiongquan Chen, Chaoyu Chen, Sijing Liu, Haozhe Chi, Xindi Hu, Kejuan Yue, Lei Li, Vicente Grau, Deng-Ping Fan, Fajin Dong, Dong Ni

arXiv:2304.14660v7eess.IVcs.CVcs.LG

TL;DR

Earlier SAM evaluations in medical imaging covered limited modalities, objects, or testing strategies. This report evaluates SAM on COSMOS 1050K, finding variable performance across medical targets and better overall results with ViT-H than ViT-B.

  • Problem

    Earlier SAM studies covered limited modalities and objects and often evaluated only one testing strategy.

    Source: §1.2 · pp. 4–5
  • Method

    The authors built COSMOS 1050K and evaluated SAM across testing strategies and object characteristics.

    Source: §1.2 · p. 5
  • Results

    SAM performed remarkably on some objects but was unstable or failed on others; ViT-H performed better overall than ViT-B, and manual hints—especially boxes—outperformed Everything mode.

    Source: §5 · p. 19
  • Takeaways & Limitations

    The report aims to provide insights for future development of medical SAM by analyzing performance across medical images and object characteristics.

    Source: §1.2 · p. 5

    Earlier evaluations covered limited modalities and objects, and often used only one testing strategy.

    Source: §1.2 · pp. 4–5

Abstract

from arXiv · show

The Segment Anything Model (SAM) is the first foundation model for general image segmentation. It has achieved impressive results on various natural image segmentation tasks. However, medical image segmentation (MIS) is more challenging because of the complex modalities, fine anatomical structures, uncertain and complex object boundaries, and wide-range object scales. To fully validate SAM's performance on medical data, we collected and sorted 53 open-source datasets and built a large medical segmentation dataset with 18 modalities, 84 objects, 125 object-modality paired targets, 1050K 2D images, and 6033K masks. We comprehensively analyzed different models and strategies on the so-called COSMOS 1050K dataset. Our findings mainly include the following: 1) SAM showed remarkable performance in some specific objects but was unstable, imperfect, or even totally failed in other situations. 2) SAM with the large ViT-H showed better overall performance than that with the small ViT-B. 3) SAM performed better with manual hints, especially box, than the Everything mode. 4) SAM could help human annotation with high labeling quality and less time. 5) SAM was sensitive to the randomness in the center point and tight box prompts, and may suffer from a serious performance drop. 6) SAM performed better than interactive methods with one or a few points, but will be outpaced as the number of points increases. 7) SAM's performance correlated to different factors, including boundary complexity, intensity differences, etc. 8) Finetuning the SAM on specific medical tasks could improve its average DICE performance by 4.39% and 6.68% for ViT-B and ViT-H, respectively. We hope that this comprehensive report can help researchers explore the potential of SAM applications in MIS, and guide how to appropriately use and develop SAM.

1. Introduction

SAM brought promptable, zero-shot segmentation to general computer vision, but earlier foundation models were not optimized for segmentation and evidence for medical image segmentation remained limited. This report builds a broad medical dataset and evaluates SAM across strategies and object characteristics.

1. Introduction

  • Earlier foundation models were not explicitly optimized for image segmentation, while SAM introduced promptable zero-shot segmentation for unseen datasets and tasks.SAM uses points and boxes to indicate object semantics and location.Source: §1 · p. 2

1.1. SAM in Non-medical Image Applications

  • Non-medical evaluations found mixed performance across applications, with human prompts refining results compared with automatic Everything mode.SAM performed well in some scenarios, including salient-object segmentation and agricultural analysis, but poorly in others.Source: §1.1 · p. 2

1.2. SAM in Medical Image Analysis

  • Prior medical studies covered limited modalities, objects, testing strategies, and assessments, leaving broad MIS performance and object-factor relationships insufficiently examined.This report addresses that scope with COSMOS 1050K and analyses of SAM strategies and object characteristics.Source: §1.2 · pp. 4–5

2. Dataset

COSMOS 1050K standardizes public medical datasets to evaluate SAM across varied modalities and targets. Its collection and preprocessing choices define which objects and slices are represented.

2.1. Dataset Collection

  • The dataset standardizes 53 public datasets to assess SAM across medical modalities, with 125 object-modality paired targets.Objects with extreme smallness, separated targets in extracted 3D slices, or dispersed structures were excluded because prompting them was difficult or confusing.Source: §2 · p. 5, §2.1 · p. 5

2.2. Dataset Preprocessing Specification

  • For 3D data, preprocessing extracts labeled slices, normalizes image intensities to 0–255, resets mask labels, and saves images and labels as PNG.4D data are split into sets of 3D volumes before following the 3D processing flow.Source: §2.2 · pp. 5–7
  • For 2D data, preprocessing retains images with sufficient label pixels, resets labels to object or location values, and converts image and label formats to PNG.CellSeg images and labels are reconstructed into sub-figures to handle original label values ranging from 1 to 1600.Source: §2.2 · p. 7
  • 1,050,311 2D images or slices and 6,033,198 masks make up COSMOS 1050K.1,003,809 slices come from 8,653 3D volumes, and 46,502 are standalone 2D images.Source: §2.2 · p. 7

3. Methodology

The study evaluates SAM’s automatic and manual prompting modes using ViT-B and ViT-H, with procedures designed for repeatable comparisons. It also reuses image embeddings across strategies and matches each object to its best-scoring predicted mask.

3.1. Brief Introduction to SAM

  • SAM combines image, prompt, and mask-decoder components to produce masks from image embeddings and encoded prompts.Its prompt encoder accepts dense mask prompts and sparse points, boxes, and text; testing can use automatic Everything mode or manual prompts.Source: §3.1 · p. 8

3.2. Automatic Everything Mode

  • Everything mode samples a grid of points across the image, generates candidate masks, then filters duplicates and low-quality masks.Filtering uses confidence scores, stability under threshold jitter, and non-maximal suppression.Source: §3.2 · p. 8

3.3. Manual Prompt Mode

  • Five manual strategies test one or five positive points, positive and negative points, a box, or a box with a positive point.Points are sampled from the ground-truth mask or nearby non-target region, and the box is the tight ground-truth bounding box; the rules support repeatability.Source: §3.3 · pp. 8–9

3.4. Inference Efficiency

  • Precomputing and reusing image embeddings across strategies improves testing efficiency by nearly n times.This avoids repeating the time-consuming image-encoding operation for each strategy.Source: §3.4 · p. 9

3.5. Mask-matching Mechanism for Segmentation Evaluation

  • For each object, evaluation selects the predicted mask with the highest Dice score against the ground truth.The selection is made among the multiple binary masks SAM generates for an image.Source: §3.5 · p. 9

4. Experiments and Results

The experiments compared SAM across automatic and manual-prompt strategies, while reusing shared image features and prompt data to accelerate testing.

  • Reusing one image embedding per test image and precomputing prompts avoided repeated extraction and calculation, improving testing efficiency approximately n×.The saved embeddings and prompt information could be loaded directly for different testing strategies.Source: §4.1 · p. 9
  • Tests ran on GTX 2080Ti, GTX 3090, and A40 GPUs using Python 3.8.0, PyTorch 2.0.0, and torchvision 0.15.1.The implementation also used torch.compile, mixed precision, and inference mode.Source: §4.1 · p. 9
  • The evaluation compared automatic Everything mode with five manual-prompt settings: one or five positive points, positive and negative points, a box, and a box plus a point.Source: §4.1 · p. 9

4.2. Evaluation Metrics

SAM’s performance varied with model size, prompting strategy, and modality. Box prompts performed best overall, while the evaluation emphasized DICE and Hausdorff distance.

4.2. Evaluation Metrics

  • The evaluation used DICE, JAC, and HD, with main-text analyses focused on DICE and HD and JAC reported in supplementary materials.Source: §4.2 · p. 10

4.3. Segmentation Performance under Different Models

  • Under Everything mode, ViT-H exceeded ViT-B by 7.47% at DICE and was 10.61 pixels lower on HD; its advantage grew with more point prompts.With box prompts, the models were close, with DICE differences of 0.37% and 0.06% for the two box strategies.Source: §4.3 · p. 10

4.4. Segmentation Performance under Different Testing Modes

  • Everything mode was worst, while box prompts were best; adding points improved DICE from 56.02% to 63.81% for ViT-B and 56.78% to 71.61% for ViT-H.Adding one point to a box produced no obvious change, with DICE decreases of 0.49% for ViT-B and 0.06% for ViT-H.Source: §4.4 · p. 10

4.5. Performance of Medical Images on Different Modalities

  • For box prompts, X-ray had the highest average DICE for both models; histopathology, colonoscopy, and DW MRI exceeded 90% with relatively low standard deviations.Other modalities generally had lower and less stable performance; the same object could also vary across modalities.Source: §4.5 · p. 10

4.6. Inference Time Analysis of SAM

Across these analyses, SAM’s inference cost, point-prompt density, and object characteristics shape its performance and practical trade-offs. More points can improve segmentation but also increase test time, while boundary complexity and contrast correlate with DICE.

4.6. Inference Time Analysis of SAM

  • Manual prompt encoding and mask decoding take less than 0.01s, while ViT-H requires nearly four times ViT-B’s embedding time under the controlled timing setup.Tests used one 256×256 image target on an NVIDIA GTX 3090 GPU with 24G memory.Source: §4.6 · p. 11

4.7. Analysis on the Number of Points in Everything Mode

  • As Everything-mode points increased from 82 to 2562, DICE rose across four multi-object datasets, but excessive points could split objects and increase test time.This creates a trade-off between segmentation performance and test efficiency.Source: §4.7 · p. 12, Table 5 · p. 15

4.8. Analysis of Factors Correlating to Segmentation Results

  • The analysis measured size, aspect ratio, foreground-background intensity difference, modality, and boundary complexity across 191,779 anatomical structures.Boundary complexity was represented using Elliptical Fourier Descriptors; the Fourier order estimates the accumulations needed for decoded-contour overlap with the original contour.Source: §4.8 · pp. 12, 14, 15
  • DICE had moderate correlations with Fourier order and intensity difference, weak correlation with size, and no correlation with modality or aspect ratio; complex boundaries and low contrast were associated with poorer performance.The authors report these patterns across most testing strategies.Source: Table 6 · p. 15, §4.8 · p. 16

4.9. Annotation Time and Quality Analysis

In a study with three experienced doctors, SAM-assisted annotation was faster and yielded higher annotation quality than annotation from scratch.

  • SAM assistance improved annotation quality (HCE: 0.27↓) and speed by approximately 25%, saving about 1.31 minutes per image and 0.2 minutes per object.The evaluation used 100 images, 55 objects, and 620 masks across 9 modalities; three doctors with 10 years of experience annotated from scratch and adjusted SAM box-prompt predictions.Source: §4.9 · p. 16

4.10. Impact of Di

The section examines prompt randomness as a simulation of real-world operation and reports substantial performance sensitivity to shifted points and boxes. Its figures also present DICE trends across attributes and the effects of finetuning for both SAM encoder sizes.

4.10. Impact of Di

  • Random shifts of 0–10, 10–20, and 20–30 pixels were used to simulate real-life variation in point and box placement.The authors note that exact center clicks and tight boxes are impractical for evaluating SAM in real use.Source: §4.10 · pp. 16–17
  • With 20–30-pixel shifts, DICE fell 14.62% for a single point, 24.11% for a box, and 29.93% for a box plus one point.More point prompts alleviated the decline; the random experiments were repeated three times and averaged.Source: §4.10 · p. 17, Table 8 · p. 17
  • The figures present DICE trends under different attributes for ViT-B and ViT-H with box prompts, and DICE improvement after finetuning for both encoders.The provided captions do not state the plotted values.Source: Figure 17 · p. 18, Figure 18 · p. 18

4.11. Comparison between SAM and Interactive Methods

In multi-round medical-image segmentation, SAM performs better than interactive methods at the first single-point interaction, but its performance does not keep pace as interactions accumulate.

4.11. Comparison between SAM and Interactive Methods

  • With one point, SAM outperformed FocalClick and SimpleClick, but using 10 points it performed worse than both interactive methods.Across iterations, SAM’s performance increased slowly or declined, while the interactive methods improved steadily; the comparison covered 10 typical organs and tumors across varied modalities and image characteristics.Source: §4.11 · p. 19

4.12. Task-specific Refinement for SAM

The authors fine-tuned SAM for medical segmentation because medical images differ from its natural-image training data, and found overall improvement in both model sizes.

4.12. Task-specific Refinement for SAM

  • The authors attribute SAM’s weak medical-image perception mainly to absent medical training data and differences in image appearance, boundaries, foreground-background contrast, and scale.Source: §4.12 · p. 19
  • The authors fine-tuned 45 common objects using box prompts, freezing the image and prompt encoders and adjusting only the mask decoder.Training lasted 20 epochs, with a 1e-4 learning rate and batch size 2.Source: §4.12 · p. 19
  • Finetuning improved segmentation overall for both backbones: ViT-B improved on 32 of 45 objects and ViT-H on 37 of 45.The results also showed a shift toward higher DICE values across correlating factors.Source: §4.12 · p. 19
  • Performance decreased for objects with small numbers and RGB color coding, suggesting that task-specific finetuning may need more careful design.Source: §4.12 · p. 19

5. Conclusion

The evaluation found that SAM has potential for medical image segmentation, but its performance is not stable at present.

5. Conclusion

  • SAM was strong on some objects but unstable or failed elsewhere; ViT-H outperformed ViT-B overall.Source: §5 · p. 19
  • Manual prompts, especially boxes, outperformed Everything mode, while randomness in center points and tight boxes could sharply reduce performance.Source: §5 · p. 19
  • SAM supported faster, high-quality annotation and beat interactive methods with one or a few points, but lost ground as point counts rose.Source: §5 · p. 19
  • Performance correlated with factors including boundary complexity; task-specific finetuning raised average DICE by 4.39% for ViT-B and 6.68% for ViT-H.Source: §5 · p. 19

6. Discussion

The discussion considers semantic awareness, comparisons with traditional segmentation, model dimensionality, and SAM’s potential role in medical annotation.

Semantic-aware SAM

  • SAM can propose regions but cannot identify their categories; CLIP classification and Grounding DINO boxes paired with SAM are natural-image approaches, while medical semantic awareness faces varied shapes, types, and similar subclasses.Source: §6 · p. 19

SAM vs. traditional segmentation methods?

  • Prior studies report that fine-tuned 2D SAM can outperform specialist U-Net models in most cases, while 3D MA-SAM with adapters can outperform nnU-Net without prompts.The discussion also flags prompt-noise robustness and multi-round interaction as unresolved problems.Source: §6 · p. 20

2D or 3D SAM?

  • A consistent 2D model is described as more practical across medical data types, while limited 3D data may constrain 3D foundation models, especially those trained from scratch.The authors plan to explore synthesizing high-fidelity 3D data.Source: §6 · p. 20

SAM boosts large-scale medical annotation?

  • SAM preliminarily shortened annotation time and improved quality; its efficiency advantage grows with more anatomical structures, and one network could support multimodal, multiclass labeling.The discussion links this potential to lightweight deployment in labeling software.Source: §6 · p. 20
Loading 2304.14660v7…