- Added argument
output_buffer_size
tomulticore.Pool.imap_batches()
andmulticore.Pool.imap_batches_unordered()
to control the maximum number of batches in the background augmentation pipeline (allows to limit maximum RAM demands). - Increased
max_distance
thresholds foralmost_equals()
,exterior_almost_equals()
andcoords_almost_equals()
inPolygon
andLineString
from1e-6
to1e-4
. This should fix false-negative problems related to float inaccuracies. - Added module
imgaug.augmenters.edges
. - Added interface
augmenters.edges.BinaryImageColorizerIf
, which contains the interface for classes used to convert binary images to RGB images. - Added
augmenters.edges.RandomColorsBinaryImageColorizer
, which converts binary images to RGB images by sampling uniformly RGB colors forTrue
andFalse
values. - Added
augmenters.edges.Canny
, which applies canny edge detection with alpha blending and random coloring to images. - Renamed
imgaug/external/poly_point_isect.py
toimgaug/external/poly_point_isect_py3.py.bak
. The file is in the library only for completeness and contains python3 syntax.poly_point_isect_py2py3.py
is actually used. - Added dtype gating to
dtypes.clip_()
. - Added module
augmenters.pooling
. #317- Added
augmenters.pooling._AbstractPoolingBase
. #317 - Added
augmenters.pooling.AveragePooling
. #317 - Added
augmenters.pooling.MaxPooling
. #317 - Added
augmenters.pooling.MinPooling
. #317 - Added
augmenters.pooling.MedianPooling
. #317
- Added
augmenters.color.AddToHueAndSaturation
- [rarely breaking] Refactored
AddToHueAndSaturation
to clean it up. Re-running old code with the same seeds will now produce different images. #319 - [rarely breaking] The
value
parameter is now interpreted by the augmenter to return first the hue and then the saturation value to add, instead of the other way round. (This shouldn't affect anybody.) #319 - [rarely breaking] Added
value_hue
andvalue_saturation
arguments, which allow to set individual parameters for hue and saturation instead of having to use one parameter for both (they may not be set ifvalue
is already set). This changes the order of arguments of the augmenter and code that relied on that order will now break. This also changes the output ofAddToHueAndSaturation.get_parameters()
. #319
- [rarely breaking] Refactored
- Added
augmenters.color.AddToHue
, a shortcut forAddToHueAndSaturation(value_hue=...)
. #319 - Added
augmenters.color.AddToSaturation
, a shortcut forAddToHueAndSaturation(value_saturation=...)
. #319 - Added
augmenters.color.WithHueAndSaturation
. #319 - Added
augmenters.color.MultiplyHueAndSaturation
. #319 - Added
augmenters.color.MultiplyHue
. #319 - Added
augmenters.color.MultiplySaturation
. #319 - Refactored
augmenters/weather.py
(general code and docstring cleanup). #336 - [rarely breaking] Refactored
augmenters/convolutional.py
(general code and docstring cleanup). This involved changing the random state handling. Old seeds might now produce different result images for convolutional augmenters (Convolve
,Sharpen
,Emboss
,EdgeDetect
,DirectedEdgeDetect
). #335 - [rarely breaking] Added argument
polygon_recoverer
toaugmenters.geometric.PerspectiveTransform
. This changes the order of arguments of the augmenter and code that relied on that order will now break. #338 - Changed
_ConcavePolygonRecoverer
to not search for segment intersection points in polygons with very large absolute coordinate values. This prevents rare errors due to floating point inaccuracies. #338 - Changed
_ConcavePolygonRecoverer
to raise warnings instead of throwing exceptions when the underlying search for segment intersection points crashes. #338 - Added the library to
conda-forge
so it can now be installed viaconda install imgaug
(provided the conda-forge channel was added before that). #320 #339 - Changed dependency
opencv-python
toopencv-python-headless
. This should improve support for some system without GUIs. - Refactored code in
augmenters.segmentation
(general code and docstring cleanup). #334 - Refactored code in
augmenters.arithmetic
(general code and docstring cleanup). #328 - Added check to
dtypes.gate_dtypes()
verifying that argumentsallowed
anddisallowed
have no intersection. #346 - Added dependency
pytest-subtests
for the library's unittests. #366 - Added
imgaug.is_np_scalar()
, analogous toimgaug.is_np_array()
. #366 - Reworked and refactored code in
dtypes.py
(general code cleanup). #366- Added
dtypes.normalize_dtypes()
. - Added
dtypes.normaliz_dtypes()
. - Refactored
dtypes.promote_array_dtypes_()
to usedtypes.change_dtypes_()
. - Reworked dtype normalization. All functions in the module that required dtype inputs accept now dtypes, dtype functions, dtype names, ndarrays or numpy scalars.
- [rarely breaking]
dtypes.restore_dtypes_()
- Improved error messages.
- Changed so that if
images
is a list of lengthN
anddtypes
is a list of lengthM
andN!=M
, the function now raises anAssertionError
. - The argument
round
is now ignored if the input array does not have a float dtype.
- Renamed
dtypes.restore_dtypes_()
todtypes.change_dtypes_()
(old name still exists too and redirects to new name). - Added
dtypes.change_dtype_()
, analogous todtypes.change_dtypes_()
. - Added
dtypes.increase_itemsize_of_dtype()
.- Refactored
dtypes.get_minimal_dtype()
to use that new function.
- Refactored
- [rarely breaking] Removed
dtypes.get_minimal_dtype_for_values()
. The function was not used anywhere in the library. - [rarely breaking] Removed
dtypes.get_minimal_dtype_by_value_range()
. The function was not used anywhere in the library. - Changed
dtypes.get_value_range_of_dtype()
to return a float as the center value ofuint
dtypes. - [rarely breaking] Removed argument
affects
fromdtypes.promote_array_dtypes_()
as it was unnecessary and not used anywhere in the library. #366
- Added
- Added
imgaug.warn()
function. #367 - Changed
multicore.Pool
to produce a warning if it cannot find or call the functionmultiprocessing.cpu_count()
instead of silently failing. (In both cases it falls back to a default value.) #367 - Refactored code in
multicore
(general code and docstring cleanup). #367- Improved error messages in
multicore
.
- Improved error messages in
- Added
imgaug.min_pool()
. #369- Refactored
augmenters.pooling.MinPooling
to useimgaug.min_pool()
.
- Refactored
- Added
imgaug.median_pool()
. #369- Refactored
augmenters.pooling.MedianPooling
to useimgaug.median_pool()
.
- Refactored
- Added
imgaug.compute_paddings_to_reach_multiples_of()
. #369 - Added
imgaug.pad_to_multiples_of()
. #369 - Refactored
imgaug.pool()
to useimgaug.pad()
for image padding. #369 - [rarely breaking] Added a
pad_mode
argument toimgaug.pool()
,imgaug.avg_pool()
,imgaug.max_pool()
,imgaug.min_pool()
andimgaug.median_pool()
. This breaks code relying on the order of the functions arguments. #369- Changed the default
pad_mode
ofavg_pool
fromconstant
(cval=128
) toreflect
. - Changed the default
pad_mode
ofmax_pool
fromconstant
(cval=0
) toedge
. - Changed the default
pad_mode
ofmin_pool
fromconstant
(cval=255
) toedge
. - Changed the default
pad_mode
ofmedian_pool
fromconstant
(cval=128
) toreflect
.
- Changed the default
- Renamed argument
cval
topad_cval
inimgaug.pool()
,imgaug.avg_pool()
andimgaug.max_pool()
. The old namecval
is now deprecated. #369 - Added
augmenters.color._AbstractColorQuantization
. #347 - Added
augmenters.color.KMeansColorQuantization
and correspondingaugmenters.color.quantize_colors_kmeans()
. Both deal with quantizing similar colors using k-Means clustering. #347- Added a check script for
KMeansColorQuantization
underchecks/check_kmeans_color_quantization.py
. #347
- Added a check script for
- Added
augmenters.color.UniformColorQuantization
and correspondingaugmenters.color.quantize_colors_uniform()
. Both deal with quantizing similar colors using k-Means clustering. #347- Added a check script for
UniformColorQuantization
underchecks/check_uniform_color_quantization.py
. #347
- Added a check script for
- Added
imgaug.imgaug.normalize_random_state()
. #348 - Added
imgaug.augmenters.segmentation._ensure_image_max_size()
. #348 - Added
imgaug.augmenters.segmentation.PointsSamplerIf
. An interface for classes used for sampling (usually random) coordinate arrays on images. - Added
imgaug.augmenters.segmentation._verify_sample_points_images()
. #348 - Added
imgaug.augmenters.segmentation.RegularGridPointsSampler
. A class used to generate regular grids ofrows x columns
points on images. #348 - Added
imgaug.augmenters.segmentation.RelativeRegularGridPointsSampler
. Similar toRegularGridPointsSampler
, but number of rows/columns is set as fractions of image sizes, leading to more rows/columns for larger images. #348 - Added
imgaug.augmenters.segmentation.DropoutPointsSampler
. A class used to randomly dropp
percent of all coordinates sampled by another another points sampler. #348 - Added
imgaug.augmenters.segmentation.UniformPointsSampler
. A class used to sampleN
points on each image with y-/x-coordinates uniformly sampled using the corresponding image height/width. #348 - Added
imgaug.augmenters.segmentation.SubsamplingPointsSampler
. A class that ensures that another points sampler does not produce more thanN
points by subsampling a random subset of the produced points ifN
is exceeded. #348 - Added
imgaug.augmenters.segmentation.segment_voronoi()
. A function that converts an image into a voronoi image, i.e. averages the colors within voronoi cells placed on the image. #348- Also added in the same module the functions
_match_pixels_with_voronoi_cells()
,_generate_pixel_coords()
,_compute_avg_segment_colors()
,_render_segments()
.
- Also added in the same module the functions
- Added
imgaug.augmenters.segmentation.Voronoi
. An augmenter that converts an image to a voronoi image. #348- Added a check script for
Voronoi
inchecks/check_voronoi.py
.
- Added a check script for
- Added
imgaug.augmenters.segmentation.UniformVoronoi
, a shortcut forVoronoi(UniformPointsSamper)
. #348 - Added
imgaug.augmenters.segmentation.RegularGridVoronoi
, a shortcut forVoronoi(DropoutPointsSampler(RegularGridPointsSampler))
. #348 - Added
imgaug.augmenters.segmentation.RelativeRegularGridVoronoi
, a shortcut forVoronoi(DropoutPointsSampler(RelativeRegularGridPointsSampler))
. #348 - Add to
Resize
the ability to resize the shorter and longer sides of images (instead of only height/width). #349 - Improved the docstrings of most augmenters and added code examples. #302
- Changes to support numpy 1.17 #302
- [rarely breaking] Deactivated support for
int64
inimgaug.dtypes.clip_()
. This is due to numpy 1.17 turningint64
tofloat64
innumpy.clip()
(possible that this happened in some way before 1.17 too). - [rarely breaking] Changed
imgaug.dtypes.clip()
to never clipint32
in-place, asnumpy.clip()
turns it intofloat64
since 1.17 (possible that this happend in some way before 1.17 too). - [rarely breaking] Deactivated support for
int64
inReplaceElementwise
. Seeclip
issue above. - [rarely breaking] Changed
parameters.DiscreteUniform
to always return arrays of dtypeint32
. Previously it would automatically returnint64
. - [rarely breaking] Changed
parameters.Deterministic
to always returnint32
for integers and alwaysfloat32
for floats. - [rarely breaking] Changed
parameters.Choice
to limit integer dtypes toint32
or lower, uints touint32
or lower and floats tofloat32
or lower. - [rarely breaking] Changed
parameters.Binomial
andparameters.Poisson
to always returnint32
. - [rarely breaking] Changed
parameters.Normal
,parameters.TruncatedNormal
,parameters.Laplace
,parameters.ChiSquare
,parameters.Weibull
,parameters.Uniform
andparameters.Beta
to always returnfloat32
. - [rarely breaking] Changed
augmenters.arithmetic.Add
,augmenters.arithmetic.AddElementwise
,augmenters.arithmetic.Multiply
andaugmenters.arithmetic.MultiplyElementwise
to no longer internally increase itemsize of dtypes by a factor of 2 for dtypesuint16
,int8
anduint16
. ForMultiply*
this also coversfloat16
andfloat32
. This protects against crashes due to clippingint64
oruint64
data. In rare cases this can lead to overflows ifimage + random samples
orimage * random samples
exceeds the value range ofint32
oruint32
. This change may affect various other augmenters that are wrappers around the mentioned ones, e.g.AdditiveGaussianNoise
. - [rarely breaking] Decreased support of dtypes
uint16
,int8
,int16
,float16
,float32
andbool
inaugmenters.arithmetic.Add
,AddElementwise
,Multiply
andMultiplyElementwise
from "yes" to "limited". - [rarely breaking] Decreased support of dtype
int64
inaugmenters.arithmetic.ReplaceElementwise
from "yes" to "no". This also affects all*Noise
augmenters (e.g.AdditiveGaussianNoise
,ImpulseNoise
), allDropout
augmenters, allSalt
augmenters and allPepper
augmenters. - [rarely breaking] Changed
augmenters.contrast.adjust_contrast_log
and therebyLogContrast
to no longer support dtypesuint32
,uint64
,int32
andint64
.
- [rarely breaking] Deactivated support for
Augmentation of Segmentation Maps is now faster and more memory efficient.
This required some breaking changes to SegmentationMapOnImage
.
To adapt to the new version, the following steps should be sufficient for most
users:
- Rename all calls of
SegmentationMapOnImage
toSegmentationMapsOnImage
(Map -> Maps). - Rename all calls of
SegmentationMapsOnImage.get_arr_int()
toSegmentationMapsOnImage.get_arr()
. - Remove the argument
nb_classes
from all calls ofSegmentationMapsOnImage
. - Remove the arguments
background_id
andbackground_threshold
from all calls as these are no longer supported. - Ensure that the input array to
SegmentationMapsOnImage
is always an int-like (int, uint or bool). Float arrays are no longer accepted. - Adapt all calls
SegmentationMapsOnImage.draw()
andSegmentationMapsOnImage.draw_on_image()
, as both of these now return a list of drawn images instead of a single array. (For a segmentation map array of shape(H,W,C)
they returnC
drawn images. In most casesC=1
, so simply calldraw()[0]
ordraw_on_image()[0]
.) - Ensure that if
SegmentationMapsOnImage.arr
is accessed anywhere, the respective code can handle the newint32
(H,W,#maps)
array form. Previously it wasfloat32
and the channel-axis had the same size as the max class id (+1) that could appear in the map.
Changes:
- Changes to class
SegmentationMapOnImage
:- Renamed
SegmentationMapOnImage
to pluralSegmentationMapsOnImage
and deprecated the old name. This was changed due to the input array now being allowed to contain several channels, with each such channel containing one full segmentation map. - Changed
SegmentationMapsOnImage.__init__
to produce a deprecation warning for float arrays asarr
argument. - [breaking] Changed
SegmentationMapsOnImage.__init__
to no longer acceptuint32
and larger itemsizes asarr
argument, onlyuint16
and below is accepted. Forint
the allowed maximum isint32
. - Changed
SegmentationMapsOnImage.__init__
to always accept(H,W,C)
arr
arguments. - [breaking] Changed
SegmentationMapsOnImage.arr
to always beint32
(H,W,#maps)
(previously:float32
(H,W,#nb_classes)
). - Deprecated
nb_classes
argument inSegmentationMapsOnImage.__init__
. The argument is now ignored. - Added
SegmentationMapsOnImage.get_arr()
, which always returns a segmentation map array with similar dtype and number of dimensions as was originally input when creating a class instance. - Deprecated
SegmentationMapsOnImage.get_arr_int()
. The method is now an alias forget_arr()
. SegmentationMapsOnImage.draw()
:- [breaking] Removed argument
return_foreground_mask
and corresponding optional output. To generate a foreground mask for thec
-th segmentation map on a given image (usuallyc=0
), usesegmentation_map.arr[:, :, c] != 0
, assuming that0
is the integer index of your background class. - [breaking] Changed output of drawn image to be a list of arrays
instead of a single array (one per
C
in input array(H,W,C)
). - Refactored to be a wrapper around
SegmentationMapsOnImage.draw_on_image()
. - The
size
argument may now be any of: A singleNone
(keep shape), a single integer (use as height and width), a single float (relative change to shape) or a tuple of these values. ("shape" here denotes the value of the.shape
attribute.)
- [breaking] Removed argument
SegmentationMapsOnImage.draw_on_image()
:- [breaking] The argument
background_threshold
is now deprecated and ignored. Providing it will lead to a deprecation warning. - [breaking] Changed output of drawn image to be a list of arrays
instead of a single array (one per
C
in input array(H,W,C)
).
- [breaking] The argument
- Changed
SegmentationMapsOnImage.resize()
to use nearest neighbour interpolation by default. - [rarely breaking] Changed
SegmentationMapsOnImage.copy()
to create a shallow copy instead of being an alias fordeepcopy()
. - Added optional arguments
arr
andshape
toSegmentationMapsOnImage.copy()
. - Added optional arguments
arr
andshape
toSegmentationMapsOnImage.deepcopy()
. - Refactored
SegmentationMapsOnImage.pad()
,SegmentationMapsOnImage.pad_to_aspect_ratio()
andSegmentationMapsOnImage.resize()
to generate new object instances viaSegmentationMapsOnImage.deepcopy()
. - [rarely breaking] Renamed
SegmentationMapsOnImage.input_was
toSegmentationMapsOnImage._input_was
. - [rarely breaking] Changed
SegmentationMapsOnImage._input_was
to always save(input array dtype, input array ndim)
instead of mixtures of strings/ints that varied by dtype kind. - [rarely breaking] Restrict
shape
argument inSegmentationMapsOnImage.__init__
to tuples instead of accepting all iterables. - [breaking] Removed
SegmentationMapsOnImage.to_heatmaps()
as the new segmentation map class is too different to sustain the old heatmap conversion methods. - [breaking] Removed
SegmentationMapsOnImage.from_heatmaps()
as the new segmentation map class is too different to sustain the old heatmap conversion methods.
- Renamed
- Changes to class
Augmenter
:- [breaking] Automatic segmentation map normalization from arrays or
lists of arrays now expects a single
(N,H,W,C)
array (before:(N,H,W)
) or a list of(H,W,C)
arrays (before:(H,W)
). This affects valid segmentation map inputs forAugmenter.augment()
and its aliasAugmenter.__call__()
,imgaug.augmentables.batches.UnnormalizedBatch()
andimgaug.augmentables.normalization.normalize_segmentation_maps()
. - Added
Augmenter._augment_segmentation_maps()
. - Changed
Augmenter.augment_segmentation_maps()
to no longer be a wrapper aroundAugmenter.augment_heatmaps()
and instead callAugmenter._augment_segmentation_maps()
.
- [breaking] Automatic segmentation map normalization from arrays or
lists of arrays now expects a single
- Added special segmentation map handling to all augmenters that modified
segmentation maps
(
Sequential
,SomeOf
,Sometimes
,WithChannels
,Lambda
,AssertLambda
,AssertShape
,Alpha
,AlphaElementwise
,WithColorspace
,Fliplr
,Flipud
,Affine
,AffineCv2
,PiecewiseAffine
,PerspectiveTransform
,ElasticTransformation
,Rot90
,Resize
,CropAndPad
,PadToFixedSize
,CropToFixedSize
,KeepSizeByResize
).- [rarely breaking] This changes the order of arguments in
Lambda.__init__()
,AssertLambda.__init__()
,AssertShape.__init__()
and hence breaks if one relied on that order.
- [rarely breaking] This changes the order of arguments in
- Fixed an issue with
Polygon.clip_out_of_image()
, which would lead to exceptions if a polygon had overlap with an image, but not a single one of its points was inside that image plane. - Fixed
multicore
methods falsely not acceptingaugmentables.batches.UnnormalizedBatch
. Rot90
now uses subpixel-based coordinate remapping. I.e. any coordinate(x, y)
will be mapped to(H-y, x)
for a rotation by 90deg. Previously, an integer-based remapping to(H-y-1, x)
was used. Coordinates are e.g. used by keypoints, bounding boxes or polygons.augmenters.arithmetic.Invert
- [rarely breaking] If
min_value
and/ormax_value
arguments were set,uint64
is no longer a valid input array dtype forInvert
. This is due to a conversion tofloat64
resulting in loss of resolution. - Fixed
Invert
in rare cases restoring dtypes improperly.
- [rarely breaking] If
- Fixed
dtypes.gate_dtypes()
crashing if the input was one or more numpy scalars instead of numpy arrays or dtypes. - Fixed
augmenters.geometric.PerspectiveTransform
producing invalid polygons (more often with higherscale
values). #338 - Fixed errors caused by
external/poly_point_isect_py2py3.py
related to floating point inaccuracies (changed an epsilon from1e-10
to1e-4
, rounded some floats). #338 - Fixed
Superpixels
breaking when a sampledn_segments
was<=0
.n_segments
is now treated as1
in these cases. - Fixed
ReplaceElementwise
both allowing and disallowing dtypeint64
. #346 - Fixed
BoundingBox.deepcopy()
creating only shallow copies of labels. #356 - Fixed
dtypes.change_dtypes_()
#366- Fixed argument
round
being ignored if input images were a list. - Fixed failure if input images were a list and dtypes a single numpy dtype function.
- Fixed argument
- Fixed
dtypes.get_minimal_dtype()
failing if argumentarrays
contained not exactly two items. #366 - Fixed calls of
CloudLayer.get_parameters()
resulting in errors. #309 - Fixed
SimplexNoiseAlpha
andFrequencyNoiseAlpha
not handlingsigmoid
argument correctly. #343 - Fixed
SnowflakesLayer
crashing for grayscale images. #345
This update mainly covers the following topics:
- Moved classes/methods related to augmentable data to their own modules.
- Added polygon augmentation methods.
- Added line strings and line string augmentation methods.
- Added easier augmentation interface.
For the Polygon and Line String augmentation, new classes and methods had to be
added. The previous file for that was imgaug/imgaug.py
, which however was
already fairly large. Therefore, all classes and methods related to augmentable
data were split off and moved to imgaug/augmentables/<type>.py
. The new
modules and their main contents are:
imgaug.augmentables.batches
: ContainsBatch
,UnnormalizedBatch
.imgaug.augmentables.utils
: Contains utility functions.imgaug.augmentables.bbs
: ContainsBoundingBox
,BoundingBoxesOnImage
.imgaug.augmentables.kps
: ContainsKeypoint
,KeypointsOnImage
.imgaug.augmentables.polys
: ContainsPolygon
,PolygonsOnImage
.imgaug.augmentables.lines
: ContainsLineString
,LineStringsOnImage
.imgaug.augmentables.heatmaps
: ContainsHeatmapsOnImage
.imgaug.augmentables.segmaps
: ContainsSegmentationMapOnImage
.
Currently, all augmentable classes can still be created via imgaug.<type>
,
e.g. imgaug.BoundingBox
still works.
Changes related to the new modules:
- Moved
Keypoint
,KeypointsOnImage
andimgaug.imgaug.compute_geometric_median
toaugmentables/kps.py
. - Moved
BoundingBox
,BoundingBoxesOnImage
toaugmentables/bbs.py
. - Moved
Polygon
,PolygonsOnImage
and related classes/functions toaugmentables/polys.py
. - Moved
HeatmapsOnImage
toaugmentables/heatmaps.py
. - Moved
SegmentationMapOnImage
toaugmentables/segmaps.py
. - Moved
Batch
toaugmentables/batches.py
. - Added module
imgaug.augmentables.utils
.- Added function
normalize_shape()
. - Added function
project_coords()
.
- Added function
- Moved line interpolation functions
_interpolate_points()
,_interpolate_point_pair()
and_interpolate_points_by_max_distance()
toimgaug.augmentables.utils
and made them public functions. - Refactored
__init__()
ofPolygonsOnImage
,BoundingBoxesOnImage
,KeypointsOnImage
to make use ofimgaug.augmentables.utils.normalize_shape()
. - Refactored
KeypointsOnImage.on()
to useimgaug.augmentables.utils.normalize_shape()
. - Refactored
Keypoint.project()
to useimgaug.augmentables.utils.project_coords()
.
Polygons were already part of imgaug
for quite a while, but couldn't be
augmented yet. This version adds methods to perform such augmentations.
It also makes some changes to the Polygon
class, see the list of changes
below.
Example for polygon augmentation:
import imgaug as ia
import imgaug.augmenters as iaa
from imgaug.augmentables.polys import Polygon, PolygonsOnImage
image = ia.quokka(size=0.2)
psoi = PolygonsOnImage([
Polygon([(0, 0), (20, 0), (20, 20)])
], shape=image.shape)
image_aug, psoi_aug = iaa.Affine(rotate=45).augment(
images=[image],
polygons=[psoi]
)
See imgaug-doc/notebooks for a jupyter notebook with many more examples.
Changes related to polygon augmentation:
- Added
_ConcavePolygonRecoverer
toimgaug.augmentables.polys
. - Added
PolygonsOnImage
toimgaug.augmentables.polys
. - Added polygon augmentation methods:
- Added
augment_polygons()
toAugmenter
. - Added
_augment_polygons()
toAugmenter
. - Added
_augment_polygons_as_keypoints()
toAugmenter
. - Added argument
polygons
toimgaug.augmentables.batches.Batch
. - Added attributes
polygons_aug
andpolygons_unaug
toimgaug.augmentables.batches.Batch
. - Added polygon handling to
Augmenter.augment_batches()
.
- Added
- Added property
Polygon.height
. - Added property
Polygon.width
. - Added method
Polygon.to_keypoints()
. - Added optional drawing of corner points to
Polygon.draw_on_image()
andPolygonsOnImage.draw_on_image()
. - Added argument
raise_if_too_far_away=True
toPolygon.change_first_point_by_coords()
. - Added
imgaug.quokka_polygons()
function to generate example polygon data. - [rarely breaking]
Polygon.draw_on_image()
,PolygonsOnImage.draw_on_image()
- Refactored to make partial use
LineString
methods. - Added arguments
size
andsize_perimeter
to control polygon line thickness. - Renamed arguments
alpha_perimeter
toalpha_line
,color_perimeter
tocolor_line
to align withLineStrings
. - Renamed arguments
alpha_fill
toalpha_face
andcolor_fill
tocolor_face
.
- Refactored to make partial use
- [rarely breaking] Changed the output of
Polygon.clip_out_of_image()
fromMultiPolygon
tolist
ofPolygon
. This breaks for anybody who has already usedPolygon.clip_out_of_image()
. - Changed
Polygon.exterior_almost_equals()
to accept lists of tuples as argumentother_polygon
. - Changed arguments
color
andalpha
inPolygon.draw_on_image()
andPolygonsOnImage.draw_on_image()
to represent the general color and alpha of the polygon. The colors/alphas of the inner area, perimeter and points are derived fromcolor
andalpha
(unlesscolor_inner
,color_perimeter
orcolor_points
are set (analogous for alpha)). - Refactored
Polygon.project()
to useLineString.project()
. - Refactored
Polygon.shift()
to useLineString.shift()
. - [rarely breaking]
Polygon.exterior_almost_equals()
,Polygon.almost_equals()
- Refactored to make use of
LineString.coords_almost_equals()
. - Renamed argument
interpolate
topoints_per_edge
. - Renamed argument
other_polygon
toother
.
- Refactored to make use of
- Renamed
color_line
tocolor_lines
,alpha_line
toalpha_lines
inPolygon.draw_on_image()
andPolygonsOnImage.draw_on_image()
. - Fixed
Polygon.clip_out_of_image(image)
not handlingimage
being a tuple. - Fixed
Polygon.is_out_of_image()
falsely only checking the corner points of the polygon.
This version adds Line String augmentation. Line Strings are simply lines made up of consecutive corner points that are connected by straight lines. Line strings have similarity with polygons, but do not have a filled inner area and are not closed (i.e. first and last coordinate differ).
Similar to other augmentables, line string are represented with the classes
LineString(<iterable of xy-coords>)
and
LineStringsOnImage(<iterable of LineString>, <shape of image>)
.
They are augmented e.g. via Augmenter.augment_line_strings(<iterable of LineStringsOnImage>)
or Augmenter.augment(images=..., line_strings=...)
.
Example:
import imgaug as ia
import imgaug.augmenters as iaa
from imgaug.augmentables.lines import LineString, LineStringsOnImage
image = ia.quokka(size=0.2)
lsoi = LineStringsOnImage([
LineString([(0, 0), (20, 0), (20, 20)])
], shape=image.shape)
image_aug, lsoi_aug = iaa.Affine(rotate=45).augment(
images=[image],
line_strings=[lsoi]
)
See imgaug-doc/notebooks for a jupyter notebook with many more examples.
Augmentation of different data corresponding to the same image(s) has been
a bit convoluted in the past, as each data type had to be augmented on its own.
E.g. to augment an image and its bounding boxes, one had to first switch the
augmenters to deterministic mode, then augment the images, then the bounding
boxes. This version adds methods that perform these steps in one call.
Specifically, Augmenter.augment(...)
is used for that, which has the alias
Augmenter.__call__(...)
. One argument can be used for each augmentable,
e.g. bounding_boxes=<bounding box data>
.
Example:
import imgaug as ia
import imgaug.augmenters as iaa
from imgaug.augmentables.kps import Keypoint, KeypointsOnImage
image = ia.quokka(size=0.2)
kpsoi = KeypointsOnImage([Keypoint(x=0, y=10), Keypoint(x=10, y=5)],
shape=image.shape)
image_aug, kpsoi_aug = iaa.Affine(rotate=(-45, 45)).augment(
image=image,
keypoints=kpsoi
)
This will automatically make sure that image and keypoints are rotated by corresponding amounts.
Normalization methods have been added to that class, which allow it to
process many more different inputs than just variations of *OnImage
.
Example:
import imgaug as ia
import imgaug.augmenters as iaa
image = ia.quokka(size=0.2)
kps = [(0, 10), (10, 5)]
image_aug, kps_aug = iaa.Affine(rotate=(-45, 45)).augment(
image=image, keypoints=kps)
Examples for other inputs that are automatically handled by augment()
:
- Integer arrays as segmentation maps.
- Float arrays for heatmaps.
list([N,4] ndarray)
for bounding boxes. (One list for images, thenN
bounding boxes in(x1,y1,x2,y2)
form.)list(list(list(tuple)))
for line strings. (One list for images, one list for line strings on the image, one list for coordinates within the line string. Each tuple must contain two values for xy-coordinates.)list(list(imgaug.augmentables.polys.Polygon))
for polygons. Note that this "skips"imgaug.augmentables.polys.PolygonsOnImage
.
In python <3.6, augment()
is limited to a maximum of two
inputs/outputs and if two inputs/outputs are used, then one of them must be
image data and such (augmented) image data will always be returned first,
independent of the argument's order.
E.g. augment(line_strings=<data>, polygons=<data>)
would be invalid due to
not containing image data. augment(polygons=<data>, images=<data>)
would
still return the images first, even though they are the second argument.
In python >=3.6, augment()
may be called with more than two
arguments and will respect their order.
Example:
import numpy as np
import imgaug as ia
import imgaug.augmenters as iaa
image = ia.quokka(size=0.2)
kps = [(0, 10), (10, 5)]
heatmap = np.zeros((image.shape[0], image.shape[1]), dtype=np.float32)
rotate = iaa.Affine(rotate=(-45, 45))
heatmaps_aug, images_aug, kps_aug = rotate(
heatmaps=[heatmap],
images=[image],
keypoints=[kps]
)
To use more than two inputs/outputs in python <3.6, add the argument return_batch=True
,
which will return an instance of imgaug.augmentables.batches.UnnormalizedBatch
.
Changes related to the augmentation interface:
- Added
Augmenter.augment()
method. - Added
Augmenter.augment_batch()
method.- This method is now called by
Augmenter.augment_batches()
and multicore routines.
- This method is now called by
- Added
imgaug.augmentables.batches.UnnormalizedBatch
. - Added module
imgaug.augmentables.normalization
for data normalization routines. - Changed
augment_batches()
:- Accepts now
UnnormalizedBatch
as input. It is automatically normalized before augmentation and unnormalized afterwards. This allows to useBatch
instances with non-standard datatypes. - Accepts now single instances of
Batch
(andUnnormalizedBatch
). - The input may now also be a generator.
- The input may now be any iterable instead of just list (arrays or strings are not allowed).
- Accepts now
- Marked support for non-
Batch
(and non-UnnormalizedBatch
) inputs toaugment_batches()
as deprecated. - Refactored
Batch.deepcopy()
- Does no longer verify attribute datatypes.
- Allows now to directly change attributes of created copies, e.g. via
batch.deepcopy(images_aug=...)
.
Keypoint augmentation
- Added method
Keypoint.draw_on_image()
. - [mildly breaking] Added an
alpha
argument toKeypointsOnImage.draw_on_image()
. This can break code that relied on the order of arguments of the method (though will usually only have visual consequences). KeypointsOnImage
andKeypoint
copying:- Added optional arguments
keypoints
andshape
toKeypointsOnImage.deepcopy()
. - Added optional arguments
keypoints
andshape
toKeypointsOnImage.copy()
. - Added method
Keypoint.copy()
. - Added method
Keypoint.deepcopy()
.- Refactored methods in
Keypoint
to usedeepcopy()
to create copies of itself (instead of instantiating new instances viaKeypoint(...)
).
- Refactored methods in
KeypointsOnImage.deepcopy()
now usesKeypoint.deepcopy()
to create Keypoint copies, making it more flexible.- Refactored
KeypointsOnImage
to useKeypointsOnImage.deepcopy()
in as many methods as possible to create copies of itself. - Refactored
Affine
,AffineCv2
,PiecewiseAffine
,PerspectiveTransform
,ElasticTransformation
,Rot90
to useKeypointsOnImage.deepcopy()
andKeypoint.deepcopy()
during keypoint augmentation.
- Added optional arguments
- Changed
Keypoint.draw_on_image()
to draw a rectangle for the keypoint so long as any part of that rectangle is within the image plane. (Previously, the rectangle was only drawn if the integer xy-coordinate of the point was inside the image plane.) - Changed
KeypointsOnImage.draw_on_image()
to raise an error if an input image has shape(H,W)
. - Changed
KeypointsOnImage.draw_on_image()
to handle single-number inputs forcolor
. KeypointsOnImage.from_coords_array()
- Marked as deprecated.
- Renamed to
from_xy_array()
. - Renamed arg
coords
toxy
. - Changed the method from
staticmethod
toclassmethod
. - Refactored to make code simpler.
KeypointsOnImage.get_coords_array()
- Marked as deprecated.
- Renamed to
to_xy_array()
.
- Refactored
KeypointsOnImage.draw_on_image()
to useKeypoint.draw_on_image()
.
Heatmap augmentation
- Changed
Affine
,PiecewiseAffine
,ElasticTransformation
to always useorder=3
for heatmap augmentation. - Changed check in
HeatmapsOnImage
that validates whether the input array is within the desired value range[min_value, max_value]
from a hard exception to a soft warning (with clipping). Also improved the error message a bit.
Deprecation warnings:
- Added
imgaug.imgaug.DeprecationWarning
. The builtin pythonDeprecationWarning
is silent since 2.7, which is why now a separate deprecation warning is used. - Added
imgaug.imgaug.warn_deprecated()
.- Refactored deprecation warnings to use this function.
- Added
imgaug.imgaug.deprecated
decorator.- Refactored deprecation warnings to use this decorator.
Bounding Boxes:
- Added to
BoundingBox.extract_from_image()
the argumentspad
andpad_max
. - Changed
BoundingBox.contains()
to also acceptKeypoint
. - Changed
BoundingBox.project(from, to)
to also accept images instead of shapes. - Renamed argument
thickness
inBoundingBox.draw_on_image()
tosize
in order to match the name used for keypoints, polygons and line strings. The argumentthickness
will still be accepted, but raises a deprecation warning. - Renamed argument
thickness
inBoundingBoxesOnImage.draw_on_image()
tosize
in order to match the name used for keypoints, polygons and line strings. The argumentthickness
will still be accepted, but raises a deprecation warning. - Refactored
BoundingBox
to reduce code repetition. - Refactored
BoundingBox.extract_from_image()
. Improved some code fragments that looked wrong. - Refactored
BoundingBoxesOnImage.draw_on_image()
to improve efficiency by evading unnecessary array copies.
Other:
- [rarely breaking] Added arguments
cval
andmode
toPerspectiveTransform
(PR #301). This breaks code that relied on the order of the arguments and usedkeep_size
,name
,deterministic
orrandom_state
as positional arguments. - Added
dtypes.clip_()
function. - Added function
imgaug.imgaug.flatten()
that flattens nested lists/tuples. - Changed
PerspectiveTransform
to ensure minimum height and width of output images (by default2x2
). This prevents errors in polygon augmentation (possibly also in keypoint augmentation). - Refactored
imgaug.augmenters.blend.blend_alpha()
to no longer enforce a channel axis for foreground and background image. - Refactored
imgaug/parameters.py
to reorder classes within the file. - Re-allowed numpy 1.16 in
requirements.txt
.
- Fixed possible crash in
blend.blend_alpha()
if dtype numpy.float128 does not exist. - Fixed a crash in
ChangeColorspace
whencv2.COLOR_Lab2RGB
was actually calledcv2.COLOR_LAB2RGB
in the local OpenCV installation (analogous for BGR). (PR #263) - Fixed
ReplaceElementwise
always sampling replacement per channel. - Fixed an error in
draw_text()
due to arrays that could not be set to writeable after drawing the text via PIL. - Fixed errors in docstring of
parameters.Subtract
. - Fixed a division by zero bug in
angle_between_vectors()
. - Augmentation of empty
KeypointsOnImage
instances- Fixed
Rot90
not changingKeypointsOnImage.shape
if.keypoints
was empty. - Fixed
Affine
not changingKeypointsOnImage.shape
if.keypoints
was empty. - Fixed
PerspectiveTransform
not changingKeypointsOnImage.shape
if.keypoints
was empty. - Fixed
Resize
not changingKeypointsOnImage.shape
if.keypoints
was empty. - Fixed
CropAndPad
not changingKeypointsOnImage.shape
if.keypoints
was empty. (Same forCrop
,Pad
.) - Fixed
PadToFixedSize
not changingKeypointsOnImage.shape
if.keypoints
was empty. - Fixed
CropToFixedSize
not changingKeypointsOnImage.shape
if.keypoints
was empty. - Fixed
KeepSizeByResize
not changingKeypointsOnImage.shape
if.keypoints
was empty.
- Fixed
- Fixed
Affine
heatmap augmentation producing arrays with values outside the range[0.0, 1.0]
whenorder
was set to3
. - Fixed
PiecewiseAffine
heatmap augmentation producing arrays with values outside the range[0.0, 1.0]
whenorder
was set to3
. - Fixed assert in
SegmentationMapOnImage
falsely checking if max class index is<= nb_classes
instead of< nb_classes
. - Fixed an issue in
dtypes.clip_to_value_range_()
anddtypes.restore_dtypes_()
causing errors when clip value range exceeded array dtype's value range. - Fixed an issue in
dtypes.clip_to_value_range_()
anddtypes.restore_dtypes_()
when the input array was scalar, i.e. had shape()
. - Fixed a Permission Denied error when using
JpegCompression
on windows (possibly also affected other systems). #297
This update focused on extending and documenting the library's dtype support, improving the performance and reworking multicore augmentation.
Previous versions of imgaug
were primarily geared towards uint8
.
In this version, all augmenters and helper functions were refactored to be more tolerant towards non-uint8 dtypes.
Additionally all augmenters were tested with non-uint8 dtypes and an overview of the expected support-level
is now listed in the documentation on page dtype support.
Further details are listed in the docstrings of each individual augmenter or helper function.
Below are some numbers for the achieved performance improvements compared to 0.2.7. The measurements were taken using realistic 224x224x3 uint8 images and batch size 128. The percentage values denote the increase in bandwidth (i.e. mbyte/sec) of the respective augmenter given the described input. Improvements for smaller images, smaller batch sizes and non-uint8 dtypes may differ. Augmenters with less than roughly 10% improvement are not listed. While the numbers here are exact, there is some measurement error involved as they were calculated based on a rather low number of 100 repetitions.
- Sequential (with 2x Noop as children) +184% to +276%
- SomeOf (with 3x Noop as children) +24% to +49%
- OneOf (with 3x Noop as children) +21%
- Sometimes (with Noop as child) +23%
- WithChannels +32%
- Add +216%
- AddElementwise +49%
- AdditiveGaussianNoise +26%
- AdditiveLaplaceNoise +20%
- AdditivePoissonNoise +18%
- Multiply +206%
- MultiplyElementwise +74%
- Dropout +154%
- CoarseDropout +246%
- ReplaceElementwise +119%
- ImpulseNoise +333%
- SaltAndPepper +184%
- CoarseSaltAndPepper +227%
- Salt +204%
- CoarseSalt +260%
- Pepper +208%
- CoarsePepper +276%
- Invert +1192%
- GaussianBlur +885%
- AddToHueAndSaturation +48%
- GammaContrast +2988%
- SigmoidContrast +519%
- LogContrast +1048%
- LinearContrast +448%
- Convolve +47%
- Sharpen +29%
- Emboss +18%
- EdgeDetect +41%
- DirectedEdgeDetect +53%
- Fliplr +75%
- Flipud +25%
- Affine +7% to +33%
- ElasticTransformation +650 to +680%
- CropAndPad +30% to +77% (from improved padding)
- Pad +40 to +140%
- PadToFixedSize +288%
- KeepSizeByResize (with CropToFixedSize as child) +58%
- Snowflakes +44%
- SnowflakesLayer +42%
The implementation for multicore augmentation was completely rewritten and is now a wrapper around python's multiprocessing.Pool
. Compared to the old version, it is by far less fragile and faster. It is also easier to use. Every augmenter now offers a simple pool()
method, which can be used to quickly spawn a pool of child workers on multiple CPU cores. Example:
aug = iaa.PiecewiseAffine(0.2)
with aug.pool(processes=-1, seed=123) as pool:
batches_aug = pool.imap_batches(batches_generator, chunksize=32)
for batch_aug in batches_aug:
# do something
Here, batches_generator
is a generator that yields instances of imgaug.Batch
, e.g. something like imgaug.Batch(images=<numpy array>, keypoints=[imgaug.KeypointsOnImage(...), imgaug.KeypointsOnImage(...), ...])
. The arguement processes=-1
spawns N-1
workers, where N
is the number of CPU cores (includes hyperthreads).
Note that Augmenter.augment_batches(batches, background=True)
still works and now uses the above pool()
method.
- Added constants that control the min/max values for seed generation
- Improved performance of
pad()
- this change also improves the performance of:
imgaug.imgaug.pad_to_aspect_ratio()
,imgaug.imgaug.HeatmapsOnImage.pad()
,imgaug.imgaug.HeatmapsOnImage.pad_to_aspect_ratio()
,imgaug.imgaug.SegmentationMapOnImage.pad()
,imgaug.imgaug.SegmentationMapOnImage.pad_to_aspect_ratio()
,imgaug.augmenters.size.PadToFixedSize
,imgaug.augmenters.size.Pad
,imgaug.augmenters.size.CropAndPad
- this change also improves the performance of:
- Changed
imshow()
to explicitly make the plot figure size dependent on the input image size. - Refactored
SegmentationMapOnImage
to have simplified dtype handling in__init__
- Fixed an issue with
SEED_MAX_VALUE
exceeding theint32
maximum on some systems, causing crashes related to RandomState. - Moved BatchLoader to
multicore.py
and replaced the class with an alias pointing toimgaug.multicore.BatchLoader
. - Moved BackgroundAugmenter to
multicore.py
and replaced the class with an alias pointing toimgaug.multicore.BatchLoader
. - Renamed
HeatmapsOnImage.scale()
toHeatmapsOnImage.resize()
. - Marked
HeatmapsOnImage.scale()
as deprecated. - Renamed
SegmentationMapOnImage.scale()
toSegmentationMapOnImage.resize()
. - Marked
SegmentationMapOnImage.scale()
as deprecated. - Renamed
BoundingBox.cut_out_of_image()
toBoundingBox.clip_out_of_image()
. - Marked
BoundingBox.cut_out_of_image()
as deprecated. - Renamed
BoundingBoxesOnImage.cut_out_of_image()
toBoundingBoxesOnImage.clip_out_of_image()
. - Marked
BoundingBoxesOnImage.cut_out_of_image()
as deprecated. - Marked
Polygon.cut_out_of_image()
as deprecated. (The analogous clip function existed already.) - Renamed in
imgaug.Batch
the attributes storing input data<attribute>_unaug
, e.g.imgaug.Batch.images
toimgaug.Batch.images_unaug
orimgaug.Batch.keypoints
toimgaug.Batch.keypoints_unaug
. The old attributes are still accessible, but will raise a DeprecatedWarning.
- Created this file.
- Moved
BatchLoader
here fromimgaug.py
. - Moved
BackgroudAugmenter
here fromimgaug.py
. - Marked
BatchLoader
as deprecated. - Marked
BackgroundAugmenter
as deprecated. - Added class
Pool
. This is the new recommended way for multicore augmentation.BatchLoader
/BackgroundAugmenter
should not be used anymore. Example:The example starts a pool with N-1 workers (N=number of CPU cores) and augments 100 batches using these workers. Useimport imgaug as ia from imgaug import augmenters as iaa from imgaug import multicore import numpy as np aug = iaa.Add(1) images = np.zeros((16, 128, 128, 3), dtype=np.uint8) batches = [ia.Batch(images=np.copy(images)) for _ in range(100)] with multicore.Pool(aug, processes=-1, seed=2) as pool: batches_aug = pool.map_batches(batches, chunksize=8) print(np.sum(batches_aug[0].images_aug[0]))
imap_batches()
to feed in and get out a generator.
- Added
TruncatedNormal
- Added
handle_discrete_kernel_size_param()
- Improved dtype-related interplay of
FromLowerResolution
andimresize_many_images()
- Improved performance for sampling from
Deterministic
by about 2x - Improved performance for sampling from
Uniform
witha == b
- Improved performance for sampling from
DiscreteUniform
witha == b
- Improved performance for sampling from
Laplace
withscale=0
- Improved performance for sampling from
Normal
withscale=0
- Improved performance of
Clip
and improved code style - Refactored
float check in force_np_float_dtype()
- Refactored
RandomSign
- Refactored various unittests to be more flexible with regards to returned dtypes
- Refactored
StochasticParameter.draw_distribution_graph()
to use internally tempfile-based drawing. Should result in higher-quality outputs. - Refactored unittest for
draw_distributions_grid()
to improve performance - Fixed in
draw_distributions_grid()
a possible error from arrays with unequal shapes being combined to one array - Fixed a problem with
Sigmoid
not returning floats - Fixed noise produced by
SimplexNoise
having values below 0.0 or above 1.0 - Fixed noise produced by
SimplexNoise
being more biased towards 0 than it should be
- Added new file
imgaug/dtypes.py
and respective test filetest_dtypes.py
. - Added
clip_to_dtype_value_range_()
- Added
get_value_range_of_dtype()
- Added
promote_array_dtypes_()
- Added
get_minimal_dtype()
- Added
get_minimal_dtypes_for_values()
- Added
get_minimal_dtype_by_value_range()
- Added
restore_dtypes_()
- Added
gate_dtypes()
- Added
increase_array_resolutions()
- Added
copy_dtypes_for_restore()
- Added
estimate_max_number_of_channels()
- Added
copy_arrays()
- Added an optional parameter
default
tohandle_children_lists()
- Enabled
None
as arguments forLambda
and made all arguments optional - Enabled
None
as arguments forAssertLambda
and made all arguments optional - Improved dtype support of
AssertShape
- Improved dtype support of
AssertLambda
- Improved dtype support of
Lambda
- Improved dtype support of
ChannelShuffle
- Improved dtype support of
WithChannels
- Improved dtype support of
Sometimes
- Improved dtype support of
SomeOf
- Improved dtype support of
Sequential
- Improved dtype support of
Noop
- [breaking, mostly internal] Removed
restore_augmented_images_dtypes()
- [breaking, mostly internal] Removed
restore_augmented_images_dtypes_()
- [breaking, mostly internal] Removed
restore_augmented_images_dtype()
- [breaking, mostly internal] Removed
restore_augmented_images_dtype_()
- [breaking, mostly internal] Refactored
Augmenter.augment_images()
andAugmenter._augment_images()
to defaulthooks
toNone
- This will affect any custom implemented augmenters that try to access the hooks argument.
- [breaking, mostly internal] Refactored
Augmenter.augment_heatmaps()
andAugmenter._augment_heatmaps()
to defaulthooks
toNone
- Same as above for images.
- [breaking, mostly internal] Refactored
Augmenter.augment_keypoints()
andAugmenter._augment_keypoints()
to defaulthooks
to None- Same as above for images.
- [breaking, mostly internal] Improved performance of image augmentation for augmenters with children
- For calls to
augment_image()
, the validation, normalization and copying steps are skipped if the call is a child call (e.g. aSequential
callingaugment_images()
on a childAdd
). Hence, such child calls augment now fully in-place (the top-most call still creates a copy though, so from the user perspective nothing changes). Custom implemented augmenters that rely on child calls toaugment_images()
creating copies will break from this change. For an exampleSequential
containing twoNoop
augmenters, this change improves the performance by roughly 2x
- For calls to
- [breaking, mostly internal] Improved performance of heatmap augmentation for augmenters with children
- Same as above for images.
- Speedup is around 2-3x for an exemplary
Sequential
containing twoNoop
s. - This will similarly affect segmentation map augmentation too.
- [breaking, mostly internal] Improved performance of keypoint augmentation for augmenters with children
- Same as above for images.
- Speedup is around 1.5-2x for an exemplary
Sequential
containing two Noops. - This will similarly affect bounding box augmentation.
- [critical] Fixed a bug in the augmentation of empty
KeypointsOnImage
instances that would lead image and keypoint augmentation to be un-aligned within a batch after the first emptyKeypointsOnImage
instance. (#231) - Added
pool()
toAugmenter
. This is a helper to start aimgaug.multicore.Pool
viawith augmenter.pool() as pool: ...
. - Refactored
Augmenter.augment_batches(..., background=True)
to useimgaug.multicore.Pool
. - Changed
to_deterministic()
inAugmenter
and various child classes to derive its new random state from the augmenter's local random state instead of the global random state. - Enabled support for non-list
HeatmapsOnImage
inputs inAugmenter.augment_heatmaps()
. (Before, only lists were supported.) - Enabled support for non-list
SegmentationMapOnImage
inputs inAugmenter.augment_segmentation_maps()
. (Before, only lists were supported.) - Enabled support for non-list
KeypointsOnImage
inputs inAugmenter.augment_keypoints()
. (Before, only lists were supported.) - Enabled support for non-list
BoundingBoxesOnImage
inputs inAugmenter.augment_bounding_boxes()
. (Before, only lists were supported.)
ContrastNormalization
is now an alias forLinearContrast
- Restricted
JpegCompression
to uint8 inputs. Other dtypes will now produce errors early on. - Changed in
Add
the parametervalue
to be continuous and removed itsvalue_range
- Renamed
imgaug.augmenters.overlay
toimgaug.augmenters.blend
. Functions and classes inimgaug.augmenters.overlay
are still accessible, but will now raise a DeprecatedWarning. - Added
blend_alpha()
. - Refactored
Alpha
to be simpler and useblend_alpha()
. - Fixed
Alpha
not having its own__str__
method. - Improved dtype support of
AlphaElementwise
.
- Added function
blur_gaussian()
- Added
Lab2RGB
andLab2BGR
toChangeColorspace
- Refactored the main loop in
AddToHueAndSaturation
to make it simpler and faster - Fixed
ChangeColorspace
not being able to convert from RGB/BGR to Lab/Luv
- Added
AllChannelsCLAHE
- Added
CLAHE
- Added
AllChannelsHistogramEqualization
- Added
HistogramEqualization
- Added
_IntensityChannelBasedApplier
- Added function
adjust_contrast_gamma()
- Added function
adjust_contrast_sigmoid()
- Added function
adjust_contrast_log()
- Refactored random state handling in
_ContrastFuncWrapper
- [breaking, internal] Removed
_PreserveDtype
- [breaking, internal] Renamed
_adjust_linear
toadjust_contrast_linear()
- Refactored
AverageBlur
to have improved random state handling - Refactored
GaussianBlur
to only overwrite input images when that is necessary - Refactored
GaussianBlur
to have a simplified main loop - Refactored
AverageBlur
to have a simplified main loop - Refactored
MedianBlur
to have a simplified main loop - Refactored
BilateralBlur
to have a simplified main loop - Improved dtype support of
GaussianBlur
- Improved dtype support of
AverageBlur
- Improved dtype support of
Convolve
- Improved dtype support of
Fliplr
- Improved dtype support of
Flipud
- Refactored
Fliplr
main loop to be more elegant and tolerant - Refactored
Flipud
main loop to be more elegant and tolerant - Added alias
HorizontalFlip
forFliplr
. - Added alias
VerticalFlip
forFlipud
.
ElasticTransformation
- [breaking, mostly internal]
generate_indices()
now returns only the pixelwise shift as a tuple of x and y - [breaking, mostly internal]
generate_indices()
has no longer areshape
argument - [breaking, mostly internal]
renamed generate_indices()
togenerate_shift_maps()
- [breaking, mostly internal]
map_coordinates()
now expects to get the pixelwise shift as its input, instead of the target coordinates
- [breaking, mostly internal]
- Improved dtype support of
Superpixels
- Removed the restriction to
uint8
inScale
. The augmenter now supports the same dtypes asimresize_many_images()
. - Fixed missing pad mode
mean
inPad
andCropAndPad
. - Improved error messages related to pad mode.
- Improved and fixed docstrings of
CropAndPad
,Crop
,Pad
. - Renamed
Scale
toResize
. - Marked
Scale
as deprecated.
- Improved descriptions of the library in
setup.py
matplotlib
is now an optional dependency of the library and loaded lazily when neededShapely
is now an optional dependency of the library and loaded lazily when neededopencv-python
is now a dependency of the librarysetup.py
no longer enforcescv2
to be installed (to allow installing libraries in random order)- Minimum required
numpy
version is now 1.15