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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] kornia.Resize has a bad default for align_corners #777
Comments
I only know that you guys had problems with def parse_align_corners(
align_corners: Optional[bool], interpolation: str
) -> Optional[bool]:
if align_corners is not None:
return align_corners
return (
False
if interpolation in ("linear", "bilinear", "bicubic", "trilinear")
else None
) If you use that in the constructor of every transformation that has the |
Yes, you are right. We should make a better default. Should we set it to |
I wouldn't recommend that: import torch
import kornia
transform = kornia.Resize(32, interpolation="bilinear", align_corners=None)
input = torch.rand(1, 3, 16, 16)
transform(input)
To avoid the error and the warning, you need to set
Again, I wouldn't recommend that. What is special about def resize(..., interpolation="bilinear", align_corners=None):
align_corners = parse_align_corners(align_corners, interpolation)
... in every user-facing function or module that takes the |
I see. That is reasonable.
From what you proposed, this is a general setting that fits all functions with (align_corners, interpolation), right? I mean it is not only for resize. |
Sorry for the delay. I can give it a shot. |
@pmeier can you check #941 ? to see the next steps for augmentations and see hwo we could proceed with this ? /cc @shijianjian |
This appears to be fixed in the latest release. The following has no errors: transform = kornia.geometry.transform.Resize(32, interpolation="nearest") although the original error can be reproduced with: transform = kornia.geometry.transform.Resize(32, interpolation="nearest", align_corners=True) |
@pmeier shall we close this issue? |
馃悰 Bug
kornia.Resize
has a bad default foralign_corners
ifinterpolation=="nearest"
orinterpolation=="area"
.To Reproduce
Expected behavior
This should work out of the box. You need to explicitly set
align_corners=None
to get this working. This is neither documented nor even accepted by the type annotations.Environment
kornia==0.4.1
The text was updated successfully, but these errors were encountered: