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.
- 返回类型