Albumentations

June 25, 2025 ยท View on GitHub

PyPI version CI PyPI Downloads Conda Downloads

๐Ÿ“ฃ Stay updated! Subscribe to our newsletter for the latest releases, tutorials, and tips directly from the Albumentations team.

License: MIT Gurubase

Docs | Discord | Twitter | LinkedIn

โš ๏ธ Important Notice: Albumentations is No Longer Maintained

This repository is no longer actively maintained. The last update was in June 2025, and no further bug fixes, features, or compatibility updates will be provided.

๐Ÿš€ Introducing AlbumentationsX - The Future of Albumentations

All development has moved to AlbumentationsX, the next-generation successor to Albumentations.

Note: AlbumentationsX uses dual licensing (AGPL-3.0 / Commercial). The AGPL license has strict copyleft requirements - see details below.

Your Options Moving Forward

1. Continue Using Albumentations (MIT License)

  • โœ… Forever free for all uses including commercial
  • โœ… No licensing fees or restrictions
  • โŒ No bug fixes - Even critical bugs won't be addressed
  • โŒ No new features - Missing out on performance improvements
  • โŒ No support - Issues and questions go unanswered
  • โŒ No compatibility updates - May break with new Python/PyTorch versions

Best for: Projects that work fine with the current version and don't need updates

2. Upgrade to AlbumentationsX (Dual Licensed)

  • โœ… Drop-in replacement - Same API, just pip install albumentationsx
  • โœ… Active development - Regular updates and new features
  • โœ… Bug fixes - Issues are actively addressed
  • โœ… Performance improvements - Faster execution
  • โœ… Community support - Active Discord and issue tracking
  • โš ๏ธ Dual licensed:
    • AGPL-3.0: Free ONLY for projects licensed under AGPL-3.0 (not compatible with MIT, Apache, BSD, etc.)
    • Commercial License: Required for proprietary use AND permissive open-source projects

Best for: Projects that need ongoing support, updates, and new features

โš ๏ธ AGPL License Warning: The AGPL-3.0 license is NOT compatible with permissive licenses like MIT, Apache 2.0, or BSD. If your project uses any of these licenses, you CANNOT use the AGPL version of AlbumentationsX - you'll need a commercial license.

Migration is Simple

# Uninstall original
pip uninstall albumentations

# Install AlbumentationsX
pip install albumentationsx

That's it! Your existing code continues to work without any changes:

import albumentations as A  # Same import!

transform = A.Compose([
    A.RandomCrop(width=256, height=256),
    A.HorizontalFlip(p=0.5),
    A.RandomBrightnessContrast(p=0.2),
])

Learn More


Original Albumentations README

GitAds Sponsored

Sponsored by GitAds

Albumentations is a Python library for image augmentation. Image augmentation is used in deep learning and computer vision tasks to increase the quality of trained models. The purpose of image augmentation is to create new training samples from the existing data.

Here is an example of how you can apply some pixel-level augmentations from Albumentations to create new images from the original one: parrot

Why Albumentations

Table of contents

Authors

Current Maintainer

Vladimir I. Iglovikov | Kaggle Grandmaster

Emeritus Core Team Members

Mikhail Druzhinin | Kaggle Expert

Alex Parinov | Kaggle Master

Alexander Buslaev | Kaggle Master

Eugene Khvedchenya | Kaggle Grandmaster

Installation

Albumentations requires Python 3.9 or higher. To install the latest version from PyPI:

pip install -U albumentations

Other installation options are described in the documentation.

Documentation

The full documentation is available at https://albumentations.ai/docs/.

A simple example

import albumentations as A
import cv2

# Declare an augmentation pipeline
transform = A.Compose([
    A.RandomCrop(width=256, height=256),
    A.HorizontalFlip(p=0.5),
    A.RandomBrightnessContrast(p=0.2),
])

# Read an image with OpenCV and convert it to the RGB colorspace
image = cv2.imread("image.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

# Augment an image
transformed = transform(image=image)
transformed_image = transformed["image"]

Getting started

I am new to image augmentation

Please start with the introduction articles about why image augmentation is important and how it helps to build better models.

I want to use Albumentations for the specific task such as classification or segmentation

If you want to use Albumentations for a specific task such as classification, segmentation, or object detection, refer to the set of articles that has an in-depth description of this task. We also have a list of examples on applying Albumentations for different use cases.

I want to explore augmentations and see Albumentations in action

Check the online demo of the library. With it, you can apply augmentations to different images and see the result. Also, we have a list of all available augmentations and their targets.

Who is using Albumentations

See also

List of augmentations

Pixel-level transforms

Pixel-level transforms will change just an input image and will leave any additional targets such as masks, bounding boxes, and keypoints unchanged. For volumetric data (volumes and 3D masks), these transforms are applied independently to each slice along the Z-axis (depth dimension), maintaining consistency across the volume. The list of pixel-level transforms:

Spatial-level transforms

Spatial-level transforms will simultaneously change both an input image as well as additional targets such as masks, bounding boxes, and keypoints. For volumetric data (volumes and 3D masks), these transforms are applied independently to each slice along the Z-axis (depth dimension), maintaining consistency across the volume. The following table shows which additional targets are supported by each transform:

  • Volume: 3D array of shape (D, H, W) or (D, H, W, C) where D is depth, H is height, W is width, and C is number of channels (optional)
  • Mask3D: Binary or multi-class 3D mask of shape (D, H, W) where each slice represents segmentation for the corresponding volume slice
TransformImageMaskBBoxesKeypointsVolumeMask3D
Affineโœ“โœ“โœ“โœ“โœ“โœ“
AtLeastOneBBoxRandomCropโœ“โœ“โœ“โœ“โœ“โœ“
BBoxSafeRandomCropโœ“โœ“โœ“โœ“โœ“โœ“
CenterCropโœ“โœ“โœ“โœ“โœ“โœ“
CoarseDropoutโœ“โœ“โœ“โœ“โœ“โœ“
ConstrainedCoarseDropoutโœ“โœ“โœ“โœ“โœ“โœ“
Cropโœ“โœ“โœ“โœ“โœ“โœ“
CropAndPadโœ“โœ“โœ“โœ“โœ“โœ“
CropNonEmptyMaskIfExistsโœ“โœ“โœ“โœ“โœ“โœ“
D4โœ“โœ“โœ“โœ“โœ“โœ“
ElasticTransformโœ“โœ“โœ“โœ“โœ“โœ“
Erasingโœ“โœ“โœ“โœ“โœ“โœ“
FrequencyMaskingโœ“โœ“โœ“โœ“โœ“โœ“
GridDistortionโœ“โœ“โœ“โœ“โœ“โœ“
GridDropoutโœ“โœ“โœ“โœ“โœ“โœ“
GridElasticDeformโœ“โœ“โœ“โœ“โœ“โœ“
HorizontalFlipโœ“โœ“โœ“โœ“โœ“โœ“
Lambdaโœ“โœ“โœ“โœ“โœ“โœ“
LongestMaxSizeโœ“โœ“โœ“โœ“โœ“โœ“
MaskDropoutโœ“โœ“โœ“โœ“โœ“โœ“
Morphologicalโœ“โœ“โœ“โœ“โœ“โœ“
Mosaicโœ“โœ“โœ“โœ“
NoOpโœ“โœ“โœ“โœ“โœ“โœ“
OpticalDistortionโœ“โœ“โœ“โœ“โœ“โœ“
OverlayElementsโœ“โœ“
Padโœ“โœ“โœ“โœ“โœ“โœ“
PadIfNeededโœ“โœ“โœ“โœ“โœ“โœ“
Perspectiveโœ“โœ“โœ“โœ“โœ“โœ“
PiecewiseAffineโœ“โœ“โœ“โœ“โœ“โœ“
PixelDropoutโœ“โœ“โœ“โœ“โœ“โœ“
RandomCropโœ“โœ“โœ“โœ“โœ“โœ“
RandomCropFromBordersโœ“โœ“โœ“โœ“โœ“โœ“
RandomCropNearBBoxโœ“โœ“โœ“โœ“โœ“โœ“
RandomGridShuffleโœ“โœ“โœ“โœ“โœ“โœ“
RandomResizedCropโœ“โœ“โœ“โœ“โœ“โœ“
RandomRotate90โœ“โœ“โœ“โœ“โœ“โœ“
RandomScaleโœ“โœ“โœ“โœ“โœ“โœ“
RandomSizedBBoxSafeCropโœ“โœ“โœ“โœ“โœ“โœ“
RandomSizedCropโœ“โœ“โœ“โœ“โœ“โœ“
Resizeโœ“โœ“โœ“โœ“โœ“โœ“
Rotateโœ“โœ“โœ“โœ“โœ“โœ“
SafeRotateโœ“โœ“โœ“โœ“โœ“โœ“
ShiftScaleRotateโœ“โœ“โœ“โœ“โœ“โœ“
SmallestMaxSizeโœ“โœ“โœ“โœ“โœ“โœ“
SquareSymmetryโœ“โœ“โœ“โœ“โœ“โœ“
ThinPlateSplineโœ“โœ“โœ“โœ“โœ“โœ“
TimeMaskingโœ“โœ“โœ“โœ“โœ“โœ“
TimeReverseโœ“โœ“โœ“โœ“โœ“โœ“
Transposeโœ“โœ“โœ“โœ“โœ“โœ“
VerticalFlipโœ“โœ“โœ“โœ“โœ“โœ“
XYMaskingโœ“โœ“โœ“โœ“โœ“โœ“

3D transforms

3D transforms operate on volumetric data and can modify both the input volume and associated 3D mask.

Where:

  • Volume: 3D array of shape (D, H, W) or (D, H, W, C) where D is depth, H is height, W is width, and C is number of channels (optional)
  • Mask3D: Binary or multi-class 3D mask of shape (D, H, W) where each slice represents segmentation for the corresponding volume slice
TransformVolumeMask3DKeypoints
CenterCrop3Dโœ“โœ“โœ“
CoarseDropout3Dโœ“โœ“โœ“
CubicSymmetryโœ“โœ“โœ“
Pad3Dโœ“โœ“โœ“
PadIfNeeded3Dโœ“โœ“โœ“
RandomCrop3Dโœ“โœ“โœ“

A few more examples of augmentations

Semantic segmentation on the Inria dataset

inria

Medical imaging

medical

Object detection and semantic segmentation on the Mapillary Vistas dataset

vistas

Keypoints augmentation

Benchmark Results

Image Benchmark Results

System Information

  • Platform: macOS-15.1-arm64-arm-64bit
  • Processor: arm
  • CPU Count: 16
  • Python Version: 3.12.8

Benchmark Parameters

  • Number of images: 2000
  • Runs per transform: 5
  • Max warmup iterations: 1000

Library Versions

  • albumentations: 2.0.4
  • augly: 1.0.0
  • imgaug: 0.4.0
  • kornia: 0.8.0
  • torchvision: 0.20.1

Performance Comparison

Number shows how many uint8 images per second can be processed on one CPU thread. Larger is better. The Speedup column shows how many times faster Albumentations is compared to the fastest other library for each transform.

Transformalbumentations
2.0.4
augly
1.0.0
imgaug
0.4.0
kornia
0.8.0
torchvision
0.20.1
Speedup
(Alb/fastest other)
Affine1445 ยฑ 9-1328 ยฑ 16248 ยฑ 6188 ยฑ 21.09x
AutoContrast1657 ยฑ 13--541 ยฑ 8344 ยฑ 13.06x
Blur7657 ยฑ 114386 ยฑ 45381 ยฑ 125265 ยฑ 11-1.42x
Brightness11985 ยฑ 4552108 ยฑ 321076 ยฑ 321127 ยฑ 27854 ยฑ 135.68x
CLAHE647 ยฑ 4-555 ยฑ 14165 ยฑ 3-1.17x
CenterCrop128119293 ยฑ 2164----N/A
ChannelDropout11534 ยฑ 306--2283 ยฑ 24-5.05x
ChannelShuffle6772 ยฑ 109-1252 ยฑ 261328 ยฑ 444417 ยฑ 2341.53x
CoarseDropout18962 ยฑ 1346-1190 ยฑ 22--15.93x
ColorJitter1020 ยฑ 91418 ยฑ 5-104 ยฑ 487 ยฑ 12.44x
Contrast12394 ยฑ 3631379 ยฑ 25717 ยฑ 51109 ยฑ 41602 ยฑ 138.99x
CornerIllumination484 ยฑ 7--452 ยฑ 3-1.07x
Elastic374 ยฑ 2-395 ยฑ 141 ยฑ 03 ยฑ 00.95x
Equalize1236 ยฑ 21-814 ยฑ 11306 ยฑ 1795 ยฑ 31.52x
Erasing27451 ยฑ 2794--1210 ยฑ 273577 ยฑ 497.67x
GaussianBlur2350 ยฑ 118387 ยฑ 41460 ยฑ 23254 ยฑ 5127 ยฑ 41.61x
GaussianIllumination720 ยฑ 7--436 ยฑ 13-1.65x
GaussianNoise315 ยฑ 4-263 ยฑ 9125 ยฑ 1-1.20x
Grayscale32284 ยฑ 11306088 ยฑ 1073100 ยฑ 241201 ยฑ 522600 ยฑ 235.30x
HSV1197 ยฑ 23----N/A
HorizontalFlip14460 ยฑ 3688808 ยฑ 10129599 ยฑ 4951297 ยฑ 132486 ยฑ 1071.51x
Hue1944 ยฑ 64--150 ยฑ 1-12.98x
Invert27665 ยฑ 3803-3682 ยฑ 792881 ยฑ 434244 ยฑ 306.52x
JpegCompression1321 ยฑ 331202 ยฑ 19687 ยฑ 26120 ยฑ 1889 ยฑ 71.10x
LinearIllumination479 ยฑ 5--708 ยฑ 6-0.68x
MedianBlur1229 ยฑ 9-1152 ยฑ 146 ยฑ 0-1.07x
MotionBlur3521 ยฑ 25-928 ยฑ 37159 ยฑ 1-3.79x
Normalize1819 ยฑ 49--1251 ยฑ 141018 ยฑ 71.45x
OpticalDistortion661 ยฑ 7--174 ยฑ 0-3.80x
Pad48589 ยฑ 2059---4889 ยฑ 1839.94x
Perspective1206 ยฑ 3-908 ยฑ 8154 ยฑ 3147 ยฑ 51.33x
PlankianJitter3221 ยฑ 63--2150 ยฑ 52-1.50x
PlasmaBrightness168 ยฑ 2--85 ยฑ 1-1.98x
PlasmaContrast145 ยฑ 3--84 ยฑ 0-1.71x
PlasmaShadow183 ยฑ 5--216 ยฑ 5-0.85x
Posterize12979 ยฑ 1121-3111 ยฑ 95836 ยฑ 304247 ยฑ 263.06x
RGBShift3391 ยฑ 104--896 ยฑ 9-3.79x
Rain2043 ยฑ 115--1493 ยฑ 9-1.37x
RandomCrop128111859 ยฑ 137445395 ยฑ 93421408 ยฑ 6222946 ยฑ 4231450 ยฑ 2492.46x
RandomGamma12444 ยฑ 753-3504 ยฑ 72230 ยฑ 3-3.55x
RandomResizedCrop4347 ยฑ 37--661 ยฑ 16837 ยฑ 375.19x
Resize3532 ยฑ 671083 ยฑ 212995 ยฑ 70645 ยฑ 13260 ยฑ 91.18x
Rotate2912 ยฑ 681739 ยฑ 1052574 ยฑ 10256 ยฑ 2258 ยฑ 41.13x
SaltAndPepper629 ยฑ 6--480 ยฑ 12-1.31x
Saturation1596 ยฑ 24-495 ยฑ 3155 ยฑ 2-3.22x
Sharpen2346 ยฑ 10-1101 ยฑ 30201 ยฑ 2220 ยฑ 32.13x
Shear1299 ยฑ 11-1244 ยฑ 14261 ยฑ 1-1.04x
Snow611 ยฑ 9--143 ยฑ 1-4.28x
Solarize11756 ยฑ 481-3843 ยฑ 80263 ยฑ 61032 ยฑ 143.06x
ThinPlateSpline82 ยฑ 1--58 ยฑ 0-1.41x
VerticalFlip32386 ยฑ 93616830 ยฑ 165319935 ยฑ 17082872 ยฑ 374696 ยฑ 1611.62x

Contributing

To create a pull request to the repository, follow the documentation at CONTRIBUTING.md

https://github.com/albuemntations-team/albumentation/graphs/contributors

Community

Citing

If you find this library useful for your research, please consider citing Albumentations: Fast and Flexible Image Augmentations:

@Article{info11020125,
    AUTHOR = {Buslaev, Alexander and Iglovikov, Vladimir I. and Khvedchenya, Eugene and Parinov, Alex and Druzhinin, Mikhail and Kalinin, Alexandr A.},
    TITLE = {Albumentations: Fast and Flexible Image Augmentations},
    JOURNAL = {Information},
    VOLUME = {11},
    YEAR = {2020},
    NUMBER = {2},
    ARTICLE-NUMBER = {125},
    URL = {https://www.mdpi.com/2078-2489/11/2/125},
    ISSN = {2078-2489},
    DOI = {10.3390/info11020125}
}

๐Ÿ“ซ Stay Connected

Never miss updates, tutorials, and tips from the Albumentations team! Subscribe to our newsletter.