github albumentations-team/albumentations 1.4.9
Albumentations 1.4.9 Release Notes

latest release: 1.4.10
12 days ago
  • Support our work
  • New transforms
  • Integrations
  • Speedups
  • 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. 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.
  3. Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our issues or join the conversation on our Discord server for Albumentations

Transforms

PlanckianJitter

New transform, based on

Screenshot 2024-06-17 at 17 53 00

Statements from the paper on why PlanckianJitter is superior to ColorJitter:

  1. Realistic Color Variations: PlanckianJitter applies physically realistic illuminant variations based on Planck’s Law for black-body radiation. This leads to more natural and realistic variations in chromaticity compared to the arbitrary changes in hue, saturation, brightness, and contrast applied by ColorJitter​​.

  2. Improved Representation for Color-Sensitive Tasks: The transformations in PlanckianJitter maintain the ability to discriminate image content based on color information, making it particularly beneficial for tasks where color is a crucial feature, such as classifying natural objects like birds or flowers. ColorJitter, on the other hand, can significantly alter colors, potentially degrading the quality of learned color features​​.

  3. Robustness to Illumination Changes: PlanckianJitter produces models that are robust to illumination changes commonly observed in real-world images. This robustness is advantageous for applications where lighting conditions can vary widely​​.

  4. Enhanced Color Sensitivity: Models trained with PlanckianJitter show a higher number of color-sensitive neurons, indicating that these models retain more color information compared to those trained with ColorJitter, which tends to induce color invariance​​.

by @zakajd

GaussNoise

Added option to approximate GaussNoise.

Generation of random Noise for large images is slow.

Added scaling factor for noise generation. Value should be in the range (0, 1]. When set to 1, noise is sampled for each pixel independently. If less, noise is sampled for a smaller size and resized to fit the shape of the image. Smaller values make the transform much faster. Default: 0.5

Integrations

Added integration wit HFHub. Now you can load and save augmentation pipeline to HuggingFace and reuse it in the future or share with others.

Notebook with documentation

import albumentations as A
import numpy as np

transform = A.Compose([
    A.RandomCrop(256, 256),
    A.HorizontalFlip(),
    A.RandomBrightnessContrast(),
    A.RGBShift(),
    A.Normalize(),
])

evaluation_transform = A.Compose([
    A.PadIfNeeded(256, 256),
    A.Normalize(),
])

transform.save_pretrained("qubvel-hf/albu", key="train")
# ^ this will save the transform to a directory "qubvel-hf/albu" with filename "albumentations_config_train.json"

transform.save_pretrained("qubvel-hf/albu", key="train", push_to_hub=True)
# ^ this will save the transform to a directory "qubvel-hf/albu" with filename "albumentations_config_train.json"
# + push the transform to the Hub to the repository "qubvel-hf/albu"

transform.push_to_hub("qubvel-hf/albu", key="train")
# ^ this will push the transform to the Hub to the repository "qubvel-hf/albu" (without saving it locally)

loaded_transform = A.Compose.from_pretrained("qubvel-hf/albu", key="train")
# ^ this will load the transform from local folder if exist or from the Hub repository "qubvel-hf/albu"

evaluation_transform.save_pretrained("qubvel-hf/albu", key="eval", push_to_hub=True)
# ^ this will save the transform to a directory "qubvel-hf/albu" with filename "albumentations_config_eval.json"

loaded_evaluation_transform = A.Compose.from_pretrained("qubvel-hf/albu", key="eval")
# ^ this will load the transform from the Hub repository "qubvel-hf/albu"

by @qubvel

Speedups

These transforms should be faster for all types of images. But measured only for three channel uint8

Full updated benchmark

Deprecations

Deprecated always_apply

For years we had two parameters in constructors - probability and always_apply. The interplay between them is not always obvious and intuitively always_apply=True should be equivalent to p=1.

always_apply is deprecated now. always_apply=True still works, but it will be deprecated in the future. Use p=1 instead

by @ayasyrev

RandomFog

Updated interface for RandomFog

Old way:

RandomFog(fog_coef_lower=0.3, fog_coef_upper=1)

New way:

RandomFog(fog_coef_range=(0.3, 1))

by @ternaus

Improvements and bugfixes

Disable check for updates

When one imports Albumentations library, there is a check that it is the latest version installed.

To disable this check you can set up environmental variable: NO_ALBUMENTATIONS_UPDATE to 1

by @lerignoux

Fix for deprecation warnings

For a set of transforms we were throwing deprecation warnings, even when modern version of the interface was used. Fixed. by @ternaus

Albucore

We moved low level operations like add, multiply, normalize, etc to a separate library: https://github.com/albumentations-team/albucore

There are numerous ways to perform such operations in opencv and numpy. And there is no clear winner. Results depend on image type.

Separate library gives us confidence that we picked the fastest version that works on any image type.

by @ternaus

Bugfixes

Various bugfixes by @ayasyrev @immortalCO

Don't miss a new albumentations release

NewReleases is sending notifications on new releases.