Shortcuts

RandomChoiceResize

class mmcv.transforms.RandomChoiceResize(scales: Sequence[Union[int, Tuple]], resize_type: str = 'Resize', **resize_kwargs)[source]

Resize images & bbox & mask from a list of multiple scales.

This transform resizes the input image to some scale. Bboxes and masks are then resized with the same scale factor. Resize scale will be randomly selected from scales.

How to choose the target scale to resize the image will follow the rules below:

  • if scale is a list of tuple, the target scale is sampled from the list uniformally.

  • if scale is a tuple, the target scale will be set to the tuple.

Required Keys:

  • img

  • gt_bboxes (optional)

  • gt_seg_map (optional)

  • gt_keypoints (optional)

Modified Keys:

  • img

  • img_shape

  • gt_bboxes (optional)

  • gt_seg_map (optional)

  • gt_keypoints (optional)

Added Keys:

  • scale

  • scale_factor

  • scale_idx

  • keep_ratio

Parameters
  • scales (Union[list, Tuple]) – Images scales for resizing.

  • resize_type (str) – The type of resize class to use. Defaults to “Resize”.

  • **resize_kwargs – Other keyword arguments for the resize_type.

Note

By defaults, the resize_type is “Resize”, if it’s not overwritten by your registry, it indicates the mmcv.Resize. And therefore, resize_kwargs accepts any keyword arguments of it, like keep_ratio, interpolation and so on.

If you want to use your custom resize class, the class should accept scale argument and have scale attribution which determines the resize shape.

transform(results: dict)dict[source]

Apply resize transforms on results from a list of scales.

Parameters

results (dict) – Result dict contains the data to transform.

Returns

Resized results, ‘img’, ‘gt_bboxes’, ‘gt_seg_map’, ‘gt_keypoints’, ‘scale’, ‘scale_factor’, ‘img_shape’, and ‘keep_ratio’ keys are updated in result dict.

Return type

dict

Read the Docs v: 2.x
Versions
master
latest
2.x
1.x
v1.7.0
v1.6.2
v1.6.1
v1.6.0
v1.5.3
v1.5.2_a
v1.5.1
v1.5.0
v1.4.8
v1.4.7
v1.4.6
v1.4.5
v1.4.4
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.18
v1.3.17
v1.3.16
v1.3.15
v1.3.14
v1.3.13
v1.3.12
v1.3.11
v1.3.10
v1.3.9
v1.3.8
v1.3.7
v1.3.6
v1.3.5
v1.3.4
v1.3.3
v1.3.2
v1.3.1
v1.3.0
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.