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

Segmentation label map #42

Closed
rose-jinyang opened this issue Mar 31, 2023 · 2 comments
Closed

Segmentation label map #42

rose-jinyang opened this issue Mar 31, 2023 · 2 comments
Labels
question Further information is requested

Comments

@rose-jinyang
Copy link

Hello
How are you?
Thanks for contributing to this project.
I want to get one segmentation map containing all the class labels rather than binary mask for each instance.
How can I get it?

@praeclarumjj3
Copy link
Member

Hi, you can run a loop to aggregate all the predicted binary masks:

# create an all-zeros mask
single_channel_mask = torch.zeros_like(image)

# loop through all instance masks
for cls_id, mask in zip(result.pred_classes, result.pred_masks):
    mask *= cls_id
    single_channel_mask = torch.max(single_channel_mask, mask)

@praeclarumjj3 praeclarumjj3 added the question Further information is requested label Apr 1, 2023
@rose-jinyang
Copy link
Author

Thanks for your help.

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

No branches or pull requests

2 participants