Skip to content
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

move parameter sampling of RandomPhotometricDistort into _get_params #7442

Merged
merged 3 commits into from
Mar 22, 2023

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Mar 22, 2023

This violated our requirement that parameters will only be sampled once. Meaning, without this PR, you will get multiple different distortions when passing multiple images.

cc @vfdev-5

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 22, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/7442

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@@ -228,19 +228,22 @@ def __init__(

def _get_params(self, flat_inputs: List[Any]) -> Dict[str, Any]:
num_channels, *_ = query_chw(flat_inputs)
return dict(
zip(
["brightness", "contrast1", "saturation", "hue", "contrast2"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure why we went for "contrast1" and "contrast2" before. Since we have the additional "contrast_before" flag, it is guaranteed, that they will never be applied at the same time. Meaning, there is no point in sampling them twice.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks Philip, LGTM.

We should try to remember to add such consistency tests to the V2 transforms tests

@pmeier pmeier merged commit 18a2e8e into pytorch:main Mar 22, 2023
@pmeier pmeier deleted the rng-RandomPhotometricDistort branch March 22, 2023 13:54
facebook-github-bot pushed a commit that referenced this pull request Mar 30, 2023
…t_params (#7442)

Reviewed By: vmoens

Differential Revision: D44416572

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

3 participants