Albumentations

Latest version: v1.4.7

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

Scan your dependencies

Page 1 of 5

1.4.7

- Support our work
- Documentation
- 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)

Documentation

- Added to the [website tutorial](https://albumentations.ai/docs/integrations/huggingface/object_detection/) on how to use Albumentations with Hugginigface for object Detection. Based on the [tutorial](https://huggingface.co/docs/transformers/main/en/tasks/object_detection) by qubvel

Deprecations
ImageCompression

Old way:

python
transform = A.Compose([A.ImageCompression(
quality_lower=75,
quality_upper=100,
p=0.5
)])


New way:

python
transform = A.Compose([A.ImageCompression(
quality_range=(75, 100),
p=0.5
)])

by MarognaLorenzo

Downscale

Old way:
python
transform = A.Compose([A.Downscale(
scale_min=0.25,
scale_max=1,
interpolation= {"downscale": cv2.INTER_AREA, "upscale": cv2.INTER_CUBIC},
p=0.5
)])


New way:
python
transform = A.Compose([A.Downscale(
scale_range=(0.25, 1),
interpolation_pair = {"downscale": cv2.INTER_AREA, "upscale": cv2.INTER_CUBIC},
p=0.5
)])


As of now both ways work and will provide the same result, but old functionality will be removed in later releases.

by ternaus

Improvements
- Buggix in `Blur`.
- Bugfix in `bbox clipping`, it could be not intuitive, but boxes should be clipped by `height, width` and not `height - 1, width -1` by ternaus
- Allow to compose only keys, that are required there. Any extra unnecessary key will give an error by ayasyrev
- In `PadIfNeeded` if value parameter is not None, but border mode is reflection, border mode is changed to `cv2.BORDER_CONSTANT` by ternaus

1.4.6

This is out of schedule release with a bugfix that was introduced in version 1.4.5

In version 1.4.5 there was a bug that went unnoticed - if you used pipeline that consisted only of `ImageOnly` transforms but pass bounding boxes into it, you would get an error.

If you had in such pipeline at least one non `ImageOnly` transform, say `HorizontalFlip` or `Crop`, everything would work as expected.

We fixed the issue and added tests to be sure that it will not happen in the future.

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

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.