Albumentations

Latest version: v1.4.5

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

Scan your dependencies

Page 1 of 4

1.4.5

- Support our work
- Highlights
- Deprecations
- Improvements and bug fixes

Support Our Work
1. Love the library? You can contribute to its development by becoming a [sponsor for the library](https://github.com/sponsors/albumentations-team). Your support is invaluable, and every contribution makes a difference.
2. Haven't starred our repo yet? Show your support with a ⭐! It's just [only one mouse click](https://github.com/albumentations-team/albumentations).
3. Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our [issues](https://github.com/albumentations-team/albumentations/issues) or join the conversation on our [Discord server for Albumentations](https://discord.gg/AmMnDBdzYs)

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:
python
transform = A.Compose([
A.HorizontalFlip(p=0.5)
], bbox_params=A.BboxParams(format='coco'))


Clipping bounding boxes to the image size:

python
transform = A.Compose([
A.HorizontalFlip(p=0.5)
], bbox_params=A.BboxParams(format='coco', clip=True))


by ternaus

SelectiveChannelTransform

Added [SelectiveChannelTransform](https://albumentations.ai/docs/api_reference/full_reference/?#albumentations.core.composition.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:

python
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:
python
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:
python
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.

ternaus

Improvements and bug fixes
- Number of fixes and speedups in the core of the library `Compose` and `BasicTransform` by ayasyrev
- Extended `Contributor's guide` by ternaus
- Can use `random` for `fill_value` in `CoarseDropout`by ternaus
- Fix in [ToGray](https://albumentations.ai/docs/api_reference/full_reference/?#albumentations.augmentations.transforms.ToGray) docstring by wilderrodrigues
- BufFix in [D4](https://albumentations.ai/docs/api_reference/full_reference/?#albumentations.augmentations.geometric.transforms.D4) - now works not only with square, but with rectangular images as well. By ternaus
- BugFix in [RandomCropFromBorders](https://albumentations.ai/docs/api_reference/full_reference/?#albumentations.augmentations.crops.transforms.RandomCropFromBorders) by ternaus

1.4.4

- Support our work
- Highlights
- Transforms
- Improvements and bug fixes


Support Our Work
1. Love the library? You can contribute to its development by becoming a [sponsor for the library](https://github.com/sponsors/albumentations-team). Your support is invaluable, and every contribution makes a difference.
2. Haven't starred our repo yet? Show your support with a ⭐! It's just [only one mouse click](https://github.com/albumentations-team/albumentations).
3. Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our [issues](https://github.com/albumentations-team/albumentations/issues) or join the conversation on our [Discord server for Albumentations](https://discord.gg/AmMnDBdzYs)

Transforms
Added [**D4 transform**](https://albumentations.ai/docs/api_reference/full_reference/?h=d4#albumentations.augmentations.geometric.transforms.D4)

![image](https://github.com/albumentations-team/albumentations/assets/5481618/3ad12afa-991d-4b96-a976-066b59e8eea9)

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:

<img width="831" alt="Screenshot 2024-04-16 at 19 00 05" src="https://github.com/albumentations-team/albumentations/assets/5481618/141a778e-33d5-4804-8a96-167b9bcbe621">

Added new normalizations to [Normalize](https://albumentations.ai/docs/api_reference/augmentations/transforms/?#albumentations.augmentations.transforms.Normalize) transform

- `standard` - `subtract` fixed mean, divide by fixed `std`
- `image` - the same as `standard`, but `mean` and `std` computed for each image independently.
- `image_per_channel` - the same as before, but per channel
- `min_max` - subtract `min(image)`and divide by `max(image) - min(image)`
- `min_max_per_channel` - the same, but per channel
by ternaus

Changes in the interface of [RandomShadow](https://albumentations.ai/docs/api_reference/full_reference/?#albumentations.augmentations.transforms.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](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.RandomGridShuffle)
1. Bugfix by ayasyrev
2. Transform updated to work even if side is not divisible by the number of tiles. by ternaus

Example:
![image](https://github.com/albumentations-team/albumentations/assets/5481618/fd89826f-a457-4b5f-bf84-3f8cdb7fc4ee)

New way to add additional targets
Standard way uses `additional_targets`
python
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`:

python
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](https://albumentations.ai/docs/api_reference/full_reference/?#albumentations.augmentations.geometric.transforms.Affine) by matsumotosan
* Bugfix in [Sequential](https://albumentations.ai/docs/api_reference/full_reference/?h=sequential#albumentations.core.composition.Sequential) by ayasyrev

Documentation
* Updated Contributor's guide. by ternaus
* Added [example notebook on how to apply D4](https://albumentations.ai/docs/examples/example_d4/) to images, masks, bounding boxes and key points. by ternaus
* Added [example notebook on how to apply RandomGridShuffle](https://albumentations.ai/docs/examples/example_gridshuffle/) to images, masks and keypoints. by ternaus

1.4.3

- Request
- Highlights
- New transform
- Minor improvements and bug fixes


Support Our Work
1. Love the library? You can contribute to its development by becoming a [sponsor for the library](https://github.com/sponsors/albumentations-team). Your support is invaluable, and every contribution makes a difference.
2. Haven't starred our repo yet? Show your support with a ⭐! It's just [only one mouse click](https://github.com/albumentations-team/albumentations).
3. Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our [issues](https://github.com/albumentations-team/albumentations/issues) or join the conversation on our [Discord server for Albumentations](https://discord.gg/AmMnDBdzYs)

New transform
<img width="1659" alt="Screenshot 2024-04-02 at 18 43 51" src="https://github.com/albumentations-team/albumentations/assets/5481618/e9c95aab-b2a8-4b12-9d72-86041b08f3ed">

* 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](https://albumentations.ai/docs/benchmarking_results/) by ternaus
* Bugfix in [FDA](https://albumentations.ai/docs/api_reference/augmentations/domain_adaptation/?h=fda#albumentations.augmentations.domain_adaptation.FDA) transform by ternaus
* Now [RandomSizedCrop](https://albumentations.ai/docs/api_reference/full_reference/?h=randomsizedcrop#albumentations.augmentations.crops.transforms.RandomSizedCrop) supports the same signature as analogous transform in torchvision by zetyquickly

1.4.2

- Request
- Highlights
- New transform
- New functionality
- Improvements and bug fixes

Request
1. 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](https://github.com/sponsors/albumentations-team). Every dollar helps.
2. If you did not give our repo a ⭐, it is [only one mouse click](https://github.com/albumentations-team/albumentations)
3. If you have feature requests or proposals or encounter issues - submit your request to [issues](https://github.com/albumentations-team/albumentations/issues) or ask in [Discord server for Albumentations](https://discord.gg/AmMnDBdzYs)

New transform
<div align="center">
<a href="https://i.imgur.com/8wWkMmL.jpeg">
<img src="https://i.imgur.com/8wWkMmL.jpeg" width="30%">
</a>
<a href="https://i.imgur.com/B687Opr.jpeg">
<img src="https://i.imgur.com/B687Opr.jpeg" width="30%">
</a>
<a href="https://i.imgur.com/jkjwFMB.jpeg">
<img src="https://i.imgur.com/jkjwFMB.jpeg" width="30%">
</a>
<p>
<b>Left:</b> Original, <b>Middle:</b> Chromatic aberration (default args, mode="green_purple"), <b>Right:</b> Chromatic aberration (default args, mode="red_blue")
<br>(Image is from our internal mobile mapping dataset)
</p>
</div>

* Added `ChromaticAbberation` transform that adds chromatic distortion to the image. [Wiki](https://en.wikipedia.org/wiki/Chromatic_aberration) by mrsmrynk

New functionality
* Return `mixing parameter` for `MixUp` transform by Dipet. For more details [Tutorial on MixUp](https://albumentations.ai/docs/examples/example_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

- Request
- Highlights
- New transform
- Improvements
- Bug fixes

Request
1. 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](https://github.com/sponsors/albumentations-team). Every dollar helps.
2. If you did not give our repo a ⭐, it is [only one mouse click](https://github.com/albumentations-team/albumentations)
3. If you have feature requests or proposals or encounter issues - submit your request to [issues](https://github.com/albumentations-team/albumentations/issues) or our new initiative, - [Discord server for albumentations](https://discord.gg/AmMnDBdzYs)

New transform

<img width="660" alt="Screenshot 2024-03-04 at 14 52 15" src="https://github.com/albumentations-team/albumentations/assets/5481618/68e5031b-e45e-4578-abe8-1d8e33db4831">

* 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` to `ruff`
* Added extra checks for docstrings to match Google Style.
* Updated [Who's using](https://albumentations.ai/whos_using)
* Removed quidda dependency, which addresses `opencv` library inconsistencies issues
* New, updated version of [benchmark](https://github.com/albumentations-team/albumentations?tab=readme-ov-file#benchmarking-results).

1.4.0

- Request
- Highlights
- New transform
- Backwards Incompatible Changes
- Improvements
- Bug fixes

Request
1. 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](https://github.com/sponsors/albumentations-team). Every dollar helps.
2. If you did not give our repo a ⭐, it is [only one mouse click].(https://github.com/albumentations-team/albumentations)
3. If you have feature requests, proposals, or encounter issues - submit your request to [issues](https://github.com/albumentations-team/albumentations/issues) or, our new initiative, - [Discord server for albumentations](https://discord.gg/AmMnDBdzYs)

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.

1. 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 https://github.com/albumentations-team/albumentations/commit/ba44effb0369ba5eae1e8eb4909105eac9709230 by Dipet .

But, somehow, we are cutting this dependency only in 2024.

2. 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

<img width="560" alt="Screenshot 2024-02-17 at 13 09 01" src="https://github.com/albumentations-team/albumentations/assets/5481618/18aaebad-4b58-4cc6-932f-e2d8a1f352ab">

* 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](https://albumentations.ai/docs/api_reference/augmentations/dropout/coarse_dropout/), [MaskDropout](https://albumentations.ai/docs/api_reference/augmentations/dropout/mask_dropout/), [GridDropout](https://albumentations.ai/docs/api_reference/augmentations/dropout/grid_dropout/) it supports images, masks and keypoints as targets. (https://github.com/albumentations-team/albumentations/commit/004fabbf90794fbc21ee356e2dde6637b7fecbd4 by ternaus )

Backward Incompatible Changes
The deprecated code, including 15 transforms, was removed.
Dependency on the [imgaug](https://imgaug.readthedocs.io/en/latest/) library was removed.

(https://github.com/albumentations-team/albumentations/commit/be6a217b207b3d7ebe792caabb438d660b45f2a5 by ternaus )

Deleted Transforms
1. `JpegCompression`. Use [ImageCompression](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.ImageCompression) instead.
2. `RandomBrightness`. Use [RandomBrigtnessContrast](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.RandomBrightnessContrast) instead.
3. `RandomContrast`. Use [RandomBrigtnessContrast](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.RandomBrightnessContrast) instead.
4. `Cutout`. Use [CoarseDropout](https://albumentations.ai/docs/api_reference/augmentations/dropout/coarse_dropout/#coarsedropout-augmentation-augmentationsdropoutcoarse_dropout) instead.
5. `ToTensor`. Use [ToTensorV2](https://albumentations.ai/docs/api_reference/pytorch/transforms/#albumentations.pytorch.transforms.ToTensorV2) instead.
6. `IAAAdditiveGaussianNoise`. Use [GaussNoise](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.GaussNoise) instead.
7. `IAAAffine`. Use [Affine](https://albumentations.ai/docs/api_reference/augmentations/geometric/transforms/#albumentations.augmentations.geometric.transforms.Affine) instead.
8. IAACropAndPad. Use [CropAndPad](https://albumentations.ai/docs/api_reference/augmentations/crops/transforms/#albumentations.augmentations.crops.transforms.CropAndPad) instead.
9. `IAAEmboss`. Use [Emboss](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Emboss) instead.
10. `IAAFliplr`. Use [HorizontalFlip](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.HorizontalFlip) instead.
11. `IAAFlipud`. Use [VerticalFlip](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.geometric.transforms.VerticalFlip) instead.
12. `IAAPerspective`. Use [Perspective](https://albumentations.ai/docs/api_reference/augmentations/geometric/transforms/#albumentations.augmentations.geometric.transforms.Perspective) instead.
13. `IAAPiecewiseAffine`. Use [PiecewiseAffine](https://albumentations.ai/docs/api_reference/augmentations/geometric/transforms/#albumentations.augmentations.geometric.transforms.PiecewiseAffine) instead.
14. `IAASharpen`. Use [Sharpen](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Sharpen) instead.
15. `IAASuperpixels`. Use [Superpixels](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.Superpixels) instead.

Other deprecated functionality
* Removed `eps` parameter in [RandomGamma](https://albumentations.ai/docs/api_reference/augmentations/transforms/#albumentations.augmentations.transforms.RandomGamma)
* Removed `lambda_transforms`in `serialization.from_dict` function.

Minor changes and Bug Fixes
* Added details [Contributor's guide](https://github.com/albumentations-team/albumentations/blob/main/CONTRIBUTING.md)
* Added support for `matrix=None` case for Piecewise affine transform (https://github.com/albumentations-team/albumentations/commit/c70e664e060bfd7463c20674927aed217f72d437 Dipet )
* Bugfix - Eliminated the possibility of the Perspective transform collapsing (https://github.com/albumentations-team/albumentations/commit/a919a772d763e0c62b674ca490a97c89e0b9c5a3 alicangok )
* Fixes in docstrings (domef, aaronzs, Dipet, ternaus )
* Added checks for python 3.12

Page 1 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.