Shortcuts

RandomRotate

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

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

Parameters
  • 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.

Return type

None

transform(results)[source]

Applying random rotate on results.

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

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

Returns

The transformed data

Return type

dict

Read the Docs v: dev-1.x
Versions
latest
stable
v1.0.1
v1.0.0
0.x
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.1
v0.2.0
v0.1.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.