Simplify standard parameters of augmenters #567
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
anddeterministic
.The new parameters are
seed
andname
.deterministic
is removed as it was hardly ever used and becauseit 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 getthe 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 viaimgaug.random.seed()
(affects only augmenters without theirown seed).)
random_state
is renamed toseed
as providing a seed valueis the more common use case compared to providing a random state.
Many users also seemed to be unaware that
random_state
acceptedseed values. The new name should make this more clear.
The old parameter
random_state
is still accepted, but willlikely be deprecated in the future.
[breaking] This patch breaks if one relied on the order of
name
andrandom_state
instead of their names. These parametersare now in inverted order, i.e.
(..., seed=None, name=None, ...)
as seeds are much more commonly used than names.