Skip to content

πŸ‘Mask-Enhanced Segment Anything Model for Tumor Lesion Semantic Segmentation[MICCAI 2024]

License

Notifications You must be signed in to change notification settings

nanase1025/M-SAM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

M-SAM [Paper]

We introduce Mask-Enhanced SAM (M-SAM), an innovative architecture tailored for 3D tumor lesion segmentation. This method is elaborated on the paper Mask-Enhanced Segment Anything Model for Tumor Lesion Semantic Segmentation.

🌟 Highlights

  • We introduce a novel Mask-Enhanced SAM (M-SAM) architecture to explore the application of SAM in the medical domain, validating its effectiveness in tumor lesion segmentation.
  • We propose a Mask-Enhanced Adapter (MEA) to align the positional information of the prompt with the semantic information of the input image, optimizing precise guidance for mask prediction. Based on the design of the MEA, we further implement an iterative refining scheme to refine masks, yielding improved performances.
  • With updates to only about 20% of the parameters, our model outperforms state-of-the-art medical image segmentation methods on five tumor lesion segmentation benchmarks. Additionally, we validate the effectiveness of our method in domain transferring.

🫱 A Quick Overview

M-SAM consists of multiple stages of iterative refinement, which makes it possible to refine the predicted segmentation masks iteratively, thus obtaining more accurate segmentation boundaries progressively.

image

Our MEA is proposed to aggregate the image embedding with corresponding mask, so that the updated image embedding can perceive position priors of the lesion regions.

image

🫱 Requirement

Install the environment:

pip install -r requirements.txt

Then download SAM checkpoint, and put it at .work_dir/SAM/

🫱 Usage

  1. Prepare your own train dataset and refer to the samples in M-SAM/demo to replace them according to your specific scenario. The target file structures should be like the following:
data/train
      β”œβ”€β”€ ct_BraTS
      β”‚ β”œβ”€β”€ imagesTr
      β”‚ β”‚ β”œβ”€β”€ word_0025.nii.gz
      β”‚ β”‚ β”œβ”€β”€ ...
      β”‚ β”œβ”€β”€ labelsTr
      β”‚ β”‚ β”œβ”€β”€ word_0025.nii.gz
      β”‚ β”‚ β”œβ”€β”€ ...
      β”‚ ── ct_LiTS
      β”‚ β”œβ”€β”€ imagesTr
      β”‚ β”‚ β”œβ”€β”€ word_0025.nii.gz
      β”‚ β”‚ β”œβ”€β”€ ...
      β”‚ β”œβ”€β”€ labelsTr
      β”‚ β”‚ β”œβ”€β”€ word_0025.nii.gz
      β”‚ β”‚ β”œβ”€β”€ ...
      β”œβ”€β”€ ...
  1. Start Training!
cd ./M-SAM
python train_msam.py

This will start the training process of the M-SAM model on your prepared data. The key options are listed below:

  • task_name: task name
  • checkpoint: pre-trained checkpoint
  • work_dir: results folder for log and ckpt
  • num_epochs: number of epoches
  • batch_size: batch size for training
  • num_workers: the num_workers
  • lr: learning rate for training
  • lr_scheduler: the choices of scheduler, default is multisteplr

πŸ’‘Note: Use the --checkpoint to set the pre-trained weight path, if no checkpoint is found in the specified path, the model will undergo training from scratch.

  1. Evaluation Prepare your own test dataset and refer to the samples in M-SAM/demo to replace them according to your specific scenario. The target file structures should be like the following:
data/test
      β”œβ”€β”€ adrenal
      β”‚ β”œβ”€β”€ ct_WORD
      β”‚ β”‚ β”œβ”€β”€ imagesTr
      β”‚ β”‚ β”‚ β”œβ”€β”€ word_0027.nii.gz
      β”‚ β”‚ β”‚ β”œβ”€β”€ ...
      β”‚ β”‚ β”œβ”€β”€ labelsTr
      β”‚ β”‚ β”‚ β”œβ”€β”€ word_0027.nii.gz
      β”‚ β”‚ β”‚ β”œβ”€β”€ ...
      β”œβ”€β”€ liver
      β”‚ β”œβ”€β”€ ct_WORD
      β”‚ β”‚ β”œβ”€β”€ imagesTr
      β”‚ β”‚ β”‚ β”œβ”€β”€ word_0029.nii.gz
      β”‚ β”‚ β”‚ β”œβ”€β”€ ...
      β”‚ β”‚ β”œβ”€β”€ labelsTr
      β”‚ β”‚ β”‚ β”œβ”€β”€ word_0029.nii.gz
      β”‚ β”‚ β”‚ β”œβ”€β”€ ...
      β”œβ”€β”€ ...

And

cd ./M-SAM
python test_msam.py

This will start the testing process of the M-SAM model on your prepared data.

πŸ“§ Citation

@inproceedings{shi2024mask,
  title={Mask-enhanced segment anything model for tumor lesion semantic segmentation},
  author={Shi, Hairong and Han, Songhao and Huang, Shaofei and Liao, Yue and Li, Guanbin and Kong, Xiangxing and Zhu, Hua and Wang, Xiaomu and Liu, Si},
  booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
  pages={403--413},
  year={2024},
  organization={Springer}
}

🀝 Acknowledgement

πŸ“š License

This project is released under the Apache 2.0 license.

About

πŸ‘Mask-Enhanced Segment Anything Model for Tumor Lesion Semantic Segmentation[MICCAI 2024]

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages