Skip to content

fixes #100 Transform synchronization #128

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 5 commits into from
Mar 4, 2020
Merged

fixes #100 Transform synchronization #128

merged 5 commits into from
Mar 4, 2020

Conversation

wyli
Copy link
Contributor

@wyli wyli commented Feb 28, 2020

Fixes #100.

Description

  • upgrades UniformRandomPatch to use randomizable interface
  • adds UniformRandomPatchd dictionary-based interface
  • upgrades Compose to use randomizable interface
  • fixes spelling randomise -> randomize

transform sync is done by setting random augmentation's internal random states
alternatively it could be done by the dictionary-based transform

Status

Ready

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New tests added to cover the changes
  • Docstrings/Documentation updated

@wyli wyli force-pushed the random-patch-transform branch from 056d303 to 22e28e5 Compare February 28, 2020 23:40
@atbenmurray
Copy link
Contributor

atbenmurray commented Mar 3, 2020

During discussions that we had about the use of RandomState, we had a signature more like the following:

class ATransform:
    def __init__(self, arg1, arg2, seed=12345678, rng=None):
        self.rng = RandomState(seed) if rng is None else rng
        ...

This allows a user to set a seed or RandomState object, which might be useful when picking up training from a partially trained, deserialised model

@wyli
Copy link
Contributor Author

wyli commented Mar 3, 2020

During discussions that we had about the use of RandomState, we had a signature more like the following:

class ATransform:
    def __init__(self, arg1, arg2, seed=12345678, rng=None):
        self.rng = RandomState(seed) if rng is None else rng
        ...

This allows a user to set a seed or RandomState object, which might be useful when picking up training from a partially trained, deserialised model

yes that is done by set_random_state(seed=, rng=) of each randomisable transform and merged in a previous PR.

This PR wants to add composed.set_random_state(seed=, rng=) to address ticket 100, where composed is:

composed = monai.transforms.compose.Compose([
        RandTransform_1(), RandTransform_2(), ...
])

Copy link
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Looks good to me now.

@wyli wyli merged commit fbc4b5c into master Mar 4, 2020
@wyli wyli deleted the random-patch-transform branch April 6, 2020 13:36
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.

Transform synchronization
3 participants