vis4d.data.transforms.mosaic¶
Mosaic transformation.
Modified from mmdetection (https://github.com/open-mmlab/mmdetection).
Functions
|
Compute the mosaic parameters for the image at the current index. |
Classes
|
Generate the parameters for a mosaic operation. |
|
Apply Mosaic to a list of 2D bounding boxes. |
|
Apply Mosaic to images. |
Parameters for Mosaic. |
- class GenMosaicParameters(*, in_keys=['input_hw'], out_keys=['transforms.mosaic'], sensors=None, same_on_batch=True, **kwargs)[source]¶
Generate the parameters for a mosaic operation.
Given 4 images, mosaic transform combines them into one output image. The output image is composed of the parts from each sub- image.
- mosaic transform
center_x
- center_y |----+-------------+-----------|
- | cropped | |
|pad | image3 | image4 | | | | | +----|————-+———–+
The mosaic transform steps are as follows:
Choose the mosaic center as the intersections of 4 images.
Get the left top image according to the index, and randomly sample another 3 images from the dataset.
Sub image will be cropped if image is larger than mosaic patch.
- Parameters:
out_shape (tuple[int, int]) – The output shape of the mosaic transform.
center_ratio_range (tuple[float, float]) – The range of the ratio of the center of the mosaic patch to the output image size.
- __call__(input_hw)[source]¶
Compute the parameters and put them in the data dict.
- Return type:
list
[MosaicParam
]
- class MosaicBoxes2D(*, in_keys=['boxes2d', 'boxes2d_classes', 'boxes2d_track_ids', 'transforms.mosaic.paste_coords', 'transforms.mosaic.crop_coords', 'transforms.mosaic.im_scales'], out_keys=['boxes2d', 'boxes2d_classes', 'boxes2d_track_ids'], sensors=None, same_on_batch=True, **kwargs)[source]¶
Apply Mosaic to a list of 2D bounding boxes.