bowang-lab / MedSAM

Segment Anything in Medical Images
https://www.nature.com/articles/s41467-024-44824-z
Apache License 2.0
2.96k stars 407 forks source link

Question about semantic segmentation for this model #197

Closed Younger330 closed 9 months ago

Younger330 commented 9 months ago

Hello, I was looking through your code and noticed this line: assert np.max(gt2D) == 1 and np.min(gt2D) == 0.0, "ground truth should be 0, 1" In medical imaging, semantic segmentation tasks are quite common. I'm curious, can this model handle semantic segmentation?

JunMa11 commented 9 months ago

Hi @Younger330 ,

Thanks for your interest.

The original input is a semantic segmentation mask. We randomly select one label during the training process.

https://github.com/bowang-lab/MedSAM/blob/6136412963d680c2158e38754c8335c45b9279eb/train_one_gpu.py#L95-L98

SAM/MedSAM are promptable segmentation methods, which are not comparable to the typical fully automatic sementic segmentation.

Younger330 commented 9 months ago

Hi @Younger330 ,

Thanks for your interest.

The original input is a semantic segmentation mask. We randomly select one label during the training process.

https://github.com/bowang-lab/MedSAM/blob/6136412963d680c2158e38754c8335c45b9279eb/train_one_gpu.py#L95-L98

SAM/MedSAM are promptable segmentation methods, which are not comparable to the typical fully automatic sementic segmentation.

Thanks for your reply. So, during inference, with bounding box prompts this model can only localize it without classify, correct?

JunMa11 commented 9 months ago

yes.