Albumentations 2.0.19

Version 2.0.19 introduces improvements to Test-Time Augmentation (TTA) workflows and removes unnecessary memory constraints that previously limited performance.


Performance Improvements

The strict requirement that inputs be contiguous in memory before and after each transform application has been removed.

Previously, many transforms enforced contiguity, which resulted in additional memory copies. Removing this constraint reduces copying overhead and improves throughput across most transforms, particularly spatial and array-manipulation operations.

Updated benchmark results are available:


Test-Time Augmentation (TTA)

This release simplifies deterministic symmetry-based TTA pipelines.

Deterministic Group Elements

Transforms such as D4 and SquareSymmetry now allow explicit selection of a specific group element via the group_element argument. This enables deterministic enumeration of symmetry elements during inference.

Inverse Transforms

The following spatial transforms now provide an .inverse() method:

This allows model outputs (e.g., images, masks, keypoints) to be mapped back to the original coordinate system after inference, eliminating the need for manual inversion logic.


Example: D4-based TTA

import numpy as np
import albumentations as A
from albumentations.core.type_definitions import d4_group_elements

image = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
predictions = []

for element in d4_group_elements:
    # Apply deterministic symmetry
    aug = A.D4(p=1.0, group_element=element)
    augmented = aug(image=image)
    augmented_image = augmented["image"]

    # Model inference (placeholder)
    predicted_image = model(augmented_image)

    # Map prediction back to original orientation
    prediction = aug.inverse()(image=predicted_image)["image"]

    predictions.append(prediction)