Skip to content

Fix bug on prototype pad #6949

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

Merged
merged 2 commits into from
Nov 14, 2022
Merged

Conversation

datumbox
Copy link
Contributor

@datumbox datumbox commented Nov 14, 2022

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, otherwise LGTM if CI is green. Thanks Vasilis!

@@ -893,7 +909,18 @@ def crop_bounding_box(


def crop_mask(mask: torch.Tensor, top: int, left: int, height: int, width: int) -> torch.Tensor:
return crop_image_tensor(mask, top, left, height, width)
if mask.ndim < 3:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this handling here, because _pad_with_scalar_fill doesn't support 2d images, right? Otherwise, I don't see anything in crop_image_tensor that would require 3 or more dims.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. The issue come from pad:

  File "./vision/torchvision/prototype/transforms/functional/_geometry.py", line 890, in _pad_with_scalar_fill
    num_channels, height, width = shape[-3:]

@datumbox
Copy link
Contributor Author

The following failing test is unrelated:

=========================== short test summary info ============================
FAILED test/test_prototype_transforms_functional.py::TestKernels::test_against_reference[rotate_image_tensor-38] - AssertionError: The 'mean' of the absolute difference is 104.21571906354515, but only 100.0 is allowed.
Failure happened for the following parameters:

@datumbox datumbox merged commit c595886 into pytorch:main Nov 14, 2022
@datumbox datumbox deleted the prototype/bugfix_pad branch November 14, 2022 12:49
facebook-github-bot pushed a commit that referenced this pull request Nov 19, 2022
Reviewed By: YosuaMichael

Differential Revision: D41376282

fbshipit-source-id: da222edd80d695d3f52816a36a41667212a1b0a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants