Albumentations

Latest version: v1.4.21

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

Scan your dependencies

Page 1 of 7

1.4.21

* Support Our Work
* Transforms
* Core
* Benchmark
* Speedups

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 away](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](https://discord.gg/AmMnDBdzYs)

Transforms
Auto padding in crops

Added option to pad the image if crop size is larger than the crop size

Old way
python

[
A.PadIfNeeded(min_height=1024, min_width=1024, p=1),
A.RandomCrop(height=1204, width=1024, p=1)
]


New way:

python
A.RandomCrop(height=1204, width=1024, p=1, pad_if_needed=True)


Works for:

- [RandomCrop](https://explore.albumentations.ai/transform/RandomCrop)
- [CenterCrop](https://explore.albumentations.ai/transform/CenterCrop)
- [Crop](https://explore.albumentations.ai/transform/Crop)

You may also use it to pad image to a desired size.

Core
Random state
Now random state for the pipeline does not depend on the global random state

Before
python
random.seed(seed)
np.random.seed(seed)

transform = A.Compose(...)


Now

python
transform = A.Compose(seed=seed, ...)


or

python
transform = A.Compose(...)
transform.set_random_seed(seed)


Saving used parameters
Now you can get exact parameters that were used in the pipeline on a given sample with

python
transform = A.Compose(save_applied_params=True, ...)

result = transform(image=image, bboxes=bboxes, mask=mask, keypoints=keypoints)

print(result["applied_transforms"])


Benchmark
Moved benchmark to a separate repo

https://github.com/albumentations-team/benchmark/


Current result for uint8 images:

| Transform | albumentations<br>1.4.20 | augly<br>1.0.0 | imgaug<br>0.4.0 | kornia<br>0.7.3 | torchvision<br>0.20.0 |
|:------------------|:---------------------------|:-----------------|:------------------|:------------------|:------------------------|
| HorizontalFlip | **8325 ± 955** | 4807 ± 818 | 6042 ± 788 | 390 ± 106 | 914 ± 67 |
| VerticalFlip | **20493 ± 1134** | 9153 ± 1291 | 10931 ± 1844 | 1212 ± 402 | 3198 ± 200 |
| Rotate | **1272 ± 12** | 1119 ± 41 | 1136 ± 218 | 143 ± 11 | 181 ± 11 |
| Affine | **967 ± 3** | - | 774 ± 97 | 147 ± 9 | 130 ± 12 |
| Equalize | **961 ± 4** | - | 581 ± 54 | 152 ± 19 | 479 ± 12 |
| RandomCrop80 | **118946 ± 741** | 25272 ± 1822 | 11503 ± 441 | 1510 ± 230 | 32109 ± 1241 |
| ShiftRGB | **1873 ± 252** | - | 1582 ± 65 | - | - |
| Resize | **2365 ± 153** | 611 ± 78 | 1806 ± 63 | 232 ± 24 | 195 ± 4 |
| RandomGamma | **8608 ± 220** | - | 2318 ± 269 | 108 ± 13 | - |
| Grayscale | **3050 ± 597** | 2720 ± 932 | 1681 ± 156 | 289 ± 75 | 1838 ± 130 |
| RandomPerspective | 410 ± 20 | - | **554 ± 22** | 86 ± 11 | 96 ± 5 |
| GaussianBlur | **1734 ± 204** | 242 ± 4 | 1090 ± 65 | 176 ± 18 | 79 ± 3 |
| MedianBlur | **862 ± 30** | - | 813 ± 30 | 5 ± 0 | - |
| MotionBlur | **2975 ± 52** | - | 612 ± 18 | 73 ± 2 | - |
| Posterize | **5214 ± 101** | - | 2097 ± 68 | 430 ± 49 | 3196 ± 185 |
| JpegCompression | **845 ± 61** | 778 ± 5 | 459 ± 35 | 71 ± 3 | 625 ± 17 |
| GaussianNoise | 147 ± 10 | 67 ± 2 | **206 ± 11** | 75 ± 1 | - |
| Elastic | 171 ± 15 | - | **235 ± 20** | 1 ± 0 | 2 ± 0 |
| Clahe | **423 ± 10** | - | 335 ± 43 | 94 ± 9 | - |
| CoarseDropout | **11288 ± 609** | - | 671 ± 38 | 536 ± 87 | - |
| Blur | **4816 ± 59** | 246 ± 3 | 3807 ± 325 | - | - |
| ColorJitter | **536 ± 41** | 255 ± 13 | - | 55 ± 18 | 46 ± 2 |
| Brightness | **4443 ± 84** | 1163 ± 86 | - | 472 ± 101 | 429 ± 20 |
| Contrast | **4398 ± 143** | 736 ± 79 | - | 425 ± 52 | 335 ± 35 |
| RandomResizedCrop | **2952 ± 24** | - | - | 287 ± 58 | 511 ± 10 |
| Normalize | **1016 ± 84** | - | - | 626 ± 40 | 519 ± 12 |
| PlankianJitter | **1844 ± 208** | - | - | 813 ± 211 | - |

Speedups
* Speedup in [PlankianJitter](https://explore.albumentations.ai/transform/PlanckianJitter) in uint8 mode
* Replaced `cv2.addWeighted` with `wsum` from [simsimd](https://github.com/ashvardanian/SimSIMD) package

1.4.20

Hotfix version.

- Fix in check_version
- Fix in [PieceWiseAffine](https://explore.albumentations.ai/transform/PiecewiseAffine)
- Fix in [RandomSizedCrop](https://explore.albumentations.ai/transform/RandomSizedCrop) and [RandomResizedCrop](https://explore.albumentations.ai/transform/RandomResizedCrop)
- Fix in `RandomOrder`

1.4.19

* Support Our Work
* Transforms
* Core
* 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 away](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](https://discord.gg/AmMnDBdzYs)

Transforms
Added `mask_interpolation` to all transforms that use mask interpolation, including:

- [RandomSizedCrop](https://explore.albumentations.ai/transform/RandomSizedCrop)
- [RandomResizedCrop](https://explore.albumentations.ai/transform/RandomResizedCrop)
- [RandomSizedBBoxSafeCrop](https://explore.albumentations.ai/transform/RandomSizedBBoxSafeCrop)
- [CropAndPad](https://explore.albumentations.ai/transform/CropAndPad)
- [Resize](https://explore.albumentations.ai/transform/Resize)
- [RandomScale](https://explore.albumentations.ai/transform/RandomScale)
- [LongestMaxSize](https://explore.albumentations.ai/transform/LongestMaxSize)
- [SmallestMaxSize](https://explore.albumentations.ai/transform/SmallestMaxSize)
- [Rotate](https://explore.albumentations.ai/transform/Rotate)
- [SafeRotate](https://explore.albumentations.ai/transform/SafeRotate)
- [OpticalDistortion](https://explore.albumentations.ai/transform/OpticalDistortion)
- [GridDistortion](https://explore.albumentations.ai/transform/GridDistortion)
- [ElasticTransform](https://explore.albumentations.ai/transform/ElasticTransform)
- [Perspective](https://explore.albumentations.ai/transform/Perspective)
- [PiecewiseAffine](https://explore.albumentations.ai/transform/PiecewiseAffine)

by ternaus

Core
- Minimal supported python version is 3.9
- Removed dependency on scikit-image
- Updated Random number generator from np.random.state to np.random.generator. Second is 50% faster => speedups in all transforms that heavily use random generator
- Where possible moved from `cv2.LUT` to `stringzilla lut`
- Added parameter `mask_interpolation` to Compose that overrides mask interpolation value in all transforms in that Compose, now can use more accurate `cv2.INTER_NEAREST_EXACT` for semantic segmentation and can work with depth and heatmap estimation using cubic, area, linear, etc



BugFixes
- Bugfix in [ISONoise](https://explore.albumentations.ai/transform/ISONoise)
- Bugfix: Ensure that transforms masks are contiguous arrays, by Callidior
- Bugfix in [Solarize](https://explore.albumentations.ai/transform/Solarize)
- Bugfix in bounding box filtering
- Bugfix in [OpticalDistortion](https://explore.albumentations.ai/transform/OpticalDistortion)
- Bugfix in balanced scale in [Affine](https://explore.albumentations.ai/transform/Affine)

1.4.18

* Support Our Work
* Transforms
* Core
* Deprecations
* Bugfixes

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 away](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](https://discord.gg/AmMnDBdzYs)

Transforms
[GridDistortion](https://explore.albumentations.ai/transform/GridDistortion)
![Screenshot 2024-10-08 at 15 06 03](https://github.com/user-attachments/assets/68239933-3441-4417-b691-535136a2e7a2)

Added support for `keypoints`

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

![Screenshot 2024-10-08 at 15 08 04](https://github.com/user-attachments/assets/4cc91b8c-1a31-4e3a-9e5e-bd5690a4a213)

Added support for `keypoints` and `bounding boxes`

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

![Screenshot 2024-10-08 at 15 10 24](https://github.com/user-attachments/assets/a5807c47-6e91-4362-b15a-7a19874ba1df)

Added support for `keypoints` and `bounding boxes`

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

![Screenshot 2024-10-08 at 15 11 53](https://github.com/user-attachments/assets/d112c4b5-323f-4a8e-9d8f-e89845274d23)

Added support for `keypoints` and `bounding boxes`

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

![Screenshot 2024-10-08 at 15 13 36](https://github.com/user-attachments/assets/8d558125-653b-482e-8a08-779731fa6556)

Added support for `bounding boxes` and `keypoints`

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

![Screenshot 2024-10-08 at 15 18 23](https://github.com/user-attachments/assets/4afb9b67-86da-46ac-b5a4-243caa8809bf)

Added support for `keypoints`

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

![Screenshot 2024-10-08 at 15 19 46](https://github.com/user-attachments/assets/bdb2e7f6-74da-42fa-93bf-5d2b6dd4fd59)

Added support for `keypoints` and `bonding boxes`

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

![Screenshot 2024-10-08 at 15 21 52](https://github.com/user-attachments/assets/ae493a9c-b074-4df1-8fb5-bf3bfb4197fd)

Added support for `bounding boxes` and `keypoints`

Core

Added support for masks as numpy arrays of the shape `(num_masks, height, width)`

Now you can apply transforms to masks as:

python
masks = <numpy array with shape (num_masks, height, width)>

transform(image=image, masks=masks)


Deprecations
Removed MixUp as it was doing almost exactly the same as [TemplateTransform](https://explore.albumentations.ai/transform/TemplateTransform)

Bugfixes
* Bugfix in [RandomFog](https://explore.albumentations.ai/transform/RandomFog)
* Bugfix in [PlankianJitter](https://explore.albumentations.ai/transform/PlanckianJitter)
* Several people reported issue with masks as list of numpy arrays, I guess it was fixed as a part of some other work as I cannot reproduce it. Just in case added tests for that case.

1.4.17

* Support Our Work
* Transforms
* Core

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 away](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](https://discord.gg/AmMnDBdzYs)

Transforms
[CoarseDropout](https://explore.albumentations.ai/transform/CoarseDropout)
1. Added Bounding Box support
2. `remove_invisible=False` keeps keypoints
<img width="1224" alt="Screenshot 2024-09-30 at 15 25 53" src="https://github.com/user-attachments/assets/55cd90f4-7c9a-4409-91d3-b0bec69e99f0">

by ternaus

[ElasticTransform]()
Added support for keypoints

<img width="1228" alt="Screenshot 2024-09-30 at 15 29 36" src="https://github.com/user-attachments/assets/7dc62f05-e8b2-4e49-b501-4327761dc4e3">

by ternaus

Core

Added [RandomOrder](https://albumentations.ai/docs/api_reference/full_reference/?h=randomorder#albumentations.core.composition.RandomOrder) Compose

python
Select N transforms to apply. Selected transforms will be called in random order with force_apply=True.
Transforms probabilities will be normalized to one 1, so in this case transforms probabilities works as weights.
This transform is like SomeOf, but transforms are called with random order.
It will not replay random order in ReplayCompose.

1.4.16

- Support Our Work
- UI Tool
- 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 away](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](https://discord.gg/AmMnDBdzYs)

UI Tool
For visual debug wrote a tool that allows visually inspect effects of augmentations on the image.

You can find it at [https://explore.albumentations.ai/](https://explore.albumentations.ai/)

- Works for all ImageOnly transforms
- Authorized users can upload their own images

it is work in progress. It is not stable and polished yet, but if you have feedback or proposals - just write in the Discord Server mentioned above.

Transforms
- Updated and extended docstrings in all ImageOnly transforms.
- All ImageOnly transforms support both `uint8` and `float32` inputs

RandomSnow
Added `texture` method to [RandomSnow](https://explore.albumentations.ai/transform/RandomSnow)

<img width="1226" alt="Screenshot 2024-09-14 at 19 09 52" src="https://github.com/user-attachments/assets/19a3d0b1-a51c-46c5-b5de-810402f5e489">

RandomSunflare

Added `physics_based` method to [RandomSunFlare](https://explore.albumentations.ai/transform/RandomSunFlare)
<img width="1232" alt="Screenshot 2024-09-14 at 19 10 41" src="https://github.com/user-attachments/assets/89d2c5f7-410e-429c-9636-ddb72f8db600">

Bugfixes and improvements
- Bugfix in albucore dependency. Now every `Albumnetations` version is tailored to a specific `albucore` version. Added pre-commit hook to automatically check it on every commit.
- BugFix in [TextImage](https://explore.albumentations.ai/transform/TextImage) transform, after rewriting bbox processing in a vectorized form, transform was failing.
- As a part of the work to remove scikit-image dependency momincks rewrote bbox_affine in a plain numpy
- Bugfix. It was unexpected, but people use bounding bboxes that are less than 1 pixel. Removed constrant on a minimum bounding box being 1x1
- Bugfix in bounding box filtering. Now if all bounding boxes were filtered return not empty array, but empty array of shape (0, 4)

Page 1 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.