{"id":5563,"library":"albumentations","title":"Albumentations (Legacy - MIT Licensed)","description":"Albumentations is a Python library for image augmentation, widely adopted in deep learning and computer vision tasks for its speed, flexibility, and extensive collection of transformations. It offers a unified API to work with various data types including images, masks, bounding boxes, and keypoints. **However, the original MIT-licensed Albumentations project is no longer actively maintained. The last update was in June 2025, and no further bug fixes, features, or compatibility updates will be provided.** For active development and support, users are directed to its successor, AlbumentationsX, which maintains the same API but operates under a dual AGPL-3.0 / Commercial license. The current version of this legacy library is 2.0.8.","status":"abandoned","version":"2.0.8","language":"en","source_language":"en","source_url":"https://github.com/albumentations-team/albumentations","tags":["computer vision","image augmentation","deep learning","machine learning","data preprocessing"],"install":[{"cmd":"pip install albumentations","lang":"bash","label":"Install latest stable version"}],"dependencies":[{"reason":"Core image processing functionalities are built on OpenCV for performance.","package":"opencv-python","optional":false},{"reason":"Fundamental library for numerical operations and array handling.","package":"numpy","optional":false}],"imports":[{"symbol":"Compose","correct":"from albumentations import Compose"},{"note":"This is the most common and recommended alias.","symbol":"A","correct":"import albumentations as A"}],"quickstart":{"code":"import albumentations as A\nimport cv2\nimport numpy as np\n\n# Create a dummy image (256x256, 3 channels, uint8)\nimage = np.random.randint(0, 256, (256, 256, 3), dtype=np.uint8)\n\n# Define an augmentation pipeline\ntransform = A.Compose([\n    A.RandomCrop(width=128, height=128, p=1.0),\n    A.HorizontalFlip(p=0.5),\n    A.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),\n])\n\n# Apply the transform\ntransformed_data = transform(image=image)\ntransformed_image = transformed_data[\"image\"]\n\nprint(f\"Original image shape: {image.shape}\")\nprint(f\"Transformed image shape: {transformed_image.shape}\")\nprint(f\"Transformed image dtype: {transformed_image.dtype}\")","lang":"python","description":"This quickstart demonstrates how to define a simple augmentation pipeline using `A.Compose` and apply it to an image. It includes common transforms like random cropping, horizontal flipping, and normalization. Ensure `opencv-python` and `numpy` are installed for this example to run."},"warnings":[{"fix":"Users requiring active development and support should migrate to `AlbumentationsX`. Uninstall `albumentations` and install `albumentationsx` (`pip uninstall albumentations; pip install albumentationsx`). Be aware that `AlbumentationsX` operates under a dual AGPL-3.0 / Commercial license, which may require open-sourcing your project or purchasing a commercial license.","message":"The original MIT-licensed Albumentations library (this package) is no longer actively maintained. The last update was in June 2025, and no further bug fixes, features, or compatibility updates will be provided. This means it may eventually break with newer Python, PyTorch, or TensorFlow versions.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Pass a `seed` argument to `A.Compose(..., seed=your_seed)` for reproducible pipelines. If using PyTorch `DataLoader`, understand that `num_workers` can influence augmentation sequences even with a fixed seed.","message":"Reproducibility of augmentation sequences requires explicitly setting the `seed` parameter in `A.Compose`. Global seeds (`numpy.random.seed()`, `random.seed()`) do not affect Albumentations' internal random state. Additionally, using the same seed with different `num_workers` settings in a PyTorch `DataLoader` will produce different augmentation sequences.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure all inputs are converted to `numpy.ndarray` before passing them to any Albumentations transform or pipeline.","message":"All inputs to Albumentations transforms (images, masks, bounding boxes, keypoints) must be NumPy arrays. Passing Python lists directly is not supported and will result in errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly convert BGR images to RGB using `cv2.cvtColor(image, cv2.COLOR_BGR2RGB)` after loading with OpenCV and before passing them to Albumentations.","message":"When loading images using OpenCV (`cv2.imread`), they are typically loaded in BGR color space. Albumentations primarily expects images in RGB format. Passing BGR images directly to RGB-sensitive transforms will produce incorrect colors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For grayscale images, ensure they have a channel dimension. If your image is `(H, W)`, use `np.expand_dims(image, axis=-1)` to convert it to `(H, W, 1)`.","message":"Individual transforms in Albumentations typically require grayscale images to have an explicit channel dimension (e.g., shape `(H, W, 1)` instead of `(H, W)`). While `A.Compose` often provides convenience by handling both formats, it's best practice to ensure the channel dimension is present, especially when applying transforms directly.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}