Shortcuts

RandomChoiceResize

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

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

参数
  • 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.

注解

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[源代码]

Apply resize transforms on results from a list of scales.

参数

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

返回

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

返回类型

dict

Read the Docs v: latest
Versions
latest
stable
2.x
v2.2.0
v2.1.0
v2.0.1
v2.0.0
1.x
v1.7.1
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
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.