-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Fix bug on prototype pad
#6949
Conversation
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.
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: |
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.
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.
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.
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:]
The following failing test is unrelated:
|
originally found at #6945, I split the work to reduce complexity on the other PR.
We address comments:
cc @vfdev-5 @bjuncek @pmeier