Skip to content

Albumentations 1.4.12 Release Notes

Compare
Choose a tag to compare
@ternaus ternaus released this 27 Jul 00:28
· 30 commits to main since this release
bc42cc7
  • Support Our Work
  • Transforms
  • Core Functionality
  • 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. 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 away.
  3. Got ideas or facing issues? We'd love to hear from you. Share your thoughts in our issues or join the conversation on our Discord server

Transforms

Added TextImage transform

Allows adding text on top of images. Works with np,unit8 and np.float32 images with any number of channels.

Additional functionalities:

  • Insert random stopwords
  • Delete random words
  • Swap word order

Example notebook

image

Core functionality

Added images target

You can now apply the same transform to a list of images of the same shape, not just one image.

Use cases:

  • Video: Split video into frames and apply the transform.
  • Slices of 3D volumes: For example, in medical imaging.
import albumentations as A

transform = A.Compose([A.Affine(p=1)])

transformed = transform(images=<list of images>)

transformed_images = transformed["images"]

Note:
You can apply the same transform to any number of images, masks, bounding boxes, and sets of keypoints using the additional_targets functionality notebook with examples

Contributors @ternaus, @ayasyrev

get_params_dependent_on data

Relevant for those who build custom transforms.

Old way

@property
def targets_as_params(self) -> list[str]:
        return <list of targets>

def get_params_dependent_on_targets(self, params: dict[str, Any]) -> dict[str, np.ndarray]:
    image = params["image"]
....

New way

def get_params_dependent_on_data(self, params: dict[str, Any], data: dict[str, Any]) -> dict[str, np.ndarray]:
    image = data["image"]

Contributor @ayasyrev

Added shape to params

Old way:

def get_params_dependent_on_targets(self, params: dict[str, Any]) -> dict[str, np.ndarray]:
    image = params["image"]
    shape = image.shape

New way:

def get_params_dependent_on_data(self, params: dict[str, Any], data: dict[str, Any]) -> dict[str, np.ndarray]:
    shape = params["shape"]

Contributor @ayasyrev

Deprecations

Elastic Transform

Deprecated parameter alpha_affine in ElasticTransform. To have Affine effects on your image, use the Affine transform.

Contributor @ternaus

Improvements and Bug Fixes

  • Removed dependency on scikit-learn. Contributor: @ternaus
  • Added instructions on how to disable the new version availability message. Contributor: @ternaus
  • Bugfix in constant padding with nonzero values in CropAndPad, Affine, PadIfNeeded, and Rotate. Contributor: @ternaus