vis4d.data.transforms.mixup

Mixup data augmentation.

Classes

GenMixupParameters(*[, in_keys, out_keys, ...])

Generate the parameters for a mixup operation.

MixupBoxes2D(*[, in_keys, out_keys, ...])

Mixup a batch of boxes.

MixupCategories(*[, in_keys, out_keys, ...])

Mixup a batch of categories.

MixupImages(*[, in_keys, out_keys, sensors, ...])

Mixup a batch of images.

MixupParam

Typed dict for mixup parameters.

class GenMixupParameters(*, in_keys=('images',), out_keys=('transforms.mixup',), sensors=None, same_on_batch=True, **kwargs)[source]

Generate the parameters for a mixup operation.

__call__(images)[source]

Generate parameters for MixUp.

Return type:

list[MixupParam]

class MixupBoxes2D(*, in_keys=('boxes2d', 'boxes2d_classes', 'boxes2d_track_ids', 'transforms.mixup'), out_keys=('boxes2d', 'boxes2d_classes', 'boxes2d_track_ids'), sensors=None, same_on_batch=True, **kwargs)[source]

Mixup a batch of boxes.

__call__(boxes_list, classes_list, track_ids_list, mixup_parameters)[source]

Execute the boxes2d mixup operation.

Return type:

tuple[list[ndarray[Any, dtype[float32]]], list[ndarray[Any, dtype[int64]]], list[ndarray[Any, dtype[int64]]] | None]

class MixupCategories(*, in_keys=('categories', 'transforms.mixup'), out_keys=('categories',), sensors=None, same_on_batch=True, **kwargs)[source]

Mixup a batch of categories.

__call__(categories, mixup_parameters)[source]

Execute the categories mixup operation.

Return type:

list[ndarray[Any, dtype[float32]]]

class MixupImages(*, in_keys=('images', 'transforms.mixup'), out_keys=('images',), sensors=None, same_on_batch=True, **kwargs)[source]

Mixup a batch of images.

__call__(images, mixup_parameters)[source]

Execute image mixup operation.

Return type:

list[ndarray[Any, dtype[float32]]]

class MixupParam[source]

Typed dict for mixup parameters.

The parameters are used to mixup a pair of items in a batch. Usually, the pairs are selected as follows:

(0, bs - 1), (1, bs - 2), …, (bs // 2, bs // 2)

where bs is the batch size. The batch size must be even for mixup to work.