class_docstr: Base class for geometric transformations. All geometric transformations
  need to inherit from this base class. ``GeomTransform`` unifies the class
  attributes and class functions of geometric transformations (ShearX,
  ShearY, Rotate, TranslateX, and TranslateY), and records the homography
  matrix.
  
  Required Keys:
  
  - img
  - gt_bboxes (BaseBoxes[torch.float32]) (optional)
  - gt_masks (BitmapMasks | PolygonMasks) (optional)
  - gt_seg_map (np.uint8) (optional)
  
  Modified Keys:
  
  - img
  - gt_bboxes
  - gt_masks
  - gt_seg_map
  
  Added Keys:
  
  - homography_matrix
  
  Args:
      prob (float): The probability for performing the geometric
          transformation and should be in range [0, 1]. Defaults to 1.0.
      level (int, optional): The level should be in range [0, _MAX_LEVEL].
          If level is None, it will generate from [0, _MAX_LEVEL] randomly.
          Defaults to None.
      min_mag (float): The minimum magnitude for geometric transformation.
          Defaults to 0.0.
      max_mag (float): The maximum magnitude for geometric transformation.
          Defaults to 1.0.
      reversal_prob (float): The probability that reverses the geometric
          transformation magnitude. Should be in range [0,1].
          Defaults to 0.5.
      img_border_value (int | float | tuple): The filled values for
          image border. If float, the same fill value will be used for
          all the three channels of image. If tuple, it should be 3 elements.
          Defaults to 128.
      mask_border_value (int): The fill value used for masks. Defaults to 0.
      seg_ignore_label (int): The fill value used for segmentation map.
          Note this value must equals ``ignore_label`` in ``semantic_head``
          of the corresponding config. Defaults to 255.
      interpolation (str): Interpolation method, accepted values are
          "nearest", "bilinear", "bicubic", "area", "lanczos" for 'cv2'
          backend, "nearest", "bilinear" for 'pillow' backend. Defaults
          to 'bilinear'.
code: def __init__(
      self,
      prob: float = 1.0,
      level: Optional[int] = None,
      min_mag: float = 0.0,
      max_mag: float = 1.0,
      reversal_prob: float = 0.5,
      img_border_value: Union[int, float, tuple] = 128,
      mask_border_value: int = 0,
      seg_ignore_label: int = 255,
      interpolation: str = "bilinear",
  ) -> None:
      assert 0 <= prob <= 1.0, (
          f"The probability of the transformation "
          f"should be in range [0,1], got {prob}."
      )
      assert level is None or isinstance(
          level, int
      ), f"The level should be None or type int, got {type(level)}."
      assert (
          level is None or 0 <= level <= _MAX_LEVEL
      ), f"The level should be in range [0,{_MAX_LEVEL}], got {level}."
      assert isinstance(
          min_mag, float
      ), f"min_mag should be type float, got {type(min_mag)}."
      assert isinstance(
          max_mag, float
      ), f"max_mag should be type float, got {type(max_mag)}."
      assert min_mag <= max_mag, (
          f"min_mag should smaller than max_mag, "
          f"got min_mag={min_mag} and max_mag={max_mag}"
      )
      assert isinstance(
          reversal_prob, float
      ), f"reversal_prob should be type float, got {type(max_mag)}."
      assert 0 <= reversal_prob <= 1.0, (
          f"The reversal probability of the transformation magnitude "
          f"should be type float, got {type(reversal_prob)}."
      )
      if isinstance(img_border_value, (float, int)):
          img_border_value = tuple([float(img_border_value)] * 3)
      elif isinstance(img_border_value, tuple):
          assert len(img_border_value) == 3, (
              f"img_border_value as tuple must have 3 elements, "
              f"got {len(img_border_value)}."
          )
          img_border_value = tuple(
              [float(val) for val in img_border_value]
          )
      else:
          raise ValueError(
              "img_border_value must be float or tuple with 3 elements."
          )
      assert np.all([0 <= val <= 255 for val in img_border_value]), (
          "all "
          "elements of img_border_value should between range [0,255]."
          f"got {img_border_value}."
      )
      self.prob = prob
      self.level = level
      self.min_mag = min_mag
      self.max_mag = max_mag
      self.reversal_prob = reversal_prob
      self.img_border_value = img_border_value
      self.mask_border_value = mask_border_value
      self.seg_ignore_label = seg_ignore_label
      self.interpolation = interpolation
  
imports: from typing import Optional, Union
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms import BaseTransform
  from mmcv.transforms.utils import cache_randomness
  from mmdet.registry import TRANSFORMS
  from mmdet.structures.bbox import autocast_box_type
  from .augment_wrappers import _MAX_LEVEL, level_to_mag
label_desc: Use image node_id 1 to create a new GeomTransform object from inherited base classes: BaseTransform with example: obj = GeomTransform(prob, level, min_mag, max_mag, reversal_prob, img_border_value, mask_border_value, seg_ignore_label, interpolation)