Skip to content

Proto transform cleanup #6408

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 14 commits into from
Aug 16, 2022
Merged

Proto transform cleanup #6408

merged 14 commits into from
Aug 16, 2022

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Aug 12, 2022

This is cleanup for the prototype transforms. It includes the following changes that were put in individual commits for easier review:

  1. Fix the TenCrop transform. The calls for PIL and simple tensor images were missing the vertical_flip flag.
  2. Use the F.adjust_{brightness, saturation, contrast, hue} dispatchers in RandomPhotometricDistort rather than relying on the ColorJitter transform.
  3. Add a convert_color_space dispatcher and use it in the ConvertColorSpace as well as in the deprecated Grayscale and RandomGrayScale transforms.

@pmeier pmeier requested a review from datumbox August 12, 2022 12:05
@datumbox datumbox requested a review from vfdev-5 August 12, 2022 12:17
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.

Looks mostly OK @pmeier. A couple of comments to discuss but nothing too problematic. Let me know below to agree.

@vfdev-5 Please have also a look.

Also let's always include all 3 of us in the reviews to make sure we remain aligned.

@pmeier pmeier requested a review from datumbox August 15, 2022 00:54
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.

Thanks @pmeier. I've added 2 nits but overall looks good.

@vfdev-5 any thoughts?

@pmeier
Copy link
Collaborator Author

pmeier commented Aug 15, 2022

As discussed offline, this PR will also replace the apply_recursively calls with torch.utils._pytree.tree_map to avoid custom code.

@pmeier pmeier requested a review from datumbox August 16, 2022 08:26
@pmeier
Copy link
Collaborator Author

pmeier commented Aug 16, 2022

query_recursively can also be removed, but it is a little more complicated. I'll do that in a separate PR when we have finished porting the transforms.

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.

LGTM, thanks! Just an optional nit for your attention.

@pmeier pmeier merged commit c0ba3ec into pytorch:main Aug 16, 2022
@pmeier pmeier deleted the proto-transform-cleanup branch August 16, 2022 09:11
facebook-github-bot pushed a commit that referenced this pull request Aug 24, 2022
Summary:
* fix TenCrop

* use dispatchers for RandomPhotometricDistort

* add convert_color_space dispatcher and use it in conversion transforms

* fix convert_color_space naming scheme

* add to_color_space method to Image feature

* remove TODO from BoundingBox.to_format()

* fix test

* fix imports

* fix passthrough

* remove apply_recursively in favor of pytree

* refactor BatchMultiCrop

Reviewed By: datumbox

Differential Revision: D38824225

fbshipit-source-id: 9f40885dd19e9ba701a02e209ab8839acca0fc76
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