class_docstr: 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
  
  Args:
      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.
class_docstr_tok: ["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","Args",":","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","."]
code: def __init__(
      self,
      max_angle: int = 10,
      pad_with_fixed_color: bool = False,
      pad_value: Tuple[int, int, int] = (0, 0, 0),
      use_canvas: bool = False,
  ) -> None:
      if not isinstance(max_angle, int):
          raise TypeError(
              "`max_angle` should be an integer"
              f", but got {type(max_angle)} instead"
          )
      if not isinstance(pad_with_fixed_color, bool):
          raise TypeError(
              "`pad_with_fixed_color` should be a bool, "
              f"but got {type(pad_with_fixed_color)} instead"
          )
      if not isinstance(pad_value, (list, tuple)):
          raise TypeError(
              "`pad_value` should be a list or tuple, "
              f"but got {type(pad_value)} instead"
          )
      if len(pad_value) != 3:
          raise ValueError("`pad_value` should contain three integers")
      if (
          not isinstance(pad_value[0], int)
          or not isinstance(pad_value[1], int)
          or not isinstance(pad_value[2], int)
      ):
          raise ValueError("`pad_value` should contain three integers")
  
      self.max_angle = max_angle
      self.pad_with_fixed_color = pad_with_fixed_color
      self.pad_value = pad_value
      self.use_canvas = use_canvas
  
imports: import math
  from typing import Dict, Tuple
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms import Resize
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import avoid_cache_randomness, cache_randomness
  from mmocr.registry import TRANSFORMS
  from mmocr.utils import bbox2poly, crop_polygon, is_poly_inside_rect, poly2bbox, poly2shapely, poly_make_valid, remove_pipeline_elements, rescale_polygon, shapely2poly
  from .wrappers import ImgAugWrapper
label_desc: Use image node_id 1 to create a new RandomRotate object from inherited base classes: BaseTransform with example: obj = RandomRotate(max_angle, pad_with_fixed_color, pad_value, use_canvas)