Releases: albumentations-team/albumentations
1.3.0
Breaking changes
- Renamed
method
torotate_method
insideRotate
to keep consistency between naming parameters. (#1258 by @Dipet, thanks to @MichaelMonashev)
New augmentations
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 ofRandomSizedBBoxSafeCrop
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)
Bugfixes
- Fixed wrong result in
RandomBrightnessContrast
whenbrightness_by_max=False
. (#487 by @Dipet) - Fixed wrong bbox clipping inside
Perspective
andAffine
. (#1231 by @Dipet) - Fixed incorrect removal of bboxes when
min_visibility=0
ormin_visibility=1
. (#616 by @IlyaOvodov) - Fixed wrong keypoint's cropping inside
Rotate
whencrop_border=True
. (#1250 by @Dipet, thanks to @jonkoi) - Fixed wrong propagation of
always_apply
Compose
children. (#561 by @albu) - RandomSunFlare now correctly works with
src_color
, and use all three color values. (#1285 by @hoel-bagard) - RandomGamma now correctly works with float
gamma_limit
. (#1286 by @zahragolpa)
Minor changes:
- Speeded up
Normalize
in some case up to 2 times. (#563 by @Dipet) GridDistortion
,ElasticTransform
andOpticalDistortion
now supports bbox targets. (#476, #1262 by @ZFTurbo and @Dipet)MotionBlur
now supportsallow_shifted
flag. When it's value isFalse
only non shifted kernels generated. (#1239 by @Dipet)- Updated versions of type formatters. (#1245 by @ternaus)
GridDistortion
now supportsnormalized
flag. When it is set toTrue
will be applied distortion inside image border. (#722 by @poke1024)- Now you can describe downscale and upscale interpolation method for
Downscale
. This is needed to avoid interpolation artefacts. (#584 by @nathanhubens) - Refactoring. Spatial transforms moved to geometric files. (#1241 by @ternaus)
- Refactoring. Common functions moved into
albumentations.augmentations.utils.py
. (#1260 by @Dipet) - Refactoring. Blur transforms moved into
albumentations.augmentations.blur
. (#1259 by @Dipet)
1.2.1
Minor changes
A.Rotate
andA.ShiftScaleRotate
now support new rotation method for bounding boxes,ellipse
. (#1203 by @victor1cea)A.Rotate
now supports new argumentcrop_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)- Tests that use multiprocessing now run much faster (#1218 by @Dipet)
- Improved type hints (#1219 by @Dipet )
- Fixed a deprecation warning in
match_histograms
. (#1121 by @BloodAxe)
Bugfixes
A.CropNonEmptyMaskIfExists
modified the first element ofmasks
in-place. Now, this behavior is fixed andA.CropNonEmptyMaskIfExists
doesn't do in-place modification of input masks. (#1193 by @ORippler).- Albumentations now correctly serialized and desirealized
fill_value
andmask_fill_value
parameters forA.GridDropout
. (#1191 by @victor1cea) A.ColorJitter
now correctly works withA.ReplayCompose
. (#1199 by @zakajd)- Fixed incorrect behavior of
A.ColorJitter
fornp.float32
input images whencontrast
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
andA.ShiftScaleRotate
now do rotation in the same way. Fixed incorrect rotation angle forA.Affine
.A.Rotate
andA.ShiftScaleRotate
now correctly rotate the keypoints 90 degrees and don't leave black lines around the edges of the image. (#1091 by @Dipet )
1.2.0
New augmentations:
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)
Bugfixes
- Fixed a problem that prevented
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)- Fixed all
np.random
use cases to prevent identical values when using multiprocessing. (#1070 by @Dipet) - The
slant
param now has an effect inA.RandomRain
. (#1179 by @victor1cea) translate_percent
now uses 0 as a default value in theA.Affine
transform. (#1183 by @victor1cea)A.SafeRotate
no longer loses blocks and keypoints. (#1109 by @Dipet)A.CropAndPad
now correctly handles bboxes whenkeep_size=True
. (#1059 by @cannon)A.RandomCrop
,A.RandomSizedCrop
, andA.RandomSizedBBoxSafeCrop
now sample last pixel. (#1080 by @Multihuntr)
Minor changes:
- Old code is refactored, and more type hints are added (#1052 by @Dipet).
A.Compose
now warns the user if it receives a single augmentation instead of a sequence of augmentations. (#1055 by @Dipet)A.CoarseDropout
andA.RandomGridShuffle
now support keypoints. (#1084 by @BloodAxe)A.ToTensorV2
now supports themasks
target. (#1097 by @alessiobonfiglio)A.PadIfNeeded
now supports random padding. (#1160 by @mys007 )- Improved and corrected documentation: #1047 by @shyn, #1164 by @notplus, #1105 by @i-aki-y
- Speeded up tests by removing unnecessary tests. (#1188 by @creafz)
A.Affine
now haskeep_ratio
flag. (#1104 by @i-aki-y)
1.1.0
New augmentations
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 thequdida
repository. (#959 by @arsenyinfo)
Minor changes:
LongestMaxSize
andSmallestMaxSize
now can also accept a list of sizes as theirmax_size
argument and the actualmax_size
value will be sampled randomly from this list. (#930 by @kmistry-wx )A.Affine
now acceptsmask_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)- Albumentations now raises
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)
Bugfixes
- Fixed a bug when
CropNonEmptyMaskIfExists
thrown an error when it was used with a keypoint even though keypoints were mentioned as a correct target. (#986 by @GalDude33 ) - Fixed KeyError with
RandomCropNearBBox
when it received values withx_min <= 0
ory_min <= 0
(#993 by @Dipet )
1.0.3
1.0.2
1.0.1
Added position argument to PadIfNeeded (#933 by @yisaienkov)
Possible values: center
top_left
, top_right
, bottom_left
, bottom_right
, with center
being the default value.
One possible use case for this feature is object detection where you need to pad an image to square, but you want predicted bounding boxes being equal to the bounding box of the unpadded image.
1.0.0
Breaking changes
imgaug
dependency is now optional, and by default, Albumentations won't install it. This change was necessary to prevent simultaneous install of bothopencv-python-headless
andopencv-python
(you can read more about the problem in this issue). If you still needimgaug
as a dependency, you can use thepip install -U albumentations[imgaug]
command to install Albumentations withimgaug
.- Deprecated augmentation
ToTensor
that converts NumPy arrays to PyTorch tensors is completely removed from Albumentations. You will get aRuntimeError
exception if you try to use it. Please switch toToTensorV2
in your pipelines.
New augmentations
A.RandomToneCurve
. See a notebook for examples of this augmentation (#839 by @aaroswings)SafeRotate
. Safely Rotate Images Without Cropping (#888 by @deleomike)SomeOf
transform that applies N augmentations from a list. Generalizing ofOneOf
(#889 by @henrique)- We are deprecating imgaug transforms and providing Albumentations' implementations for them.
(#786 by @KiriLev, #787 by @KiriLev, #790, #843, #844, #849, #885, #892)
By default, Albumentations doesn't require imgaug
as a dependency. But if you need imgaug
, you can install it along with Albumentations by running pip install -U albumentations[imgaug]
.
Here is a table of deprecated imgaug
augmentations and respective augmentations from Albumentations that you should use instead:
Old deprecated augmentation | New augmentation |
---|---|
IAACropAndPad | CropAndPad |
IAAFliplr | HorizontalFlip |
IAAFlipud | VerticalFlip |
IAAEmboss | Emboss |
IAASharpen | Sharpen |
IAAAdditiveGaussianNoise | GaussNoise |
IAAPerspective | Perspective |
IAASuperpixels | Superpixels |
IAAAffine | Affine |
IAAPiecewiseAffine | PiecewiseAffine |
Major changes
-
Serialization logic is updated. Previously, Albumentations used the full classpath to identify an augmentation (e.g.
albumentations.augmentations.transforms.RandomCrop
). With the updated logic, Albumentations will use only the class name for augmentations defined in the library (e.g.,RandomCrop
). For custom augmentations created by users and not distributed with Albumentations, the library will continue to use the full classpath to avoid name collisions (e.g., when a user creates a custom augmentation named RandomCrop and uses it in a pipeline).This new logic will allow us to refactor the code without breaking serialized augmentation pipelines created using previous versions of Albumentations. This change will also reduce the size of YAML and JSON files with serialized data.
The new serialization logic is backward compatible. You can load serialized augmentation pipelines created in previous versions of Albumentations because Albumentations supports the old format.
Bugfixes
- Fixed a bug that prevented
A.ReplayCompose
to work with bounding boxes and keypoints correctly. (#748) A.GlassBlur
now correctly works with float32 inputs (#826)MultiplicativeNoise
now correctly works with gray images with shape[h, w, 1]
. (#793)
Minor changes
- Code for geometric transforms moved to a standalone module
albumentations.augmentations.geometric
. (#784) - Code for crop transforms moved to a standalone module
albumentations.augmentations.crops
. (#791) - CI now runs tests under Python 3.9 as well (#830)
- Linters and code formatters for CI and pre-commit hooks are updated to the latest versions (#831)
- Logic in
setup.py
that detects existing installations of OpenCV now also looks foropencv-contrib-python
andopencv-contrib-python-headless
(#837 by @agchang-cgl)
0.5.2
Minor changes
- ToTensorV2 now automatically expands grayscale images with the shape
[H, W]
to the shape[H, W, 1]
. PR #604 by @Ingwar. - CropNonEmptyMaskIfExists now also works with multiple masks that are provided by the
masks
argument to the transform function. Previously this augmentation worked only with a single mask provided by themask
argument. PR #761
0.5.1
Breaking changes
- API for
A.FDA
is changed to resemble API ofA.HistogramMatching
. Now, both transformations expect to receive a list of reference images, a function to read those image, and additional augmentation parameters. (#734) A.HistogramMatching
now usesread_rgb_image
as a defaultread_fn
. This function reads an image from the disk as an RGB NumPy array. Previously, the defaultread_fn
wascv2.imread
which read an image as a BGR NumPy array. (#734)
New transformations
A.Sequential
transform that can apply augmentations in a sequence. This transform is not intended to be a replacement forA.Compose
. Instead, it should be used insideA.Compose
the same wayA.OneOf
orA.OneOrOther
. For instance, you can combineA.OneOf
withA.Sequential
to create an augmentation pipeline containing multiple sequences of augmentations and apply one randomly chosen sequence to input data. (#735)
Minor changes
A.ShiftScaleRotate
now has two additional optional parameters:shift_limit_x
andshift_limit_y
. If either of those parameters (or both of them) is setA.ShiftScaleRotate
will use the set values to shift images on the respective axis. (#735)A.ToTensorV2
now supports an additional argumenttranspose_mask
(False
by default). If the argument is set toTrue
and an input mask has 3 dimensions,A.ToTensorV2
will transpose dimensions of a mask tensor in addition to transposing dimensions of an image tensor. (#735)
Bugfixes
A.FDA
now correctly uses coordinates of the center of an image. (#730)- Fixed problems with grayscale images for
A.HistogramMatching
. (#734) - Fixed a bug that led to an exception when
A.load()
was called to deserialize a pipeline that containedA.ToTensor
orA.ToTensorV2
, but those transforms were not imported in the code before the call. (#735)