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

Simplify standard parameters of augmenters #567

Merged
merged 1 commit into from
Jan 13, 2020
Merged

Conversation

aleju
Copy link
Owner

@aleju aleju commented Jan 12, 2020

Change the standard parameters shared by all augmenters to a
reduced and more self-explanatory set. Previously, all augmenters
shared the parameters name, random_state and deterministic.
The new parameters are seed and name.

deterministic is removed as it was hardly ever used and because
it caused frequently confusion with regards to its meaning. The
parameter is still accepted but will now produce a deprecation
warning. Use <augmenter>.to_deterministic() instead.
(Reminder: to_deterministic() is necessary if you want to get
the same samples in consecutive augmentation calls. It is not
necessary if you want your generated samples to be dependent on
an initial seed or random state as that is always the case
anyways. You only have to manually set the seed, either
augmenter-specific via the seed parameter or global via
imgaug.random.seed() (affects only augmenters without their
own seed).)

random_state is renamed to seed as providing a seed value
is the more common use case compared to providing a random state.
Many users also seemed to be unaware that random_state accepted
seed values. The new name should make this more clear.
The old parameter random_state is still accepted, but will
likely be deprecated in the future.

[breaking] This patch breaks if one relied on the order of
name and random_state instead of their names. These parameters
are now in inverted order, i.e. (..., seed=None, name=None, ...)
as seeds are much more commonly used than names.

@aleju aleju changed the title Simplify standard parameters of augmenters [WIP] Simplify standard parameters of augmenters Jan 12, 2020
@codecov-io
Copy link

codecov-io commented Jan 12, 2020

Codecov Report

Merging #567 into master will decrease coverage by 0.01%.
The diff coverage is 95.38%.

@@            Coverage Diff             @@
##           master     #567      +/-   ##
==========================================
- Coverage   96.49%   96.48%   -0.01%     
==========================================
  Files          40       40              
  Lines       14537    14550      +13     
==========================================
+ Hits        14027    14038      +11     
- Misses        510      512       +2

Change the standard parameters shared by all augmenters to a
reduced and more self-explanatory set. Previously, all augmenters
shared the parameters `name`, `random_state` and `deterministic`.
The new parameters are `seed` and `name`.

`deterministic` is removed as it was hardly ever used and because
it caused frequently confusion with regards to its meaning. The
parameter is still accepted but will now produce a deprecation
warning. Use `<augmenter>.to_deterministic()` instead.
(Reminder: `to_deterministic()` is necessary if you want to get
the same samples in consecutive augmentation calls. It is *not*
necessary if you want your generated samples to be dependent on
an initial seed or random state as that is *always* the case
anyways. You only have to manually set the seed, either
augmenter-specific via the `seed` parameter or global via
`imgaug.random.seed()` (affects only augmenters without their
own seed).)

`random_state` is renamed to `seed` as providing a seed value
is the more common use case compared to providing a random state.
Many users also seemed to be unaware that `random_state` accepted
seed values. The new name should make this more clear.
The old parameter `random_state` is still accepted, but will
likely be deprecated in the future.

**[breaking]** This patch breaks if one relied on the order of
`name` and `random_state` instead of their names. These parameters
are now in inverted order, i.e. `(..., seed=None, name=None, ...)`
as seeds are much more commonly used than names.
@aleju aleju force-pushed the augmenter_init_args branch from e008f24 to c8c8540 Compare January 13, 2020 20:16
@aleju aleju changed the title [WIP] Simplify standard parameters of augmenters Simplify standard parameters of augmenters Jan 13, 2020
@aleju aleju merged commit a5207c7 into master Jan 13, 2020
@aleju aleju deleted the augmenter_init_args branch January 13, 2020 20:24
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