Fast image augmentation library and an easy-to-use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about the library: https://www.mdpi.com/2078-2489/11/2/125
Morphological
transform that modifies the structure of the image. Dilation expands the white (foreground) regions in a binary or grayscale image, while erosion shrinks them.
Left: Original, Middle: Chromatic aberration (default args, mode="green_purple"), Right: Chromatic aberration (default args, mode="red_blue")
(Image is from our internal mobile mapping dataset)
ChromaticAbberation
transform that adds chromatic distortion to the image. Wiki by @mrsmrynkmixing parameter
for MixUp
transform by @Dipet. For more details Tutorial on MixUp
AdvancedBlur
by @AloqeelyCONTRIBUTORS.md
for Windows users by @AloqeelyDownScale
transform by @ryoryon66PadIfNeeded
serialization @ternausMixUp
transform: which linearly combines an input (image, mask, and class label) with another set from a predefined reference dataset. The mixing degree is controlled by a parameter λ (lambda), sampled from a Beta distribution. This method is known for improving model generalization by promoting linear behavior between classes and smoothing decision boundaries.isort
, flake8
, black
to ruff
opencv
library inconsistencies issuesIn this release, we mainly focused on the technical debt as its decrease allows faster iterations and bug fixes in the codebase. We added only one new transform, did not work on speeding up transforms, and other changes are minor.
But, somehow, we are cutting this dependency only in 2024.
XYMasking
transform: applies masking strips to an image, either horizontally (X axis) or vertically (Y axis), simulating occlusions. This transform is helpful for training models to recognize images with varied visibility conditions. It's particularly effective for spectrogram images, allowing spectral and frequency masking to improve model robustness.
As other dropout transforms CoarseDropout, MaskDropout, GridDropout it supports images, masks and keypoints as targets. (https://github.com/albumentations-team/albumentations/commit/004fabbf90794fbc21ee356e2dde6637b7fecbd4 by @ternaus )The deprecated code, including 15 transforms, was removed. Dependency on the imgaug library was removed.
(https://github.com/albumentations-team/albumentations/commit/be6a217b207b3d7ebe792caabb438d660b45f2a5 by @ternaus )
JpegCompression
. Use ImageCompression instead.RandomBrightness
. Use RandomBrigtnessContrast instead.RandomContrast
. Use RandomBrigtnessContrast instead.Cutout
. Use CoarseDropout instead.ToTensor
. Use ToTensorV2 instead.IAAAdditiveGaussianNoise
. Use GaussNoise instead.IAAAffine
. Use Affine instead.IAAEmboss
. Use Emboss instead.IAAFliplr
. Use HorizontalFlip instead.IAAFlipud
. Use VerticalFlip instead.IAAPerspective
. Use Perspective instead.IAAPiecewiseAffine
. Use PiecewiseAffine instead.IAASharpen
. Use Sharpen instead.IAASuperpixels
. Use Superpixels instead.eps
parameter in RandomGamma
lambda_transforms
in serialization.from_dict
function.matrix=None
case for Piecewise affine transform (https://github.com/albumentations-team/albumentations/commit/c70e664e060bfd7463c20674927aed217f72d437 @Dipet )ToRGB
transform (#1323 by @kinoooshnik)RandomGravel
transform (#1365 by @onurtore)Spatter
(#1305 by @Andredance)rotate_method
in Affine
(#1394 by @i-aki-y)CoarseDropout
(#1330 by @domef)scipy.ndimage.gaussian_filter
(#1311 by @rbu)RandomSunFlare
(#1333 by @jasonrock-a3)ToSepia
transform (#1397 by @ifeherva)skimage
deprecetions (#1421 by @Dipet)method
to rotate_method
inside Rotate
to keep consistency between naming parameters. (#1258 by @Dipet, thanks to @MichaelMonashev)RandomCropFromBorders
- Crops image based on indents from image borders. (#1240 by @Dipet based on #476 by @ZFTurbo)BBoxSafeRandomCrop
- Crops image without loss of bboxes. Instead of RandomSizedBBoxSafeCrop
this implementation do not apply resize to target size. (#579 by @SunQpark)Spatter
- Simulates corruption which can occlude a lens in the form of rain or mud. (#573 by @akarsakov)Defocus
- Imitates lens defocusing. (#551 by @akarsakov)ZoomBlur
- Imitates lens blur on zoomig. (#551 by @akarsakov)RandomBrightnessContrast
when brightness_by_max=False
. (#487 by @Dipet)Perspective
and Affine
. (#1231 by @Dipet)min_visibility=0
or min_visibility=1
. (#616 by @IlyaOvodov)Rotate
when crop_border=True
. (#1250 by @Dipet, thanks to @jonkoi)always_apply
Compose
children. (#561 by @albu)src_color
, and use all three color values. (#1285 by @hoel-bagard)gamma_limit
. (#1286 by @zahragolpa)Normalize
in some case up to 2 times. (#563 by @Dipet)GridDistortion
, ElasticTransform
and OpticalDistortion
now supports bbox targets. (#476, #1262 by @ZFTurbo and @Dipet)MotionBlur
now supports allow_shifted
flag. When it's value is False
only non shifted kernels generated. (#1239 by @Dipet)GridDistortion
now supports normalized
flag. When it is set to True
will be applied distortion inside image border. (#722 by @poke1024)Downscale
. This is needed to avoid interpolation artefacts. (#584 by @nathanhubens)albumentations.augmentations.utils.py
. (#1260 by @Dipet)albumentations.augmentations.blur
. (#1259 by @Dipet)A.Rotate
and A.ShiftScaleRotate
now support new rotation method for bounding boxes, ellipse
. (#1203 by @victor1cea)A.Rotate
now supports new argument crop_border
. If set to True, the rotated image will be cropped as much as possible to eliminate pixel values at the edges that were not well defined after rotation. (#1214 by @bonlime)match_histograms
. (#1121 by @BloodAxe)A.CropNonEmptyMaskIfExists
modified the first element of masks
in-place. Now, this behavior is fixed and A.CropNonEmptyMaskIfExists
doesn't do in-place modification of input masks. (#1193 by @ORippler).fill_value
and mask_fill_value
parameters for A.GridDropout
. (#1191 by @victor1cea)A.ColorJitter
now correctly works with A.ReplayCompose
. (#1199 by @zakajd)A.ColorJitter
for np.float32
input images when contrast
is set to 0 (previously, all values were set to 0.5 instead of using the average value).. (#1207 by @Dipet)A.Rotate
, A.Affine
and A.ShiftScaleRotate
now do rotation in the same way. Fixed incorrect rotation angle for A.Affine
. A.Rotate
and A.ShiftScaleRotate
now correctly rotate the keypoints 90 degrees and don't leave black lines around the edges of the image. (#1091 by @Dipet )A.UnsharpMask
. This transform sharpens the input image using Unsharp Masking processing and overlays the result with the original image. (#1063 by @zakajd)A.RingingOvershoot
. This transform creates ringing or overshoot artifacts by convolving the image with a 2D sinc filter. (#1064 by @zakajd)A.AdvancedBlur
. This transform blurs the input image using a Generalized Normal filter with randomly selected parameters. It also adds multiplicative noise to generated kernel before convolution. (#1066 by @zakajd)A.PixelDropout
. This transformation randomly replaces pixels with the passed value. (#1082 by @Dipet)A.RandomShadow
from working with non-contiguous input. (#1117 by @i-aki-y)A.PadIfNeeded
now works with an arbitrary number of channels. (#1069 by @BloodAxe)np.random
use cases to prevent identical values when using multiprocessing. (#1070 by @Dipet)slant
param now has an effect in A.RandomRain
. (#1179 by @victor1cea)translate_percent
now uses 0 as a default value in the A.Affine
transform. (#1183 by @victor1cea)A.SafeRotate
no longer loses blocks and keypoints. (#1109 by @Dipet)A.CropAndPad
now correctly handles bboxes when keep_size=True
. (#1059 by @cannon)A.RandomCrop
, A.RandomSizedCrop
, and A.RandomSizedBBoxSafeCrop
now sample last pixel. (#1080 by @Multihuntr)A.Compose
now warns the user if it receives a single augmentation instead of a sequence of augmentations. (#1055 by @Dipet)A.CoarseDropout
and A.RandomGridShuffle
now support keypoints. (#1084 by @BloodAxe)A.ToTensorV2
now supports the masks
target. (#1097 by @alessiobonfiglio)A.PadIfNeeded
now supports random padding. (#1160 by @mys007 )A.Affine
now has keep_ratio
flag. (#1104 by @i-aki-y)TemplateTransform
. This transform allows the blending of an input image with specified templates. (#572 by @akarsakov )PixelDistributionAdaptation
. A new domain adaptation augmentation. It fits a simple transform on both the original and reference image, transforms the original image with transform trained on this image, and performs inverse transformation using transform fitted on the reference image. See the examples of this transform in the qudida
repository. (#959 by @arsenyinfo)LongestMaxSize
and SmallestMaxSize
now can also accept a list of sizes as their max_size
argument and the actual max_size
value will be sampled randomly from this list. (#930 by @kmistry-wx )A.Affine
now accepts mask_interpolation
as a parameter. (#975 by @dskkato )A.RandomRain
now alters brightness in HSV space instead of HLS space to prevent image corruption. (#990 by @ErlingLie)ValueError
if bbox_params is not specified and bbox transformation is called (#1013 by @VirajBagal)CoarseDropout
can now set the height and width of holes based on the fraction of original image height and width (#1014 by @VirajBagal )ElasticTransform
got performance optimizations. (#1004 by @b0nce)CropNonEmptyMaskIfExists
thrown an error when it was used with a keypoint even though keypoints were mentioned as a correct target. (#986 by @GalDude33 )RandomCropNearBBox
when it received values with x_min <= 0
or y_min <= 0
(#993 by @Dipet )ToTensorV2
#963