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

MaskFormer post_process_instance_segmentation bug fix convert out side of loop #25497

Conversation

amyeroberts
Copy link
Collaborator

What does this PR do?

Resolves a bug in post processing logic in MaskFormer and Mask2Former.

If return_coco_annotation is set to True the generated segmentation map was converted to RLE before finishing iterating over all of the queries. This breaks the assumption that segmentation is an array of the same shape as pred_masks here in the for loop.

Fixes #25486

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

@amyeroberts amyeroberts changed the title Bug fix - convert out side of loop MaskFormer post_process_instance_segmentation bug fix convert out side of loop Aug 14, 2023
@amyeroberts amyeroberts requested a review from sgugger August 14, 2023 13:17
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 14, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a 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!

@amyeroberts amyeroberts merged commit 80f29a2 into huggingface:main Aug 14, 2023
@amyeroberts amyeroberts deleted the fix-return-coco-mask2former-maskformer branch August 14, 2023 15:01
@MayChi22
Copy link

Hi,
I am using transformers Version: 4.32.0.dev0,
do you have an estimated time to release a version with this fix?
thanks

@amyeroberts
Copy link
Collaborator Author

@MayChi22 We release a new version roughly every month, so there will likely be a new release in a few weeks.

blbadger pushed a commit to blbadger/transformers that referenced this pull request Nov 8, 2023
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

Successfully merging this pull request may close these issues.

Mask2Former post-processing RLE
4 participants