-
Notifications
You must be signed in to change notification settings - Fork 126
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
How to generate instance mask, only one channel? #27
Comments
Hi @rockywind, thanks for your interest in our work. If I understand your question correctly, you want to generate a single-channel segmentation mask for the instance segmentation predictions. Please provide more description about your issue if this is not the case. You can loop through the OneFormer/oneformer/oneformer_model.py Line 475 in 7611899
|
Hi, |
I believe you are talking about the semantic segmentation result, where each pixel corresponds to the corresponding object's category. You need to do an argmax operation on the semantic predictions to obtain those. Line 68 in 7611899
|
Right, that's what I thought you wanted to do. You can loop through the # create an all-zeros mask
single_channel_mask = torch.zeros_like(image) # or torch.zeros((1114, 2191))
count = 0
# loop through all instance masks
for mask in result.pred_masks:
count += 1
mask *= count
single_channel_mask = torch.max(single_channel_mask, mask) Let me know if you have any more issues. |
Thank you very much. |
No description provided.
The text was updated successfully, but these errors were encountered: