Interested in advertising?

Contact us

Stay updated

News & Insights
transform
utils
check_version
transforms
API Documentation | Albumentations

albumentations.augmentations.other.lambda_transform


Lambda transform module for creating custom user-defined transformations. This module provides a flexible transform class that allows users to define their own custom transformation functions for different targets (image, mask, keypoints, bboxes). It's particularly useful for implementing custom logic that isn't available in the standard transforms. The Lambda transform accepts different callable functions for each target type and applies them when the transform is executed. This allows for maximum flexibility while maintaining compatibility with the Albumentations pipeline structure. Key features: - Apply different custom functions to different target types - Compatible with all Albumentations pipeline features - Support for all image types and formats - Ability to handle any number of channels - Warning system for lambda expressions and multiprocessing compatibility Note that using actual lambda expressions (rather than named functions) can cause issues with multiprocessing, as lambdas cannot be properly pickled.

Members

Lambdaclass

A flexible transformation class for using user-defined transformation functions per targets. Function signature must include **kwargs to accept optional arguments like interpolation method, image size, etc:

Parameters

NameTypeDefaultDescription
image
One of:
  • Callable[..., Any]
  • None
NoneImage transformation function.
mask
One of:
  • Callable[..., Any]
  • None
NoneMask transformation function.
keypoints
One of:
  • Callable[..., Any]
  • None
NoneKeypoints transformation function.
bboxes
One of:
  • Callable[..., Any]
  • None
NoneBBoxes transformation function.
name
One of:
  • str
  • None
None-
pfloat1.0probability of applying the transform. Default: 1.0.