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

Prompting with vague segmentation mask #327

Open
mano3-1 opened this issue Sep 24, 2024 · 2 comments
Open

Prompting with vague segmentation mask #327

mano3-1 opened this issue Sep 24, 2024 · 2 comments

Comments

@mano3-1
Copy link

mano3-1 commented Sep 24, 2024

Hi,

I tried prompting the model with a vague segmentation mask that I obtained from another model. The prompt isn’t very accurate, but it at least covers the object of interest. I expected SAM2 to refine the mask more precisely, but the results are not better.

Here is the mask prompt:
image

And result from SAM:
image

There are small patches scattered on the right side, and the left side of the mask is completely off.

What could be the reason? Does SAM2 always need a point/box to refine the masks?

@Caspeerrr
Copy link

One thing you could try is transforming the segmentation mask to a bounding box and using that as input to sam2:
torchvision.ops.masks_to_boxes

@chayryali
Copy link
Contributor

This behavior is not surprising because the mask prompt here spans multiple objects. Prompts are expected to correspond to one object (or a part or sub-part of an object) but not multiple objects.

Can you try prompting with mask prompts corresponding to one object?

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

3 participants