Some bug of example code
ydove0324 opened this issue · 1 comments
ydove0324 commented
I do think this part of code has some bugs
from semantic_sam import prepare_image, plot_multi_results, build_semantic_sam, SemanticSAMPredictor
original_image, input_image = prepare_image(image_pth='examples/dog.jpg') # change the image path to your image
mask_generator = SemanticSAMPredictor(build_semantic_sam(model_type='<model_type>', ckpt='</your/ckpt/path>')) # model_type: 'L' / 'T', depends on your checkpint
iou_sort_masks, area_sort_masks = mask_generator.predict_masks(original_image, input_image, point='<your prompts>') # input point [[w, h]] relative location, i.e, [[0.5, 0.5]] is the center of the image
plot_multi_results(iou_sort_masks, area_sort_masks, original_image, save_path='../vis/') # results and original images will be saved at save_path
since the iou_sort_masks and area_sort_masks are both torch.tensors, but the plot_multi_results function need params whose type should be PIL.Image.
TAUIL-Abd-Elilah commented
I believe installing Pillow version 9.5.0 using the command pip install Pillow==9.5.0
can resolve the issue.