-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Fix MaskFormerImageProcessor.post_process_instance_segmentation #21256
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
NielsRogge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing! Should we add a corresponding test for it, which verifies the postprocessed results?
I added a test but Mask2Former, unlike MaskFormer, outputs segmentation maps of shape (96, 96) instead of the preprocessed input size for efficiency. They scale the mask logits to the preprocessed image size during postprocessing (same for semantic and panoptic segmentation), even if no What do you think @NielsRogge @sgugger? |
|
If postprocessing is different, then it indeed requires its own image processor class. |
* fix instance segmentation post processing * add Mask2FormerImageProcessor
What does this PR do?
Fixes the
post_process_instance_segmentationmethod ofMaskFormerImageProcessor. This issue mainly affects Mask2Former as it uses MaskFormerImageProcessor and there aren't any MaskFormer models trained on instance segmentation datasets.Unlike panoptic segmentation post-processing, the final score of each binary mask proposal is calculated by multiplying the mask proposal score with the class score.
mask_thresholdandoverlap_mask_area_thresholdarguments are not needed anymore, I can either add a warning to deprecate them or leave it as it is for now.Post-processed results of the

mask2former-swin-small-coco-instancemodel inference:Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.