introduce nearest-exact interpolation#6754
Conversation
| InterpolationMode.NEAREST: 0, | ||
| InterpolationMode.BILINEAR: 2, | ||
| InterpolationMode.BICUBIC: 3, | ||
| InterpolationMode.NEAREST_EXACT: 0, |
There was a problem hiding this comment.
The only instance of where we want the reverse mapping, i.e. from int to InterpolationMode, comes from the _interpolation_modes_from_int function above. AFAIK, this is only needed until the deprecation period for passing int's is over and will be removed afterwards. Is that true?
If yes, I think it is ok to also assign 0 as the Pillow interpolation mode here as we already do for InterpolationMode.NEAREST. For the Pillow side this makes sense, since they only have one nearest interpolation.
The only downside to this is that users cannot access InterpolationMode.NEAREST_EXACT through and int. But since that is deprecated anyway, I don't think this is an issue.
There was a problem hiding this comment.
I think as long as 0 is assigned back to InterpolationMode.NEAREST for BC, we should be OK.
|
A related and interesting question is: do we want to use Right now, we ignore the input vision/torchvision/prototype/features/_mask.py Lines 47 to 55 in 7d36d26 and simply hardcode Since this kernel did not exist before, there are no BC concerns here for using |
| InterpolationMode.NEAREST: 0, | ||
| InterpolationMode.BILINEAR: 2, | ||
| InterpolationMode.BICUBIC: 3, | ||
| InterpolationMode.NEAREST_EXACT: 0, |
There was a problem hiding this comment.
I think as long as 0 is assigned back to InterpolationMode.NEAREST for BC, we should be OK.
|
All good to me as well |
NicolasHug
left a comment
There was a problem hiding this comment.
LGTM but should we add some tests in the non-prototype area to make sure these work as expected?
(On a side note, we recently made this mode at least 2X faster on channels_last images pytorch/pytorch#86361)
Yes, we should. #6754 (comment)
2x faster compared to |
This one. There's nothing to do on torchvision's side to benefit from it, it'll come from core |
|
nearest and nearest-exact are doing almost the same computations except the way how weights were computed ... I'd expect the same perfs between them |
Summary: * introduce nearest-exact interpolation * update prototype tests * update stable tests Reviewed By: NicolasHug Differential Revision: D40427462 fbshipit-source-id: bc3064a7167c03e9d6bad21d523a3132e853b80f
Addresses the first part of #6645. As discussed offline with @datumbox, exposing this mode is non-controversial. Whether or not we should make it the default and how the transition period should look like is another matter entirely. Let's do that if more pressing matters are finished.
@vfdev I would like to have your input on how to test this properly on the stable transforms test.