-
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
Make the resize anchor edge variable if size is scalar #2868
Comments
An alternative to this, with is widely used in detection models and is present already in Faster R-CNN in torchvision
is to provide additionally a max_size argument, with the criteria that, if after rescaling the max size is larger than max_size , then the image will be rescaled back so that it respects max_size .
So the constraint would be that either Thoughts? |
That covers the two (most-important) cases ( |
I might be missing something but it seems that the two proposals are orthogonal and compatible. |
@NicolasHug |
My understanding of Basically I think we can do what you proposed in #2868 (comment), and also add |
Yeah, I was wrong about that. Basically the two proposals would behave as follows individually:
The combinations IMO putting both functionalities into |
I agree that @fmassa would you mind sharing your thoughts on:
My personal opinion is that they're (mostly) orthogonal concepts and that usage wouldn't be confusing as long as docs are properly informative. But I'm not familiar enough with the use-cases to really assess whether the added complexity is worth it. |
If we allow the user to chose an anchor, |
@NicolasHug I think adding both would hurt readability and understandability of the function, even if the documentation tries to make it clear. It's just going to be too much branching in the function, and it will probably confuse more than one user. Let's have a look at what some other libraries have done about this:
I'd love to see what some other libraries have done on this regard. |
From what I can tell, detectron2's Regarding the other transforms, they don't allow I could not find similar things in classyvision or in PIL |
I think we can close this now that #8459 allows Resize to resize the longest edge to |
🚀 Feature
Make the resize anchor edge variable if size is scalar.
Motivation
Right now
torchvision.transforms.Resize()
assumes that the smaller edge of the image should be resized to size if its anint
.vision/torchvision/transforms/transforms.py
Lines 239 to 240 in d1e134c
That can be cumbersome if the user wants for example an image that is not larger than x or wants a specific edge to be this size.
Pitch
I propose we add a
edge
keyword argument which can be one of"short"
(default),"long"
,"vert"
, and"horz"
. Based on this we calculate the size.cc @vfdev-5
The text was updated successfully, but these errors were encountered: