Skip to content

port ColorJitter to prototype transforms #5656

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 7 commits into from
Mar 23, 2022

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Mar 21, 2022

Closes #5528.

@facebook-github-bot
Copy link

facebook-github-bot commented Mar 21, 2022

💊 CI failures summary and remediations

As of commit 242a4c9 (more details on the Dr. CI page):


None of the CI failures appear to be your fault 💚



🚧 3 ongoing upstream failures:

These were probably caused by upstream breakages that are not fixed yet.


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

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, just a couple of comments


# TODO: remove this helper if primitive transforms for F.adjust_{brightness, contrast, saturation, hue} are added
class _ColorJitterHelper(Transform):
def __init__(self, kernel_tensor: Callable, kernel_pil: Callable, *args: Any, **kwargs: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you propose an alternative approach to the nested private class? Here you document quite a few reasons not to use it (logging, instantiation in every call, non-pythonic etc). Should this be a private method for instance?

Also all these weird idioms we are forced to use are papercuts for not having a high-level dispatcher. There are alternatives we could explore that avoid this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you propose an alternative approach to the nested private class?

I've added a commit that moves the functionality into a method.

Also all these weird idioms we are forced to use are papercuts for not having a high-level dispatcher.

Yup.

There are alternatives we could explore that avoid this.

Do you have anything specific in mind? I've been thinking on this for quite some time, and I haven't found a solution besides having primitive transforms like I mentioned in the code comment or to reinstate the "high level dispatcher kernels".

@pmeier pmeier linked an issue Mar 22, 2022 that may be closed by this pull request
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.

@pmeier pmeier merged commit b29c553 into pytorch:main Mar 23, 2022
@pmeier pmeier deleted the transforms/color-jitter branch March 23, 2022 08:31
facebook-github-bot pushed a commit that referenced this pull request Apr 5, 2022
Summary:
* port ColorJitter to prototype transforms

* make color module private

* address review comments

(Note: this ignores all push blocking failures!)

Reviewed By: datumbox

Differential Revision: D35216767

fbshipit-source-id: 74bda2fd0a315d6d824ec62cb155a320d77c4766
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.

Some of torchvision transforms have very limiting argument checks Port transforms.ColorJitter to prototype.transforms
4 participants