- 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](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
PlanckianJitter
New transform, based on
- Paper: [https://arxiv.org/abs/2202.07993](https://arxiv.org/abs/2202.07993)
- Repo: [https://github.com/TheZino/PlanckianJitter](https://github.com/TheZino/PlanckianJitter)
<img width="634" alt="Screenshot 2024-06-17 at 17 53 00" src="https://github.com/albumentations-team/albumentations/assets/5481618/d042299a-3fcd-47e2-a2f8-c023646659d1">
Statements from the paper on why [PlanckianJitter](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.PlanckianJitter) is superior to [ColorJitter](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.ColorJitter):
1. **Realistic Color Variations:** [PlanckianJitter](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.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](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.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](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.ColorJitter), on the other hand, can significantly alter colors, potentially degrading the quality of learned color features.
3. **Robustness to Illumination Changes:** [PlanckianJitter](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.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](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.PlanckianJitter) show a higher number of color-sensitive neurons, indicating that these models retain more color information compared to those trained with [ColorJitter](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.ColorJitter), which tends to induce color invariance.
by zakajd
GaussNoise
Added option to approximate [GaussNoise](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.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](https://albumentations.ai/docs/examples/example_hfhub/)
python
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`
- [RGBShift](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.RGBShift): **2X (+106%)**
- [GaussNoise](https://albumentations.ai/docs/api_reference/full_reference/#albumentations.augmentations.transforms.GaussNoise): **3.3X (+ 236%)**
[Full updated benchmark](https://albumentations.ai/docs/benchmarking_results/)
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:
python
RandomFog(fog_coef_lower=0.3, fog_coef_upper=1)
New way:
python
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