albumentations README

The project's README from github.com/albumentations-team/albumentations. As one markdown file: README.md.

Albumentations

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)

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

2. Upgrade to AlbumentationsX (Dual Licensed)

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:

Transform Image Mask BBoxes Keypoints Volume Mask3D
Affine ✓ ✓ ✓ ✓ ✓ ✓
AtLeastOneBBoxRandomCrop ✓ ✓ ✓ ✓ ✓ ✓
BBoxSafeRandomCrop ✓ ✓ ✓ ✓ ✓ ✓
CenterCrop ✓ ✓ ✓ ✓ ✓ ✓
CoarseDropout ✓ ✓ ✓ ✓ ✓ ✓
ConstrainedCoarseDropout ✓ ✓ ✓ ✓ ✓ ✓
Crop ✓ ✓ ✓ ✓ ✓ ✓
CropAndPad ✓ ✓ ✓ ✓ ✓ ✓
CropNonEmptyMaskIfExists ✓ ✓ ✓ ✓ ✓ ✓
D4 ✓ ✓ ✓ ✓ ✓ ✓
ElasticTransform ✓ ✓

albumentations (albumentations-team/albumentations)

Searching Database…

15.3K ·GitHub
archived
这是什么?Albumentations 是一个快速、灵活的 Python 图像增强库,用于训练计算机视觉模型,提供大量像素级和空间级的变换,可作用于图像、掩码、边界框、关键点,甚至三维体数据。
它是库还是独立应用?它是一个 Python 库,需要导入到你的训练流程中,而不是独立的应用程序。
怎样把它加到项目里?用 pip 安装,然后导入它,并组合一套变换,用于处理你的图像、掩码、边界框或关键点。
使用它需要 PyTorch 或 TensorFlow 吗?该库本身与框架无关(变换基于纯 Python/NumPy 实现);无论你训练时用的是 PyTorch、TensorFlow 还是其他框架,它都能处理任何图像数据。
这个项目还在维护吗?不再维护。截至 2025 年 6 月,该仓库已不再积极维护,也不会再提供任何错误修复、新功能或兼容性更新。
到底该用这个版本,还是用它的后继版本?只有当你的项目在当前版本下运行正常,并且不需要修复或新功能时,才继续使用原版 Albumentations;否则,README 建议迁移到 AlbumentationsX 以获得持续支持。
除了普通图像,变换还能用于哪些数据?变换支持图像、分割掩码、边界框、关键点,以及体数据形式的三维数据(体数据和三维掩码),处理三维数据时会在各个深度切片上保持一致。
它提供多少种增强类型?它包含数十种像素级变换(如 Blur、CLAHE、GaussNoise、RandomRain),以及数十种空间级变换(如 Affine、CoarseDropout、CropAndPad、ElasticTransform),这些变换可以同时作用于图像、掩码、边界框和关键点。
如果需要持续支持,怎样迁移到 AlbumentationsX?迁移设计为可直接替换:只需执行 pip install albumentationsx,你现有的 Albumentations 代码无需修改即可继续运行。
我能在采用 MIT 许可证的商业项目中免费使用 AlbumentationsX 吗?不能。AGPL-3.0 选项仅对采用 AGPL 许可证的项目免费,与 MIT、Apache、BSD 等宽松许可证不兼容,因此商业项目或采用宽松许可证的项目需要购买商业许可证。
Size
102.7 MB
Stars
15.3K
Age
8y
Commits · 90 Days