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

Can you save sections of the image that are masked after using SegAutoMaskPredictor() #83

Open
ksd3 opened this issue Jun 28, 2023 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@ksd3
Copy link

ksd3 commented Jun 28, 2023

I can't find this in the documentation. After running results = SegAutoMaskPredictor().image_predict(
source="firststeve.png",
model_type="vit_h", # vit_l, vit_h, vit_b
points_per_side=4,
points_per_batch=16,
min_area=0,
output_path="output.png",
show=False,
save=True,
)

I can save the segmented image, but I can't pull out the individual segmented pieces. Does this package support doing something like this or do I have to use the original repository? I just want to know if something like this exists:
image

@onuralpszr onuralpszr added enhancement New feature or request question Further information is requested labels Jun 28, 2023
@kadirnar
Copy link
Owner

Hi, do you want to save every segmented object?

@ksd3
Copy link
Author

ksd3 commented Jun 29, 2023

Yes, I want to save every segmented object. I know this can be done (tediously) by inspecting each bbox variable (that is the result of SamAutomaticMaskGenerator from the original repository) and cropping the image based on the xywh format but I wondered if there was a way to do it faster using metaseg.

@kadirnar
Copy link
Owner

I will add this feature but I am busy right now. It may take some time to add. If you want to add, I can help.

@kadirnar kadirnar added the help wanted Extra attention is needed label Jun 29, 2023
@ksd3
Copy link
Author

ksd3 commented Jun 29, 2023

I can try and add it. Which subroutine uses the results of SamAutomaticMaskGenerator? Presumably the method would just be a function that calls PIL.crop() based on the masks. That should be fairly easy to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants