Albumentations

Latest version: v2.0.4

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

Scan your dependencies

Page 1 of 8

2.0.4

* Support Our Work
* Transforms
* Bug fixes and speedups

Support Our Work
1. **Help Us Grow** - If you find value in Albumentations, consider [becoming a sponsor](https://github.com/sponsors/albumentations-team). Every contribution, no matter the size, helps us maintain and improve the library for everyone.
2. **Show Your Support** - If you enjoy using Albumentations, consider giving us a ⭐ on [GitHub](https://github.com/albumentations-team/albumentations). It helps others discover the library and motivates our team.
3. **Join Our Community** - Have suggestions or ran into issues? We welcome your input! Share your experience in our [GitHub issues](https://github.com/albumentations-team/albumentations/issues) or connect with us on [Discord](https://discord.gg/AmMnDBdzYs).

Transforms
Added [HEStain](https://explore.albumentations.ai/transform/HEStain) transform

python
Applies H&E (Hematoxylin and Eosin) stain augmentation to histopathology images.

This transform simulates different H&E staining conditions using either:
1. Predefined stain matrices (8 standard references)
2. Vahadane method for stain extraction
3. Macenko method for stain extraction
4. Custom stain matrices


<img width="1484" alt="Screenshot 2025-02-09 at 6 15 50 PM" src="https://github.com/user-attachments/assets/cdb9d823-aef3-4045-8f79-75a0b3334b1b" />

Bug fixes and speedups
- Fix in docstring in [Rotate](https://explore.albumentations.ai/transform/Rotate) by MalteEbner
- Extended and clarified docstring in Compose on how to fix random seed also added this info to [FAQ](https://albumentations.ai/docs/faq/#how-to-have-reproducible-augmentations)
- Bugfix in [RandomRain](https://explore.albumentations.ai/transform/RandomRain)
- 1.5 times speedup in [GaussNoise](https://explore.albumentations.ai/transform/GaussNoise) by vedantdalimkar

2.0.3

* Support Our Work
* Core
* Bug fixes and speedups

Support Our Work
1. **Help Us Grow** - If you find value in Albumentations, consider [becoming a sponsor](https://github.com/sponsors/albumentations-team). Every contribution, no matter the size, helps us maintain and improve the library for everyone.
2. **Show Your Support** - If you enjoy using Albumentations, consider giving us a ⭐ on [GitHub](https://github.com/albumentations-team/albumentations). It helps others discover the library and motivates our team.
3. **Join Our Community** - Have suggestions or ran into issues? We welcome your input! Share your experience in our [GitHub issues](https://github.com/albumentations-team/albumentations/issues) or connect with us on [Discord](https://discord.gg/AmMnDBdzYs).

Core

Extended the functionality of the `strict` parameter in Compose.

Now, if `strict=True` and you pass incorrect arguments to transforms in Compose => will get error.

if `strict=False` you will get only a warning

There was a lot of deprecation in the last year. It may happen that your augmentation pipeline does not behave as expected, as parameters that use in transforms are ignored, and default values are used instead.

Bug fixes and speedups
- Bugfix in filtering of bounding boxes based on aspect ratio by CristoJV
- Speedup In [SaltAndPepper](https://explore.albumentations.ai/transform/SaltAndPepper)
- Speedup in [AutoContrast](https://explore.albumentations.ai/transform/AutoContrast)
- Speedup in Illumination [Illumination](https://explore.albumentations.ai/transform/Illumination)
- Speedup in [ElasticTransform](https://explore.albumentations.ai/transform/ElasticTransform)
- Speedup in [RandomRain](https://explore.albumentations.ai/transform/RandomRain)
- Bugfix in passing int `np.array`as labels in BboxParams

2.0.2

* Support Our Work
* Core
* Bug fixes and speedups

Support Our Work
1. **Help Us Grow** - If you find value in Albumentations, consider [becoming a sponsor](https://github.com/sponsors/albumentations-team). Every contribution, no matter the size, helps us maintain and improve the library for everyone.
2. **Show Your Support** - If you enjoy using Albumentations, consider giving us a ⭐ on [GitHub](https://github.com/albumentations-team/albumentations). It helps others discover the library and motivates our team.
3. **Join Our Community** - Have suggestions or ran into issues? We welcome your input! Share your experience in our [GitHub issues](https://github.com/albumentations-team/albumentations/issues) or connect with us on [Discord](https://discord.gg/AmMnDBdzYs).


Core
Added parameter `max_accept_ratio` to BBoxParams

python
max_accept_ratio (float | None): Maximum allowed aspect ratio for bounding boxes.
The aspect ratio is calculated as max(width/height, height/width), so it's always >= 1.
Boxes with aspect ratio greater than this value will be filtered out.
For example, if `max_accept_ratio=3.0`, boxes with width:height or height:width ratios
greater than 3:1 will be removed. Set to None to disable aspect ratio filtering. Default: None.


Bugfixes and Speedups
- Bugfix in `clip=True` in `BboxParams`, was clipping not only boxes, but class labels if passed as numpy array
- BugFix in keypoints in all distortions: Elastic, Optical, Grid, ThinPlateSpline,
- Speedup in `PlasmaShadow`, `PlasmaBrightnessContrast`, `ChannelShuffle`

2.0.1

* Support Our Work
* Core
* Bugfixes and speedups

Support Our Work
1. **Help Us Grow** - If you find value in Albumentations, consider [becoming a sponsor](https://github.com/sponsors/albumentations-team). Every contribution, no matter the size, helps us maintain and improve the library for everyone.
2. **Show Your Support** - If you enjoy using Albumentations, consider giving us a ⭐ on [GitHub](https://github.com/albumentations-team/albumentations). It helps others discover the library and motivates our team.
3. **Join Our Community** - Have suggestions or ran into issues? We welcome your input! Share your experience in our [GitHub issues](https://github.com/albumentations-team/albumentations/issues) or connect with us on [Discord](https://discord.gg/AmMnDBdzYs).

Core
Added parameter `filter_invalid_bboxes` to `BboxParams`.

If True, filters out invalid bounding boxes (e.g., boxes with negative dimensions or boxes where `x_max < x_min` or `y_max < y_min` at the beginning of the pipeline. If `clip=True`, filtering is applied after clipping. Default: False.

Bugfixes and speedups:
- Speedup in CubicSymmetry by ternaus
- Speedup in `FromFloat`, when applied to `images`, `volume`, `volumes`
- Bugfix in [PixelDropout](https://explore.albumentations.ai/transform/PixelDropout), was not supporting sequence as `fill`
- BugFix in [GaussianBlur](https://explore.albumentations.ai/transform/GaussianBlur). Did not preserve brightness and did not scale properly at large `sigma`. Fixed. Also now matches behavior in `PIL` pretty close
- Bugfix in distortions: [OpticalDistortion](https://explore.albumentations.ai/transform/OpticalDistortion), [GridDistortion](https://explore.albumentations.ai/transform/GridDistortion), [ElasticTransform](https://explore.albumentations.ai/transform/ElasticTransform), [ThinPlateSpline](https://explore.albumentations.ai/transform/ThinPlateSpline). Only bounding boxes and keypoints were affected. by RhysEvan

2.0.0

This is major release, meaning

- only one new transform

- a lot of changes.
- all parameter renaming was moved through deprecations => you got deprecation warning for months
- A few transform have change of default parameters. If you always specify parameters for each augmentations => it will not affect you.

If you have questions or proposals:
- [GitHub issues](https://github.com/albumentations-team/albumentations/issues)
- [Discord](https://discord.gg/AmMnDBdzYs)

If you have complaints:
- Will be happy to see you as one of our sponsors at https://github.com/sponsors/albumentations-team

New transform
[ConstrainedCoarseDropout](https://explore.albumentations.ai/transform/ConstrainedCoarseDropout)

<img width="1224" alt="Screenshot 2025-01-03 at 5 58 27 PM" src="https://github.com/user-attachments/assets/71669a29-fb4d-43a9-9e77-d0746cfdcfb2" />

by vedantdalimkar

Core
- Deleted `always_apply` => use `p=1` to always apply and `p=0` for not applying.
- Deleted `update_params`, `get_params_dependent_on_targets` => use `get_params_dependent_on_data`

Transforms
[GaussNoise](https://explore.albumentations.ai/transform/GaussNoise)
- Deleted: `var_limit`, `mean`
- Use: `std_range`, `mean_range`

It is not just a renaming, `var_limit` and `std_range` sample from different distributions. Sampling from `std_range` matches with other libraries like torchvision.

[AdvancedBlur](https://explore.albumentations.ai/transform/AdvancedBlur)
- Deleted: `sigmaX_limit`, `sigmaY_limit`
- Use: `sigma_x_limit`, `sigma_y_limit`

[RandomCrop](https://explore.albumentations.ai/transform/RandomCrop)
- Deleted `pad_mode`, `pad_val_mask`, `pad_cvl`
- Use: `border_mode`, `fill_mask`, `fill`

[CenterCrop](https://explore.albumentations.ai/transform/CenterCrop)
- Deleted `pad_mode`, `pad_val_mask`, `pad_cvl`
- Use: `border_mode`, `fill_mask`, `fill`

[Crop](https://explore.albumentations.ai/transform/Crop)
- Deleted `pad_mode`, `pad_val_mask`, `pad_cvl`
- Use: `border_mode`, `fill_mask`, `fill`

[RandomResizedCrop](https://explore.albumentations.ai/transform/RandomResizedCrop)
- Deleted: `height`, `width`
- Use: `size`

[RandomSizedCrop](https://explore.albumentations.ai/transform/RandomSizedCrop)
- Deleted: `height`, `width`
- Use: `size`

[RandomCropNearBBox](https://explore.albumentations.ai/transform/RandomCropNearBBox)
- Deleted: `cropping_box_key`
- Use: `cropping_bbox_key`

[CropAndPad](https://explore.albumentations.ai/transform/CropAndPad)
- Deleted: `pad_mode`, `pad_val_mask`, `pad_cvl`
- Use: `border_mode`, `fill_mask`, `fill`

[TemplateTransform](https://explore.albumentations.ai/transform/TemplateTransform)
- Deleted: `template_weight`

[ChannelDropout](https://explore.albumentations.ai/transform/ChannelDropout)
- Deleted: `fill_value`
- Use: `fill`

[CoarseDropout](https://explore.albumentations.ai/transform/CoarseDropout)
- Deleted: `min_holes`, `max_holes`, `min_height`, `max_height`, `min_width`, `max_width`, `mask_fill_value`, `fill_value`
- Use: `num_holes_range`, `hole_height_range`, `hole_width_range`, `fill`, `fill_mask`

Also default parameters changed:
`num_height_range = (8, 8)` => `num_height_range = (0.1, 0.2)`
`num_width_range = (8, 8)` => `num_width_range = (0.1, 0.2)`

[GridDropout](https://explore.albumentations.ai/transform/GridDropout)
- Deleted: `unit_size_min`, `unit_size_max`, `holes_number_x`, `holes_number_y`, `shift_x`, `shift_y`, `fill_value`, `mask_fill_value`
- Use: `unit_size_range`, `holes_number_xy`, `fill`, `fill_mask`

[MaskDropout](https://explore.albumentations.ai/transform/MaskDropout)
- Deleted: `image_fill_value`, `mask_fill_value`
- Use: `fill`, `fill_mask`

[XYMasking](https://explore.albumentations.ai/transform/XYMasking)
- Deleted: `mask_fill_value`, `fill_value`
- Use: `fill`, `fill_mask`

[Rotate](https://explore.albumentations.ai/transform/Rotate)
- Deleted: `value`, `mask_value`
- Use: `fill`, `fill_mask`

Changed default value for border_mode from `cv2.BORDER_REFLECT_101` to `cv2.BORDER_CONSTANT`

[SafeRotate](https://explore.albumentations.ai/transform/SafeRotate)
- Deleted: `value`, `mask_value`
- Use: `fill`, `fill_mask`

Changed default value for border_mode from `cv2.BORDER_REFLECT_101` to `cv2.BORDER_CONSTANT`

[ElasticTransform](https://explore.albumentations.ai/transform/ElasticTransform)
- Deleted: `border_mode`, `value`, `mask_value`

[Perspective](https://explore.albumentations.ai/transform/Perspective)
- Deleted: `pad_mode`, `pad_val`, `mask_pad_val`

[Affine](https://explore.albumentations.ai/transform/Affine)
- Deleted: `cval`, `cval_mask`, `mode`
- Use: `fill`, `fill_mask`, `border_mode`

[ShiftScaleRotate](https://explore.albumentations.ai/transform/ShiftScaleRotate)
- Deleted: `value`, `mask_value`
- Use: `fill`, `fill_mask`

Changed default border_mode from `cv2.BORDER_REFLECT_101` to `cv2.BORDER_CONSTANT`

[PiesewiseAffine](https://explore.albumentations.ai/transform/PiecewiseAffine)
- Deleted: `cval`, `cval_mask`, `mode`, `keypoints_threshold`

[OpticalDistortion](https://explore.albumentations.ai/transform/OpticalDistortion)
- Deleted: `shift_limit`, `value`, `mask_value`, `border_mode`

[GridDistortion](https://explore.albumentations.ai/transform/GridDistortion)
- Deleted: `value`, `mask_value`, `border_mode`

[RandomRotate90](https://explore.albumentations.ai/transform/RandomRotate90)
Changed default probability from `p=0.5` to `p=1`

[PadIfNeeded](https://explore.albumentations.ai/transform/PadIfNeeded)
- Deleted: `value`, `mask_value`
- Use: `fill`, `fill_mask`

Changed default value for `border_mode` from `cv2.BORDER_REFLECT_101` to `cv2.BORDER_CONSTANT`

[ImageCompression](https://explore.albumentations.ai/transform/ImageCompression)
- Deleted: `quality_lower`, `quality_upper`
- Use: `quality_range`

[RandomSnow](https://explore.albumentations.ai/transform/RandomSnow)
- Deleted: `snow_point_lower`, `snow_point_upper`
- Use: `snow_point_range`

[RandomRain](https://explore.albumentations.ai/transform/RandomRain)
- Deleted: `slant_lower`, `slant_upper`
- Use: `slant_range`

[RandomFog](https://explore.albumentations.ai/transform/RandomFog)
- Deleted: `fog_coef_lower`, `fog_coef_upper`
- Use: `fog_coef_range`

[RandomSunFlare](https://explore.albumentations.ai/transform/RandomSunFlare)
- Deleted: `angle_lower`, `angle_upper`, `num_flare_circles_lower`, `num_flare_circles_upper`
- Use: `num_flare_circles_range`, `angle_range`

[RandomShadow](https://explore.albumentations.ai/transform/RandomShadow)
- Deleted: `num_shadows_lower`, `num_shadows_upper`
- Use: `num_shadows_limit`

[Solarize](https://explore.albumentations.ai/transform/Solarize)
- Deleted: `threshold`
- Use: `threshold_range`

[Downscale](https://explore.albumentations.ai/transform/Downscale)
- Deleted `interpolation`, `scale_min`, `scale_max`
- Use: `interpolation_pair`, `scale_range`

by ternaus

Small improvements
- Fixed links in readme by guspan-tanadi
- Better bounding box processing in Dropouts

1.4.24

* Support Our Work
* Core
* Transforms
* Bugfixes

Support Our Work
1. **Help Us Grow** - If you find value in Albumentations, consider [becoming a sponsor](https://github.com/sponsors/albumentations-team). Every contribution, no matter the size, helps us maintain and improve the library for everyone.
2. **Show Your Support** - If you enjoy using Albumentations, consider giving us a ⭐ on [GitHub](https://github.com/albumentations-team/albumentations). It helps others discover the library and motivates our team.
3. **Join Our Community** - Have suggestions or ran into issues? We welcome your input! Share your experience in our [GitHub issues](https://github.com/albumentations-team/albumentations/issues) or connect with us on [Discord](https://discord.gg/AmMnDBdzYs).

Core
* Added new keypoints format `xyz` for ImageOnly and Dual transforms (z coordinate stays unchanged)

Transforms
New transform [AtLeastOneBBoxRandomCrop](https://explore.albumentations.ai/transform/AtLeastOneBBoxRandomCrop)

Crop an area from image while ensuring at least one bounding box is present in the crop.

<img width="1201" alt="Screenshot 2024-12-24 at 1 46 24 PM" src="https://github.com/user-attachments/assets/21fa3971-3aa2-442e-bdfa-a076541c1096" />

by guillaume-rochette-oxb

Improvements
* [SmallestMaxSize](https://explore.albumentations.ai/transform/SmallestMaxSize): Added option for separate max_size for height/width
* [LongestMaxSize](https://explore.albumentations.ai/transform/LongestMaxSize): Added option for separate max_size for height/width
* Added keypoints support to: `CenterCrop3D`, `CoarseDropout3D`, `CubicSymmetry`, `Pad3D`, `PadIfNeeded3D`, `RandomCrop3D` (by ternaus)


Bugfixes
- Do not import `eval-type-backport` for python 3.10 and older. by PerchunPak
- Bugfix in `ToTensorV2` by matejpekar

Page 1 of 8

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.