Releases: albumentations-team/albumentations
Albumentations 1.4.5 Release Notes
- Support our work
- Highlights
- Deprecations
- Improvements and bug fixes
Support Our Work
- Love the library? You can contribute to its development by becoming a sponsor for the library. Your support is invaluable, and every contribution makes a difference.
- Haven't starred our repo yet? Show your support with a ⭐! It's just only one mouse click.
- Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our issues or join the conversation on our Discord server for Albumentations
Highlights
Bbox clipping
Before version 1.4.5 it was assumed that bounding boxes that are fed into the augmentation pipeline should not extend outside of the image.
Now we added an option to clip boxes to the image size before augmenting them. This makes pipeline more robust to inaccurate labeling
Example:
Will fail if boxes extend outside of the image:
transform = A.Compose([
A.HorizontalFlip(p=0.5)
], bbox_params=A.BboxParams(format='coco'))
Clipping bounding boxes to the image size:
transform = A.Compose([
A.HorizontalFlip(p=0.5)
], bbox_params=A.BboxParams(format='coco', clip=True))
by @ternaus
SelectiveChannelTransform
Added SelectiveChannelTransform that allows to apply transforms to a selected number of channels.
For example it could be helpful when working with multispectral images, when RGB is a subset of the overall multispectral stack which is common when working with satellite imagery.
Example:
aug = A.Compose(
[A.HorizontalFlip(p=0.5),
A.SelectiveChannelTransform(transforms=[A.ColorJItter(p=0.5),
A.ChromaticAberration(p=0.5))], channels=[1, 2, 18], p=1)],
)
Here HorizontalFlip applied to the whole multispectral image, but pipeline of ColorJitter
and ChromaticAberration
only to channels [1, 2, 18]
by @ternaus
Deprecations
CoarseDropout
Old way:
transform = A.Compose([A.CoarseDropout(
min_holes = 5,
max_holes = 8,
min_width = 3,
max_width = 12,
min_height = 4,
max_height = 5
)])
New way:
transform = A.Compose([A.CoarseDropout(
num_holes_range=(5, 8),
hole_width_range=(3, 12),
hole_height_range=(4, 5)
)])
As of now both ways work and will provide the same result, but old functionality will be removed in later releases.
Improvements and bug fixes
- Number of fixes and speedups in the core of the library
Compose
andBasicTransform
by @ayasyrev - Extended
Contributor's guide
by @ternaus - Can use
random
forfill_value
inCoarseDropout
by @ternaus - Fix in ToGray docstring by @wilderrodrigues
- BufFix in D4 - now works not only with square, but with rectangular images as well. By @ternaus
- BugFix in RandomCropFromBorders by @ternaus
Albumentations 1.4.4 Release Notes
Albumentations 1.4.4 Release Notes
- Support our work
- Highlights
- Transforms
- Improvements and bug fixes
Support Our Work
- Love the library? You can contribute to its development by becoming a sponsor for the library. Your support is invaluable, and every contribution makes a difference.
- Haven't starred our repo yet? Show your support with a ⭐! It's just only one mouse click.
- Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our issues or join the conversation on our Discord server for Albumentations
Transforms
Added D4 transform
Applies one of the eight possible D4 dihedral group transformations to a square-shaped input, maintaining the square shape. These transformations correspond to the symmetries of a square, including rotations and reflections by @ternaus
The D4 group transformations include:
- e
(identity): No transformation is applied.
- r90
(rotation by 90 degrees counterclockwise)
- r180
(rotation by 180 degrees)
- r270
(rotation by 270 degrees counterclockwise)
- v
(reflection across the vertical midline)
- hvt
(reflection across the anti-diagonal)
- h
(reflection across the horizontal midline)
- t
(reflection across the main diagonal)
Could be applied to:
- image
- mask
- bounding boxes
- key points
Does not generate interpolation artifacts as there is no interpolation.
Provides the most value in tasks where data is invariant to rotations and reflections like:
- Top view drone and satellite imagery
- Medical images
Example:
Added new normalizations to Normalize transform
standard
-subtract
fixed mean, divide by fixedstd
image
- the same asstandard
, butmean
andstd
computed for each image independently.image_per_channel
- the same as before, but per channelmin_max
- subtractmin(image)
and divide bymax(image) - min(image)
min_max_per_channel
- the same, but per channel
by @ternaus
Changes in the interface of RandomShadow
New, preferred wat is to use num_shadows_limit
instead of num_shadows_lower
/ num_shadows_upper
by @ayasyrev
Improvements and bug fixes
Added check for input parameters to transforms with Pydantic
Now all input parameters are validated and prepared with Pydantic. This will prevent bugs, when transforms are initialized without errors with parameters that are outside of allowed ranges.
by @ternaus
Updates in RandomGridShuffle
- Bugfix by @ayasyrev
- Transform updated to work even if side is not divisible by the number of tiles. by @ternaus
New way to add additional targets
Standard way uses additional_targets
transform = A.Compose(
transforms=[A.Rotate(limit=(90.0, 90.0), p=1.0)],
keypoint_params=A.KeypointParams(
angle_in_degrees=True,
check_each_transform=True,
format="xyas",
label_fields=None,
remove_invisible=False,
),
additional_targets={"keypoints2": "keypoints"},
)
Now you can also add them using add_targets
:
transform = A.Compose(
transforms=[A.Rotate(limit=(90.0, 90.0), p=1.0)],
keypoint_params=A.KeypointParams(
angle_in_degrees=True,
check_each_transform=True,
format="xyas",
label_fields=None,
remove_invisible=False,
),
)
transform.add_targets({"keypoints2": "keypoints"})
by @ayasyrev
Small fixes
- Small speedup in the code for transforms that use
add_weighted
function by @gogetron - Fix in error message in Affine transform by @matsumotosan
- Bugfix in Sequential by @ayasyrev
Documentation
- Updated Contributor's guide. by @ternaus
- Added example notebook on how to apply D4 to images, masks, bounding boxes and key points. by @ternaus
- Added example notebook on how to apply RandomGridShuffle to images, masks and keypoints. by @ternaus
Albumentations 1.4.3 Release Notes
Albumentations 1.4.3 Release Notes
- Request
- Highlights
- New transform
- Minor improvements and bug fixes
Support Our Work
- Love the library? You can contribute to its development by becoming a sponsor for the library. Your support is invaluable, and every contribution makes a difference.
- Haven't starred our repo yet? Show your support with a ⭐! It's just only one mouse click.
- Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our issues or join the conversation on our Discord server for Albumentations
New transform
- Added
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.
Minor improvements and bug fixes
- Updated benchmark for uint8 images, processed on CPU. Added Kornia and Augly. LINK by @ternaus
- Bugfix in FDA transform by @ternaus
- Now RandomSizedCrop supports the same signature as analogous transform in torchvision by @zetyquickly
1.4.2
Albumentations 1.4.2 Release Notes
- Request
- Highlights
- New transform
- New functionality
- Improvements and bug fixes
Request
- If you enjoy using the library as an individual developer or as a representative of the company please consider becoming a sponsor for the library. Every dollar helps.
- If you did not give our repo a ⭐, it is only one mouse click
- If you have feature requests or proposals or encounter issues - submit your request to issues or ask in Discord server for Albumentations
New transform
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)
New functionality
- Return
mixing parameter
forMixUp
transform by @Dipet. For more details Tutorial on MixUp
Improvements and Bugfixes
- Do not throw deprecation warning when people do not use deprecated parameters in
AdvancedBlur
by @Aloqeely - Updated
CONTRIBUTORS.md
for Windows users by @Aloqeely - Fixed Docstring for
DownScale
transform by @ryoryon66 - Bugfix in
PadIfNeeded
serialization @ternaus
1.4.1
Albumentations 1.4.1 Release Notes
- Request
- Highlights
- New transform
- Improvements
- Bug fixes
Request
- If you enjoy using the library as an individual developer or during the day job as a part of the company, please consider becoming a sponsor for the library. Every dollar helps.
- If you did not give our repo a ⭐, it is only one mouse click
- If you have feature requests or proposals or encounter issues - submit your request to issues or our new initiative, - Discord server for albumentations
New transform
- Added
MixUp
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.
Minor changes and Bug Fixes
- Moved from
isort
,flake8
,black
toruff
- Added extra checks for docstrings to match Google Style.
- Updated Who's using
- Removed quidda dependency, which addresses
opencv
library inconsistencies issues - New, updated version of benchmark.
1.4.0
Albumentations 1.4.0 Release Notes
- Request
- Highlights
- New transform
- Backwards Incompatible Changes
- Improvements
- Bug fixes
Request
- If you enjoy using the library as an individual developer or during the day job as a part of the company, please consider becoming a sponsor for the library. Every dollar helps.
- If you did not give our repo a ⭐, it is [only one mouse click].(https://github.com/albumentations-team/albumentations)
- If you have feature requests, proposals, or encounter issues - submit your request to issues or, our new initiative, - Discord server for albumentations
Highlights
In 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.
- We are removing the dependency on the imgaug library. The library was one of our inspirations when we created Albumentations, but maintainers of imgaug ceased its support which caused inconsistencies in library versions. It was done in 2021, say commit ba44eff by @Dipet .
But, somehow, we are cutting this dependency only in 2024.
- Added typing in all of the codebase. When we started the library, Python 2 was still widely used; hence, none of the original codebases had types specified for function arguments and return types. Since the end of the support for Python 2, we added types to the new or updated code, but only now have we covered all the codebase.
New transform
- Added
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. (004fabb by @ternaus )
Backward Incompatible Changes
The deprecated code, including 15 transforms, was removed.
Dependency on the imgaug library was removed.
Deleted Transforms
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.- IAACropAndPad. Use CropAndPad 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.
Other deprecated functionality
- Removed
eps
parameter in RandomGamma - Removed
lambda_transforms
inserialization.from_dict
function.
Minor changes and Bug Fixes
- Added details Contributor's guide
- Added support for
matrix=None
case for Piecewise affine transform (c70e664 @Dipet ) - Bugfix - Eliminated the possibility of the Perspective transform collapsing (a919a77 @alicangok )
- Fixes in docstrings (@domef, @aaronzs, @Dipet, @ternaus )
- Added checks for python 3.12
1.3.1
New augmentations
ToRGB
transform (#1323 by @kinoooshnik)RandomGravel
transform (#1365 by @onurtore)
Minor changes
- Color parameter for
Spatter
(#1305 by @Andredance) - Check for image and masks shape equality (#1310 by @Andredance)
- Filter out bounding boxes with width or height below parameters (#1327 by @jangop)
- Added
rotate_method
inAffine
(#1394 by @i-aki-y)
Bugfixes
- Docs and types fixes (#1314 by @oguz-hanoglu, #1320 by @jangop, #1379 by @Dipet, #1403 by @NatanBagrov, #1400 by @ajinkyakhadilkar, #1343 by @plashchynski)
- Fixed check when mask is ndarrray (#1326 by @farizrahman4u)
- Fixed keypoint detection in hole for
CoarseDropout
(#1330 by @domef) - Fixed deprecated imports of
scipy.ndimage.gaussian_filter
(#1311 by @rbu) - Changed the sampling procedure of circles for
RandomSunFlare
(#1333 by @jasonrock-a3) - Fixed deprecationwarning in
ToSepia
transform (#1397 by @ifeherva) - Fixed
skimage
deprecetions (#1421 by @Dipet) - Python3.11 support fixes (#1426 by @Erotemic)
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)