Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some bug of example code #90

Open
ydove0324 opened this issue Apr 7, 2024 · 1 comment
Open

Some bug of example code #90

ydove0324 opened this issue Apr 7, 2024 · 1 comment

Comments

@ydove0324
Copy link

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
Copy link

I believe installing Pillow version 9.5.0 using the command pip install Pillow==9.5.0 can resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants