SAM Fine-tuning for Medical Imaging

SAM Fine-tuning for Medical Imaging

H. Choi (Joint First Author) Y. Uhm (Joint First Author)
Genoray FlexLab Internship Project (2025)

This project focused on customizing the Segment Anything Model (SAM) and enhancing its performance for dental panoramic X-ray segmentation. We combined LoRA-based fine-tuning with an iterative prompt refinement strategy, and also developed user-friendly labeling tool features to improve both segmentation accuracy and clinical usability.

1. Background

Dentists often face difficulties identifying subtle lesions in panoramic X-rays. However, the available dataset was limited (~2,000 images) and of inconsistent quality, leading to segmentation errors and unreliable training. To overcome this, we designed a dual approach:

  • Enhance segmentation AI through SAM-HQ + LoRA fine-tuning
  • Improve the labeling tool with brush correction and mask transparency adjustment

2. Methodology

  • Base Model: SAM-HQ (Meta AI)
  • Tuning Strategy: Parameter-Efficient Fine-Tuning (LoRA)
  • Prompting: From simple center-point prompts → to iterative correction prompts (up to 11 iterations)
  • Dataset: 2,392 training + 269 test X-ray images, plus 10 challenging "bad-case" images
Iterative Prompt Strategy

Iterative prompt refinement for correcting under-/over-segmentation

3. Results

  • SAM-HQ baseline Dice score: 0.748
  • SAM-HQ + LoRA + iterative prompts: 0.914
  • Decoder-only and HQ-module-only LoRA also improved, but Encoder+Decoder LoRA gave best results
Result Comparison 1

Root segmentation improvement in low-quality and boundary-ambiguous environments

Result Comparison 2

Blurred region segmentation comparison

Result Comparison 3

Overlapped structure segmentation

Result Comparison 4

Artifact-heavy region handling

4. Tool Customization

  • Brush Tool: Enables intuitive "paint-and-erase" correction of masks
  • Transparency Control: Adjustable mask overlay opacity for clearer boundary distinction
  • Impact: Labeling time reduced by ~32% (250s → 170s per case)

Tool customization demonstration: brush correction and transparency control features

5. Conclusion

Through efficient fine-tuning and practical tool enhancements, we demonstrated that SAM can be effectively adapted to dental panoramic X-ray segmentation with limited data. This project lays the groundwork for dental imaging AI (e.g., structure segmentation and future pathology detection) in clinical practice, while also highlighting the importance of usability for adoption.