vis4d.data.transforms.flip

Horizontal flip augmentation.

Functions

get_axis(direction, axis_mode)

Get axis number of certain direction given axis mode.

Classes

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

Flip a list of 2D bounding boxes.

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

Flip 3D bounding box array.

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

Flip depth map.

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

Flip a list of numpy image array of shape [N, H, W, C].

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

Flip instance masks.

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

Modify intrinsics for image flip.

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

Flip optical flow map.

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

Flip pointcloud array.

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

Flip segmentation masks.

class FlipBoxes2D(*, in_keys=('boxes2d', 'images'), out_keys=('boxes2d',), sensors=None, same_on_batch=True, **kwargs)[source]

Flip a list of 2D bounding boxes.

__call__(boxes_list, images)[source]

Execute flipping op.

Parameters:
  • boxes (list[NDArrayF32]) – List of [M, 4] array of boxes.

  • image (list[NDArrayF32]) – List of [N, H, W, C] array of image.

Returns:

List of [M, 4] array of flipped boxes.

Return type:

list[NDArrayF32]

class FlipBoxes3D(*, in_keys=('boxes3d', 'axis_mode'), out_keys=('boxes3d',), sensors=None, same_on_batch=True, **kwargs)[source]

Flip 3D bounding box array.

__call__(boxes_list, axis_mode_list)[source]

Execute flipping.

Return type:

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

class FlipDepthMaps(*, in_keys=['depth_maps'], out_keys=['depth_maps'], sensors=None, same_on_batch=True, **kwargs)[source]

Flip depth map.

__call__(depths)[source]

Execute flipping op.

Parameters:

depths (list[NDArrayF32]) – Each is a [H, W] array of depth.

Returns:

Each is a [H, W] array of flipped depth.

Return type:

list[NDArrayF32]

class FlipImages(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Flip a list of numpy image array of shape [N, H, W, C].

__call__(images)[source]

Execute flipping op.

Parameters:

image (NDArrayF32) – [N, H, W, C] array of image.

Returns:

[N, H, W, C] array of flipped image.

Return type:

list[NDArrayF32]

class FlipInstanceMasks(*, in_keys=['instance_masks'], out_keys=['instance_masks'], sensors=None, same_on_batch=True, **kwargs)[source]

Flip instance masks.

__call__(masks)[source]

Execute flipping op.

Parameters:

masks (list[NDArrayUI8]) – List of [N, H, W] array of masks.

Returns:

List of [N, H, W] array of flipped masks.

Return type:

list[NDArrayUI8]

class FlipIntrinsics(*, in_keys=('intrinsics', 'images'), out_keys=('intrinsics',), sensors=None, same_on_batch=True, **kwargs)[source]

Modify intrinsics for image flip.

__call__(intrinsics_list, images)[source]

Execute flipping.

Return type:

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

class FlipOpticalFlows(*, in_keys=['optical_flows'], out_keys=['optical_flows'], sensors=None, same_on_batch=True, **kwargs)[source]

Flip optical flow map.

__call__(flows)[source]

Execute flipping op.

Parameters:

flows (NDArrayF32) – Each is a [H, W, 2] array of optical flow.

Returns:

Each is a [H, W, 2] array of flipped optical

flow.

Return type:

list[NDArrayF32]

class FlipPoints3D(*, in_keys=('points3d', 'axis_mode'), out_keys=('points3d',), sensors=None, same_on_batch=True, **kwargs)[source]

Flip pointcloud array.

__call__(points3d_list, axis_mode_list)[source]

Execute flipping.

Return type:

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

class FlipSegMasks(*, in_keys=['seg_masks'], out_keys=['seg_masks'], sensors=None, same_on_batch=True, **kwargs)[source]

Flip segmentation masks.

__call__(masks)[source]

Execute flipping op.

Parameters:

masks (NDArrayUI8) – [H, W] array of masks.

Returns:

[H, W] array of flipped masks.

Return type:

list[NDArrayUI8]

get_axis(direction, axis_mode)[source]

Get axis number of certain direction given axis mode.

Parameters:
  • direction (str) – One of horizontal, vertical and lateral.

  • axis_mode (AxisMode) – axis mode.

Returns:

Number of axis in certain direction.

Return type:

int