I-MedSAM: Implicit Medical Image Segmentation with Segment Anything

Xiaobao Wei, Jiajun Cao, Yizhu Jin, Ming Lu, Guangyu Wang, Shanghang Zhang

Abstract

Medical image segmentation often struggles with the rigidity of discrete pixel-wise representations and the domain gap inherent in foundation models. We present I-MedSAM, a parameter-efficient framework that integrates the Segment Anything Model (SAM) with Implicit Neural Representations (INR). By employing a novel Frequency Adapter and an Uncertainty-Guided Sampling (UGS) strategy, I-MedSAM achieves state-of-the-art performance with only 1.6M trainable parameters. Our approach demonstrates superior boundary accuracy and robustness to resolution changes across multiple medical imaging benchmarks.

What Problem Does This Paper Address?

Medical image segmentation is a cornerstone of computer-aided diagnosis, but it faces two major hurdles:

  1. Rigidity of Discrete Representations: Most models (like nnUNet) produce pixel-wise or voxel-wise grids. These "discrete" outputs are spatially inflexible—they don't scale well to higher resolutions and often struggle to capture the nuanced, continuous boundaries of human anatomy.
  2. Domain Gap & Efficiency: While foundation models like SAM have incredible zero-shot capabilities, they aren't "out-of-the-box" ready for the specific textures and high-stakes precision required in medical imaging. Fine-tuning the entire model is computationally expensive, while simple adapters often miss the fine-grained details needed for accurate boundary delineation.

I-MedSAM tackles these by moving from discrete grids to continuous representations, allowing the model to predict segmentation at any coordinate and resolution.

Methods

I-MedSAM introduces three key innovations to the standard SAM pipeline to bridge the gap between foundation models and medical precision:

  • Frequency Adapter (FA): Recognizing that boundaries are essentially "high-frequency" signals, the authors designed an adapter that incorporates Fast Fourier Transform (FFT) information. The amplitude spectrum of an image provides a superior representation for enhancing SAM’s features during fine-tuning.
  • Implicit Segmentation Decoder: Instead of a standard convolutional decoder, I-MedSAM uses an Implicit Neural Representation (INR). This function maps a coordinate $(x, y)$ and its corresponding image features to a segmentation probability, making the model "resolution-agnostic."
  • Uncertainty-Guided Sampling (UGS): To maintain efficiency, a two-stage, coarse-to-fine approach is used. A "coarse" decoder makes an initial pass; then, using MC-Dropout, the model estimates uncertainty. The "fine" decoder then focuses its computational effort only on the "Top-K" most uncertain points (usually the tricky boundaries).
The I-MedSAM architecture features a Medical Image Encoder with Frequency Adapters and an Implicit Decoder utilizing Uncertainty Guided Sampling for high-precision refinement.

Key Results

The model was evaluated on several challenging benchmarks, including Kvasir-Sessile (polyps) and BCV (multi-organ CT).

  • Efficiency: I-MedSAM uses only 1.6M trainable parameters, significantly fewer than nnUNet (126.6M) or MedSAM (4.1M).
  • Accuracy: On the Kvasir-Sessile dataset, I-MedSAM achieved a 91.49% Dice score, outperforming the previous best implicit method (SwIPE, 85.05%) and discrete method (nnUNet, 82.97%).
  • Robustness: As shown in the performance metrics, the model maintains high performance when tested on resolutions it wasn't trained on and shows strong generalization across different domains.
Comparison of Dice scores across different domains and resolutions. I-MedSAM (green) consistently outperforms larger models like nnUNet and MedSAM, especially in cross-domain and resolution-scaling scenarios.

Conclusion

I-MedSAM demonstrates that the "Aha!" moment for medical boundaries lies in explicitly feeding high-frequency spectral data into the model. By combining this with continuous representations, the model avoids the "blocky" artifacts typical of upsampled discrete masks. While currently focused on 2D slices, the framework provides a robust, parameter-efficient foundation for future 3D medical imaging applications.

Summary updated

BibTeX
@inproceedings{wei2024i,
  author = {Xiaobao Wei and Jiajun Cao and Yizhu Jin and Ming Lu and Guangyu Wang and Shanghang Zhang},
  title = {{I-MedSAM: Implicit Medical Image Segmentation with Segment Anything}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72684-2\_6},
}
Figure