Skip to content

More cleanup for prototype transforms #6500

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

Merged
merged 12 commits into from
Aug 26, 2022

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Aug 26, 2022

Addresses #6486 (comment).

  • Since we already have a ConvertImageDtype transform, I kept the name and exposed convert_image_dtype as is. This also aligns well with other conversion ops like convert_bounding_box_format.
  • I reduced the number of imports of torchvision.transforms inside the torchvision.prototype.transforms module. There are 3 places left that I don't think we can or should get rid of:
    • torchvision.prototype.transforms.functional.*: We have quite a few kernels that are just imported from the old API.
    • torchvision.prototype.transforms._deprecated: We opted to call the legacy kernels instead of reproducing the behavior with the new ones.
    • torchvision.prototype.transforms._utils: We use a number of utilities of the old transforms in the new ones. I moved them to this module to have them in one central place to avoid having each other module import them directly.
  • I left a couple of FIXME comments for minor stuff that I found during cleaning up. Maybe we can address them as part of this PR

Todo

  • get_dimensions
  • get_image_num_channels (new tmp name get_channels_dim() + alias for the old)
  • get_image_size (new tmp name get_spatial_dims() + alias for the of)

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts below:

pmeier added 5 commits August 26, 2022 13:36
Conflicts:
	torchvision/prototype/transforms/_misc.py
Conflicts:
	torchvision/prototype/transforms/_auto_augment.py
	torchvision/prototype/transforms/_color.py
	torchvision/prototype/transforms/_geometry.py
	torchvision/prototype/transforms/_meta.py
	torchvision/prototype/transforms/_misc.py
	torchvision/prototype/transforms/_utils.py
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions but LGTM.

@datumbox
Copy link
Contributor

You need to patch the tests as well. See this.

@pmeier pmeier merged commit 7245dc9 into pytorch:main Aug 26, 2022
@pmeier pmeier deleted the proto-transform-cleanup branch August 26, 2022 14:36
facebook-github-bot pushed a commit that referenced this pull request Aug 30, 2022
Summary:
* add aliases for hflip and vflip

* reduce imports from torchvision.transforms in torchvision.prototype.transforms

* add aliases for to_pil_image abd pil_to_tensor

* deprecate to_tensor

* add some FIXME cleanup comments

* address reviews

* add dimension getters

* undeprecate PILToTensor and ToPILImage

* address review

* fix test

Reviewed By: NicolasHug

Differential Revision: D39131018

fbshipit-source-id: a1fc5d9dfd1cd587f273674716105f59a01e6cf0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants