class documentation

Base class for transforms that combine multiple samples.

Method __init__ Create a batch transformation.
Method apply Apply the transformation to a batch of images.
Method apply_to_array Apply the transformation to a batch of generic arrays.
Method apply_to_bboxes Apply the transformation to a batch of bounding boxes.
Method apply_to_classification Apply the transformation to a batch of classification labels.
Method apply_to_instance_mask Apply the transformation to a batch of instance segmentation masks.
Method apply_to_keypoints Apply the transformation to a batch of keypoints.
Method apply_to_mask Apply the transformation to a batch of semantic segmentation masks.
Method apply_to_metadata Apply the transformation to a batch of metadata arrays.
Method update_transform_params Update the parameters dictionary with the shape of the input images.
Instance Variable batch_size Number of samples consumed by one application of the transform.
Property targets Undocumented
def __init__(self, batch_size: int, **kwargs):

Create a batch transformation.

Batch transformations combine multiple images and their labels into one sample.

Parameters
batch_size:intNumber of samples required by the augmentation.
**kwargsAdditional arguments passed to the parent Albumentations transform.
@abstractmethod
def apply(self, image_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of images.

Parameters
image_batch:list[np.ndarray]Images to transform. Each image should be of shape (H, W, C) or (H, W).
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarraySingle transformed image resulting from the combination of the input batch.
def apply_to_array(self, array_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of generic arrays.

Note

The default implementation simply concatenates non-empty arrays. Override this method if a different behavior is desired.

Parameters
array_batch:list[np.ndarray]A batch of arrays to transform.
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarrayUndocumented
@abstractmethod
def apply_to_bboxes(self, bboxes_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of bounding boxes.

Parameters
bboxes_batch:list[np.ndarray]A batch of bounding boxes to transform.
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarrayTransformed bounding boxes resulting from the combination of the input batch.
def apply_to_classification(self, classification_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of classification labels.

Note

The default implementation treats classification labels as binary and returns their logical OR. Override this method if a different behavior is desired.

Parameters
classification_batch:list[np.ndarray]A batch of classification labels to transform.
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarrayUndocumented
@abstractmethod
def apply_to_instance_mask(self, masks_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of instance segmentation masks.

Parameters
masks_batch:list[np.ndarray]Masks to transform. Each mask should be of shape (H, W, N), where N is the number of instances.
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarrayA single instance masks of shape (Hout, Wout, N).
@abstractmethod
def apply_to_keypoints(self, keypoints_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of keypoints.

Parameters
keypoints_batch:list[np.ndarray]A batch of keypoints to transform.
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarrayTransformed keypoints resulting from the combination of the input batch.
@abstractmethod
def apply_to_mask(self, masks_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of semantic segmentation masks.

Parameters
masks_batch:list[np.ndarray]Masks to transform. Each mask should be of shape (H, W, C) or (H, W).
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarraySingle transformed mask resulting from the combination of the input batch.
def apply_to_metadata(self, metadata_batch: list[np.ndarray], **kwargs) -> np.ndarray:

Apply the transformation to a batch of metadata arrays.

Note

The default implementation concatenates non-empty metadata arrays. Override this method if a different behavior is desired.

Parameters
metadata_batch:list[np.ndarray]A batch of metadata arrays to transform.
**kwargsAdditional implementation-specific arguments.
Returns
np.ndarrayUndocumented
@override
def update_transform_params(self, params: dict[str, Any], data: dict[str, Any]) -> dict[str, Any]:

Update the parameters dictionary with the shape of the input images.

Parameters
params:dict[str, Any]Parameters to be updated
data:dict[str, Any]Input data dictionary containing images/volumes
Returns
dict[str, Any]Updated parameters dictionary with shape and transform-specific parameters.
batch_size =

Number of samples consumed by one application of the transform.

@property
@override
targets: dict[str, Callable] =

Undocumented