-
Notifications
You must be signed in to change notification settings - Fork 7k
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
[BC-breaking] Unified input for F.perspective #2558
[BC-breaking] Unified input for F.perspective #2558
Conversation
…-5/issue-2292-perspective
- added tests - updated docs
983aaca
to
205051e
Compare
Codecov Report
@@ Coverage Diff @@
## master #2558 +/- ##
==========================================
+ Coverage 71.81% 72.07% +0.25%
==========================================
Files 94 94
Lines 8080 8244 +164
Branches 1282 1353 +71
==========================================
+ Hits 5803 5942 +139
- Misses 1868 1872 +4
- Partials 409 430 +21
Continue to review full report at Codecov.
|
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.
Thanks a lot for the PR @vfdev-5 , looks great!
I think we should do something wrt the silent change of behavior in the interpolation mode, otherwise it can be very confusing for users.
torchvision/transforms/functional.py
Outdated
# RuntimeError: Expected type hint for result of tolist() | ||
return [float(i.item()) for i in res[:, 0]] |
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.
I believe you can do something like
output : List[float] = res.squeeze(1).tolist()
return output
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.
Sounds good, especially that we have min pyhon 3.6
torchvision/transforms/functional.py
Outdated
# set to bilinear interpolation | ||
interpolation = 2 |
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.
I'm not sure that silently changing the value requested by the user is a good thing to do here.
It is unfortunate that bicubic is not supported in PyTorch yet, but I think we should try to be consistent here (the user requested bicubic and we silently compute bilinear).
What about one of the following:
- change the default value for the whole function to be
BILINEAR
, and raise an error if BICUBIC is passed by the user, and add a[BC-breaking]
in the tile of the PR - raise a warning before switching the default value here to
bilinear
I think I would prefer option 1 here, as option 2 would by default raise warnings to the user.
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.
I agree, that silent changing the value is not good at all ! It was a full-moon or something :) Sorry about that !
I'll remove this part of code. Error is raised inside F_t.affine
if resample is not support:
https://github.com/pytorch/vision/pull/2558/files#diff-77c635250f0215f979b2650c383ecbecL637
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.
Looks great, thanks!
* [WIP] Added unified input perspective transformation code * Unified input for F.perspective - added tests - updated docs * Added more random test configs * Fixed the code according to PR's review
Related to #2292
Description:
BC-breaking change because we changed the default value of
interpolate
to beBILINEAR
instead ofBICUBIC
forperspective