+ 1
How to use MedSAM-2 for Lung Nodules Segmentation?
MedSAM-2 is a finetuned version of Meta SAM 2 model on medical datasets. How to perform inference on this model?
1 ответ
0
To perform inference with MedSAM-2 (a fine-tuned version of Meta SAM 2 on medical data):
1. Install SAM:
pip install torch torchvision
pip install git+https://github.com/facebookresearch/segment-anything.git
2. Load MedSAM-2 checkpoint:
from segment_anything import sam_model_registry
sam = sam_model_registry["vit_b"](checkpoint="medsam2_checkpoint.pth")
sam.eval()
3. Preprocess your medical image and pass it with a prompt (e.g., bounding box) to get the segmentation mask.
Done