vis4d.data.transforms.affine
Affine transformation.
Modified from mmdetection (https://github.com/open-mmlab/mmdetection).
Functions
|
Generate rotation matrix. |
|
Generate scaling matrix. |
|
Generate shear matrix. |
|
Generate translation matrix. |
Classes
|
Apply Affine to a list of 2D bounding boxes. |
|
Affine Images. |
Parameters for Affine. |
|
|
Random affine transform data augmentation. |
- get_rotation_matrix(rotate_degrees)[source]
Generate rotation matrix.
- Parameters:
rotate_degrees (float) – Rotation degrees.
- Return type:
ndarray[Any,dtype[float32]]
- get_scaling_matrix(scale_ratio)[source]
Generate scaling matrix.
- Parameters:
scale_ratio (float) – Scale ratio.
- Return type:
ndarray[Any,dtype[float32]]
- get_shear_matrix(x_shear_degrees, y_shear_degrees)[source]
Generate shear matrix.
- Parameters:
x_shear_degrees (float) – X shear degrees.
y_shear_degrees (float) – Y shear degrees.
- Return type:
ndarray[Any,dtype[float32]]
- get_translation_matrix(x_trans, y_trans)[source]
Generate translation matrix.
- Parameters:
x_trans (float) – X translation.
y_trans (float) – Y translation.
- Return type:
ndarray[Any,dtype[float32]]
- class GenAffineParameters(*, in_keys=['input_hw'], out_keys=['transforms.affine'], sensors=None, same_on_batch=True, **kwargs)[source]
Random affine transform data augmentation.
This operation randomly generates affine transform matrix which including rotation, translation, shear, and scaling transforms.
- __call__(input_hw)[source]
Compute the parameters and put them in the data dict.
- Return type:
list[AffineParam]
- class AffineImages(*, in_keys=['images', 'transforms.affine.warp_matrix', 'transforms.affine.height', 'transforms.affine.width'], out_keys=['images', 'input_hw'], sensors=None, same_on_batch=True, **kwargs)[source]
Affine Images.
- class AffineBoxes2D(*, in_keys=['boxes2d', 'boxes2d_classes', 'boxes2d_track_ids', 'transforms.affine.warp_matrix', 'transforms.affine.height', 'transforms.affine.width'], out_keys=['boxes2d', 'boxes2d_classes', 'boxes2d_track_ids'], sensors=None, same_on_batch=True, **kwargs)[source]
Apply Affine to a list of 2D bounding boxes.