-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Improve default values of augmenters #582
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New defaults for CoarseDropout are: - p=(0.02, 0.1) - size_px=(3, 8) Also decreased min_size from 4 to 3.
New defaults for CoarseSaltAndPepper are: - p=(0.02, 0.1) - size_px=(3, 8) Also decreased min_size from 4 to 3.
New defaults for CoarseSalt are: - p=(0.02, 0.1) - size_px=(3, 8) Also decreased min_size from 4 to 3.
New defaults for CoarsePepper are: - p=(0.02, 0.1) - size_px=(3, 8) Also decreased min_size from 4 to 3.
Change defaults from noop to - mul_hue=(0.5, 1.5) - mul_saturation=(0.0, 1.7) (only used if user set none of the hue/saturation parameters)
Change defaults to: - scale=(0.0, 0.04) - nb_rows=(2, 4) - nb_cols=(2, 4)
Change defaults to: - alpha=(0.0, 40.0) - sigma=(4.0, 8.0)
Change defaults to: - nb_rows=(3, 10) - nb_cols=(3, 10) - max_steps=1
Changed defaults to: - scale=(0.9, 1.1) - translate_percent={"x": (-0.1, 0.1), "y": (-0.1, 0.1)} - rotate=(-15, 15) - shear={"x": (-10, 10), "y": (-10, 10)} These defaults are only used if no affine transformation parameter was set by the user. Otherwise the not-set parameters default again towards the identity function.
Changed defaults to: - p_replace=(0.5, 1.0) - n_segments=(50, 120)
Changed defaults to: - n_points=(50, 500) - p_replace=(0.5, 1.0)
Change defaults to: - n_rows=(10, 30) - n_cols=(10, 30) - p_drop_points=(0.0, 0.5) - p_replace=(0.5, 1.0)
Change defaults to: - n_rows_frac=(0.05, 0.15) - n_cols=(0.05, 0.15) - p_drop_points=(0.0, 0.5) - p_replace=(0.5, 1.0)
Change default of percent to (-0.2, 0.2), iff the user has provided neither the parameter `px` nor `percent`. Otherwise only the user-set parameter is used.
Change default of `percent` to `(0.0, 0.1)`, iff the user has provided neither the parameter `px` not `percent`. Otherwise only the user-set parameter is used.
Change default of `percent` to `(0.0, 0.1)`, iff the user has provided neither the parameter `px` not `percent`. Otherwise only the user-set parameter is used.
Codecov Report
@@ Coverage Diff @@
## master #582 +/- ##
==========================================
+ Coverage 96.48% 96.61% +0.12%
==========================================
Files 40 40
Lines 14548 15760 +1212
==========================================
+ Hits 14036 15225 +1189
- Misses 512 535 +23 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This should resolve #315.
[breaking] Most augmenters had previously default values that
made them equivalent to identify functions. Users had to explicitly
change the defaults to proper values in order to "activate"
augmentations. To simplify the usage of the library, the default
values of most augmenters were changed to medium-strength
augmentations. E.g.
Sequential([Affine(), UniformVoronoi(), CoarseDropout()])
should now produce decent augmentations.
A few augmenters were set to always-on, maximum-strength
augmentations. This is the case for:
Grayscale
(always fully grayscales images, useGrayscale((0.0, 1.0))
for random strengths)RemoveSaturation
(same asGrayscale
)Fliplr
(always flips images, useFliplr(0.5)
for 50%probability).
Flipud
(same as forFliplr
)TotalDropout
(always drops everything, useTotalDropout(0.1)
to drop everything for 10% of all images).Invert
(always inverts images, useInvert(0.1)
to invert10% of all images)
Rot90
(always rotates exactly once by 90 degrees,use
Rot90((0, 4))
for any rotation)These settings seemed to better match user-expectations.
Such maximum-strength settings however were not chosen for all
augmenters. Some exceptions where one might expect that are e.g.
Superpixels
(replaces only some superpixels with cellwise averagecolors),
UniformVoronoi
(also only replaces some cells),Sharpen
(alpha-blends with variable strength, the same isthe case for
Emboss
,EdgeDetect
andDirectedEdgeDetect
)and
CLAHE
(variable clip limits).Note: Some of the new default values will cause issues with
non-
uint8
inputs.Note: The defaults for
per_channel
andkeep_size
were notadjusted. It is currently still the default behaviour of all
augmenters to affect all channels in the same way and to resize
their outputs back to the input sizes.
The changes to default values are listed below.
imgaug.arithmetic
Add
value
:0
->(-20, 20)
AddElementwise
value
:0
->(-20, 20)
AdditiveGaussianNoise
scale
:0
->(0, 15)
AdditiveLaplaceNoise
scale
:0
->(0, 15)
AdditivePoissonNoise
scale
:0
->(0, 15)
Multiply
mul
:1.0
->(0.8, 1.2)
MultiplyElementwise
:mul
:1.0
->(0.8, 1.2)
Dropout
:p
:0.0
->(0.0, 0.05)
CoarseDropout
:p
:0.0
->(0.02, 0.1)
size_px
:None
->(3, 8)
min_size
:4
->3
size_px
is only used if neithersize_percent
not
size_px
is provided by the user.CoarseSaltAndPepper
:p
:0.0
->(0.02, 0.1)
size_px
:None
->(3, 8)
min_size
:4
->3
size_px
is only used if neithersize_percent
not
size_px
is provided by the user.CoarseSalt
:p
:0.0
->(0.02, 0.1)
size_px
:None
->(3, 8)
min_size
:4
->3
size_px
is only used if neithersize_percent
not
size_px
is provided by the user.CoarsePepper
:p
:0.0
->(0.02, 0.1)
size_px
:None
->(3, 8)
min_size
:4
->3
size_px
is only used if neithersize_percent
not
size_px
is provided by the user.SaltAndPepper
:p
:0.0
->(0.0, 0.03)
Salt
:p
:0.0
->(0.0, 0.03)
Pepper
:p
:0.0
->(0.0, 0.05)
ImpulseNoise
:p
:0.0
->(0.0, 0.03)
Invert
:p
:0
->1
JpegCompression
:compression
:50
->(0, 100)
imgaug.blend
BlendAlpha
factor
:0
->(0.0, 1.0)
BlendAlphaElementwise
factor
:0
->(0.0, 1.0)
imgaug.blur
GaussianBlur
:sigma
:0
->(0.0, 3.0)
AverageBlur
:k
:1
->(1, 7)
MedianBlur
:k
:1
->(1, 7)
BilateralBlur
:d
:1
->(1, 9)
MotionBlur
:k
:5
->(3, 7)
imgaug.color
MultiplyHueAndSaturation
:mul_hue
:None
->(0.5, 1.5)
mul_saturation
:None
->(0.0, 1.7)
mul
normul_hue
normul_saturation
.MultiplyHue
:mul
:(-1.0, 1.0)
->(-3.0, 3.0)
AddToHueAndSaturation
:value_hue
:None
->(-40, 40)
value_saturation
:None
->(-40, 40)
value
norvalue_hue
norvalue_saturation
.Grayscale
:alpha
:0
->1
imgaug.contrast
GammaContrast
:gamma
:1
->(0.7, 1.7)
SigmoidContrast
:gain
:10
->(5, 6)
cutoff
:0.5
->(0.3, 0.6)
LogContrast
:gain
:1
->(0.4, 1.6)
LinearContrast
:alpha
:1
->(0.6, 1.4)
AllChannelsCLAHE
:clip_limit
:40
->(0.1, 8)
tile_grid_size_px
:8
->(3, 12)
CLAHE
:clip_limit
:40
->(0.1, 8)
tile_grid_size_px
:8
->(3, 12)
convolutional
Sharpen
:alpha
:0
->(0.0, 0.2)
lightness
:1
->(0.8, 1.2)
Emboss
:alpha
:0
->(0.0, 1.0)
strength
:1
->(0.25, 1.0)
EdgeDetect
:alpha
:0
->(0.0, 0.75)
DirectedEdgeDetect
:alpha
:0
->(0.0, 0.75)
imgaug.flip
Fliplr
:p
:0
->1
Flipud
:p
:0
->1
imgaug.geometric
Affine
:scale
:1
->{"x": (0.9, 1.1), "y": (0.9, 1.1)}
translate_percent
: None ->{"x": (-0.1, 0.1), "y": (-0.1, 0.1)}
rotate
:0
->(-15, 15)
shear
:0
->shear={"x": (-10, 10), "y": (-10, 10)}
parameter was set by the user. Otherwise the not-set
parameters default again towards the identity function.
PiecewiseAffine
:scale
:0
->(0.0, 0.04)
nb_rows
:4
->(2, 4)
nb_cols
:4
->(2, 4)
PerspectiveTransform
:scale
:0
->(0.0, 0.06)
ElasticTransformation
:alpha
:0
->(0.0, 40.0)
sigma
:0
->(4.0, 8.0)
Rot90
:k
:(no default)
->k=1
imgaug.pooling
AveragePooling
:k
:(no default)
->(1, 5)
MaxPooling
:k
:(no default)
->(1, 5)
MinPooling
:k
:(no default)
->(1, 5)
MedianPooling
:k
:(no default)
->(1, 5)
imgaug.segmentation
Superpixels
:p_replace
:0.0
->(0.5, 1.0)
n_segments
:100
->(50, 120)
UniformVoronoi
:n_points
:(no default)
->(50, 500)
p_replace
:1.0
->(0.5, 1.0)
.RegularGridVoronoi
:n_rows
:(no default)
->(10, 30)
n_cols
:(no default)
->(10, 30)
p_drop_points
:0.4
->(0.0, 0.5)
p_replace
:1.0
->(0.5, 1.0)
RelativeRegularGridVoronoi
: Changed defaults fromn_rows_frac
:(no default)
->(0.05, 0.15)
n_cols_frac
:(no default)
->(0.05, 0.15)
p_drop_points
:0.4
->(0.0, 0.5)
p_replace
:1.0
->(0.5, 1.0)
imgaug.size
CropAndPad
:percent
:None
->(-0.1, 0.1)
neither
px
norpercent
.Pad
:percent
:None
->(0.0, 0.1)
neither
px
norpercent
.Crop
:percent
:None
->(0.0, 0.1)
neither
px
norpercent
.