-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Undeprecate ToGrayScale transforms and functionals #7122
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
Conversation
pmeier
left a comment
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.
Just a heads-up.
| ) | ||
| return Image.wrap_like(self, output) | ||
|
|
||
| def to_grayscale(self, num_output_channels: Literal[1, 3] = 1) -> Image: |
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.
Should the method be called rgb_to_grayscale() instead? Or just grayscale()?
Right now the class is called Grayscale(), the functionals are called rgb_to_grayscale...(). Keeping to_grayscale() for the methods seem like adding even more inconsistency, but IDK which one to go for.
We also have the to_grayscale() functional outlier in the v1 area which only works on PIL images (that we probably want to deprecate as discussed before).
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.
shoot, I merged before we got a chance to address that. Any thought @pmeier?
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 would keep consistency with the dispatchers, i.e. naming this rgb_to_grayscale.
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.
Following up in #7136
|
Should be ready for a review now @pmeier |
|
|
||
| from torchvision.prototype import datapoints | ||
| from torchvision.prototype.transforms import functional as F, Transform | ||
| from typing_extensions import Literal |
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 should be consistent here. Sometimes you are using : int over Literal[1, 3]. I'm not going to oppose the removal the removal, but I personally would keep it given that it is going to become a language feature really soon: #7110 (comment)
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.
Literal isn't supported by torchscript. I had it everywhere, but had to remove it later on. LMK if you prefer int vs Literal for the non-JIT cases
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.
No, let's strife for consistency.
pmeier
left a comment
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.
LGTM, thanks Nicolas!
|
Hey @NicolasHug! You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py |
Reviewed By: vmoens Differential Revision: D43116107 fbshipit-source-id: 0479e507930136a3eb0dd2ca761c795f07e1e004
cc @bjuncek @pmeier