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)