vis4d.data.transforms.resize
Resize transformation.
Functions
|
Get shape for resize, considering keep_ratio and align_long_edge. |
|
Resize image. |
|
Resize Tensor. |
Classes
|
Generate the parameters for a resize operation. |
|
Resize list of 2D bounding boxes. |
|
Resize depth maps. |
|
Resize Images. |
|
Resize instance segmentation masks. |
|
Resize Intrinsics. |
|
Resize optical flows. |
Parameters for Resize. |
|
|
Resize segmentation masks. |
- class GenResizeParameters(*, in_keys=['images'], out_keys=['transforms.resize', 'input_hw'], sensors=None, same_on_batch=True, **kwargs)[source]
Generate the parameters for a resize operation.
- __call__(images)[source]
Compute the parameters and put them in the data dict.
- Return type:
tuple[list[ResizeParam],list[tuple[int,int]]]
- get_resize_shape(original_shape, new_shape, keep_ratio=True, align_long_edge=False, resize_short_edge=False, allow_overflow=False, fixed_scale=False)[source]
Get shape for resize, considering keep_ratio and align_long_edge.
- Parameters:
original_shape (tuple[int, int]) – Original shape in [H, W].
new_shape (tuple[int, int]) – New shape in [H, W].
keep_ratio (bool, optional) – Whether to keep the aspect ratio. Defaults to True.
align_long_edge (bool, optional) – Whether to align the long edge of the original shape with the long edge of the new shape. Defaults to False.
resize_short_edge (bool, optional) – Whether to resize according to the short edge. Defaults to False.
allow_overflow (bool, optional) – Whether to allow overflow. Defaults to False.
fixed_scale (bool, optional) – Whether to use fixed scale.
- Returns:
The new shape in [H, W].
- Return type:
tuple[int, int]
- class ResizeImages(*, in_keys=['images', 'transforms.resize.target_shape'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]
Resize Images.
- resize_image(inputs, shape, interpolation='bilinear', antialias=False, backend='torch')[source]
Resize image.
- Return type:
ndarray[Any,dtype[float32]]
- class ResizeBoxes2D(*, in_keys=['boxes2d', 'transforms.resize.scale_factor'], out_keys=['boxes2d'], sensors=None, same_on_batch=True, **kwargs)[source]
Resize list of 2D bounding boxes.
- __call__(boxes_list, scale_factors)[source]
Resize 2D bounding boxes.
- Parameters:
boxes_list (
list[ndarray[Any,dtype[float32]]]) – (list[NDArrayF32]): The bounding boxes to be resized.scale_factors (list[tuple[float, float]]) – scaling factors.
- Returns:
- Resized bounding boxes according to parameters in
resize.
- Return type:
list[NDArrayF32]
- class ResizeDepthMaps(*, in_keys=['depth_maps', 'transforms.resize.target_shape', 'transforms.resize.scale_factor'], out_keys=['depth_maps'], sensors=None, same_on_batch=True, **kwargs)[source]
Resize depth maps.
- class ResizeOpticalFlows(*, in_keys=['optical_flows', 'transforms.resize.target_shape', 'transforms.resize.scale_factor'], out_keys=['optical_flows'], sensors=None, same_on_batch=True, **kwargs)[source]
Resize optical flows.
- class ResizeInstanceMasks(*, in_keys=['instance_masks', 'transforms.resize.target_shape'], out_keys=['instance_masks'], sensors=None, same_on_batch=True, **kwargs)[source]
Resize instance segmentation masks.
- class ResizeSegMasks(*, in_keys=['seg_masks', 'transforms.resize.target_shape'], out_keys=['seg_masks'], sensors=None, same_on_batch=True, **kwargs)[source]
Resize segmentation masks.