Open chimmut opened 1 week ago
Yes, it is possible to modify the inference_2D.py script to read a series of bounding boxes as prompts directly instead of using an .npz file:
np.uint8
dtype and ensured to have 3 channels. To use other input formats, you'll first need to add preprocessing code to convert your input image to the same format:
https://github.com/bowang-lab/MedSAM/blob/5b2fc44be42ea43b98f6b9e265884d7c2d183540/pre_grey_rgb.py#L47-L52CVPR24_LiteMedSAM_infer.py
.
https://github.com/bowang-lab/MedSAM/blob/5b2fc44be42ea43b98f6b9e265884d7c2d183540/CVPR24_LiteMedSAM_infer.py#L374-L399
You'll need to format your bounding boxes as a list, where each element is a numPy array in the format [x_min, y_min, x_max, y_max], e.g.
boxes = [
np.array([100, 200, 300, 400]),
np.array([500, 600, 700, 800]),
# Add more bounding boxes as needed
]
我想知道LiteMedSAM的inference_2D.py在分割一张bmp图片时能否直接读取一系列的box作为提示,而不是使用.npz文件。如果可以的话,能否告诉我该如何修改代码?期待您的回复