Shortcuts

RandomRotate

class mmocr.datasets.transforms.RandomRotate(max_angle=10, pad_with_fixed_color=False, pad_value=(0, 0, 0), use_canvas=False)[源代码]

Randomly rotate the image, boxes, and polygons. For recognition task, only the image will be rotated. If set use_canvas as True, the shape of rotated image might be modified based on the rotated angle size, otherwise, the image will keep the shape before rotation.

Required Keys:

  • img

  • img_shape

  • gt_bboxes (optional)

  • gt_polygons (optional)

Modified Keys:

  • img

  • img_shape (optional)

  • gt_bboxes (optional)

  • gt_polygons (optional)

Added Keys:

  • rotated_angle

参数
  • max_angle (int) – The maximum rotation angle (can be bigger than 180 or a negative). Defaults to 10.

  • pad_with_fixed_color (bool) – The flag for whether to pad rotated image with fixed value. Defaults to False.

  • pad_value (tuple[int, int, int]) – The color value for padding rotated image. Defaults to (0, 0, 0).

  • use_canvas (bool) – Whether to create a canvas for rotated image. Defaults to False. If set true, the image shape may be modified.

返回类型

None

transform(results)[源代码]

Applying random rotate on results.

参数
  • results (Dict) – Result dict containing the data to transform.

  • center_shift (Tuple[int, int]) – The shifting offset of the center point

返回

The transformed data

返回类型

dict

Read the Docs v: dev-1.x
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.