Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Fix] Fix dimension error when using slide inference with Mask2Former head#3752

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Joris-Kuehl-TU-Berlin wants to merge1 commit intoopen-mmlab:dev-1.x
base:dev-1.x
Choose a base branch
Loading
fromJoris-Kuehl-TU-Berlin:make-mask2former-slide-compatible

Conversation

@Joris-Kuehl-TU-Berlin
Copy link

@Joris-Kuehl-TU-BerlinJoris-Kuehl-TU-Berlin commentedAug 5, 2024
edited
Loading

Motivation

The methodpredict inmmseg/models/decode_heads/mask2former_head.py is incompatible with the'slide' inference mode.

To elaborate, on line 280 ofslide_inference inmmseg/models/segmentors/encoder_decoder.py, the key'img_shape' ofbatch_img_metas[0] is overwritten by the shape of the cropped image / sliding window.

In line 353 ofmmseg/models/decode_heads/decode_head.py, this is the first key that is used to get the target size for upsampling. As such,crop_seg_logits will have the same shape ascrop_img.

Inmmseg/models/decode_heads/mask2former_head.py, the first shape that is referenced as a target for upsampling is'pad_shape' instead. Sinceslide_inference does not overwrite this key, each cropped image is upsampled to the size of the full image, and then further padded with zeros byslide_inference, leading to a dimension mismatch when trying to add up the paddedcrop_seg_logits. This leads to the issue described in#3666.

Modification

I have simply adjusted the size selection inmmseg/models/decode_heads/mask2former_head.py to match that ofmmseg/models/decode_heads/decode_head.py. As a result, a dimension mismatch no longer occurs when using slide inference with a Mask2Former head.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@londumas
Copy link

Thank you for this PR, it works.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Joris-Kuehl-TU-Berlin@londumas

[8]ページ先頭

©2009-2025 Movatter.jp