Skip to content

Add RandomApply, RandomChoice, RandomOrder transformations #402

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 2 commits into from
Feb 12, 2018

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Jan 28, 2018

Some handful classes to randomly apply list of transformations:

  1. Random apply: applies a list of transformation with a probability
RandomApply(
            [
                transforms.RandomRotation((-45, 45)),
                transforms.RandomHorizontalFlip(),
                transforms.RandomVerticalFlip(),
            ], proba=0.75
)
  1. Random choice: choose randomly a single transformation from a list
  2. Random order: apply transformations in a random order

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Feb 10, 2018

Any feedback on the PR is highly appreciated :)

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

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

Looks useful, thanks!

I have a minor comment: for consistency with other transforms, might be better to rename proba with p. What do you think?


Args:
transforms (list or tuple): list of transformations
proba (float): probability

This comment was marked as off-topic.

This comment was marked as off-topic.

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Feb 12, 2018

@fmassa fixed

@fmassa fmassa merged commit 7500373 into pytorch:master Feb 12, 2018
@vfdev-5 vfdev-5 deleted the random_transforms branch February 12, 2018 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants