Albumentations

Latest version: v2.0.5

Safety actively analyzes 723177 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 8

1.0.3

- Fixed problem with incorrect shape at keypoints and bboxes processors after `ToTensorV2` 963
- Fixed problems with float values in YOLO format in edge cases 958

1.0.2

1. Fixed YOLO format conversion problem when bbox greater than image by 1 pixel.
Now YOLO bbox will be converted to Albumentations format without bbox denormalization.
More info in PR: 924
2. Removed redundant search of first & last dual transform 946

1.0.1

Added position argument to [PadIfNeeded](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.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.

![image_padding_2](https://user-images.githubusercontent.com/681989/124466112-f2064300-dd9e-11eb-8ac2-2fba2e3b6e58.jpg)
[image source](https://www.pexels.com/photo/blue-car-driving-through-dense-green-forest-4090350/)

1.0.0

Breaking changes
- [`imgaug`](https://github.com/aleju/imgaug) dependency is now optional, and by default, Albumentations won't install it. This change was necessary to prevent simultaneous install of both `opencv-python-headless` and `opencv-python` (you can read more about the problem in [this issue](https://github.com/aleju/imgaug/issues/737)). If you still need `imgaug` as a dependency, you can use the `pip install -U albumentations[imgaug]` command to install Albumentations with `imgaug`.
- Deprecated augmentation `ToTensor` that converts NumPy arrays to PyTorch tensors is completely removed from Albumentations. You will get a `RuntimeError` exception if you try to use it. Please switch to [`ToTensorV2`](https://albumentations.ai/docs/api_reference/pytorch/transforms/#albumentations.pytorch.transforms.ToTensorV2) in your pipelines.

New augmentations
- [`A.RandomToneCurve`](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.RandomToneCurve). See a [notebook](https://nbviewer.jupyter.org/github/aaroswings/RandomToneCurveTests/blob/main/RandomToneCurveTests.ipynb) for examples of this augmentation (#839 by aaroswings)
- [`SafeRotate`](https://albumentations.ai/docs/api_reference/augmentations/geometric/rotate/#albumentations.augmentations.geometric.rotate.SafeRotate). Safely Rotate Images Without Cropping (888 by deleomike)
- [`SomeOf`](https://albumentations.ai/docs/api_reference/core/composition/#albumentations.core.composition.SomeOf) transform that applies N augmentations from a list. Generalizing of [`OneOf`](https://albumentations.ai/docs/api_reference/core/composition/#albumentations.core.composition.OneOf) (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](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAACropAndPad) | [CropAndPad](https://albumentations.ai/docs/api_reference/augmentations/crops/transforms/#albumentations.augmentations.crops.transforms.CropAndPad) |
| IAAFliplr | [HorizontalFlip](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.HorizontalFlip) |
| IAAFlipud | [VerticalFlip](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.VerticalFlip) |
| [IAAEmboss](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAAEmboss) | [Emboss](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Emboss) |
| [IAASharpen](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAASharpen) | [Sharpen](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Sharpen) |
| [IAAAdditiveGaussianNoise](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAAAdditiveGaussianNoise) | [GaussNoise](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.GaussNoise) |
| [IAAPerspective](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAAPerspective) | [Perspective](https://albumentations.ai/docs/api_reference/augmentations/geometric/transforms/#albumentations.augmentations.geometric.transforms.Perspective) |
| [IAASuperpixels](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAASuperpixels) | [Superpixels](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Superpixels) |
| [IAAAffine](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAAAffine) | [Affine](https://albumentations.ai/docs/api_reference/augmentations/geometric/transforms/#albumentations.augmentations.geometric.transforms.Affine) |
| [IAAPiecewiseAffine](https://albumentations.ai/docs/api_reference/imgaug/transforms/#albumentations.imgaug.transforms.IAAPiecewiseAffine) | [PiecewiseAffine](https://albumentations.ai/docs/api_reference/augmentations/geometric/transforms/#albumentations.augmentations.geometric.transforms.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`](https://albumentations.ai/docs/examples/replay/) to work with bounding boxes and keypoints correctly. (#748)
- [`A.GlassBlur`](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.GlassBlur) now correctly works with float32 inputs (826)
- [`MultiplicativeNoise`](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.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`](https://github.com/albumentations-team/albumentations/tree/master/albumentations/augmentations/geometric). (#784)
- Code for crop transforms moved to a standalone module [`albumentations.augmentations.crops`](https://github.com/albumentations-team/albumentations/tree/master/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 for `opencv-contrib-python` and `opencv-contrib-python-headless` (837 by agchang-cgl)

0.5.2

Minor changes
- [ToTensorV2](https://albumentations.ai/docs/api_reference/pytorch/transforms/#albumentations.pytorch.transforms.ToTensorV2) now automatically expands grayscale images with the shape `[H, W]` to the shape `[H, W, 1]`. PR 604 by Ingwar.
- [CropNonEmptyMaskIfExists ](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.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 the `mask` argument. PR 761

0.5.1

Breaking changes
- API for [`A.FDA`](https://albumentations.ai/docs/api_reference/augmentations/domain_adaptation/#albumentations.augmentations.domain_adaptation.FDA) is changed to resemble API of [`A.HistogramMatching`](https://albumentations.ai/docs/api_reference/augmentations/domain_adaptation/#albumentations.augmentations.domain_adaptation.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`](https://albumentations.ai/docs/api_reference/augmentations/domain_adaptation/#albumentations.augmentations.domain_adaptation.HistogramMatching) now uses`read_rgb_image` as a default `read_fn`. This function reads an image from the disk as an RGB NumPy array. Previously, the default `read_fn` was `cv2.imread` which read an image as a BGR NumPy array. (734)

New transformations
- [`A.Sequential`](https://albumentations.ai/docs/api_reference/core/composition/#albumentations.core.composition.Sequential) transform that can apply augmentations in a sequence. This transform is not intended to be a replacement for `A.Compose`. Instead, it should be used inside `A.Compose` the same way `A.OneOf` or `A.OneOrOther`. For instance, you can combine `A.OneOf` with `A.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`](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.ShiftScaleRotate) now has two additional optional parameters: `shift_limit_x` and `shift_limit_y`. If either of those parameters (or both of them) is set `A.ShiftScaleRotate` will use the set values to shift images on the respective axis. (735)
- [`A.ToTensorV2`](https://albumentations.ai/docs/api_reference/pytorch/transforms/#albumentations.pytorch.transforms.ToTensorV2) now supports an additional argument `transpose_mask` (`False` by default). If the argument is set to `True` 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`](https://albumentations.ai/docs/api_reference/augmentations/domain_adaptation/#albumentations.augmentations.domain_adaptation.FDA) now correctly uses coordinates of the center of an image. (730)
- Fixed problems with grayscale images for [`A.HistogramMatching`](https://albumentations.ai/docs/api_reference/augmentations/domain_adaptation/#albumentations.augmentations.domain_adaptation.HistogramMatching). (734)
- Fixed a bug that led to an exception when `A.load()` was called to deserialize a pipeline that contained `A.ToTensor` or `A.ToTensorV2`, but those transforms were not imported in the code before the call. (735)

Page 7 of 8

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.