class_docstr: Flip the image & bbox polygon.
  
  There are 3 flip modes:
  
   - ``prob`` is float, ``direction`` is string: the image will be
       ``direction``ly flipped with probability of ``prob`` .
       E.g., ``prob=0.5``, ``direction='horizontal'``,
       then image will be horizontally flipped with probability of 0.5.
   - ``prob`` is float, ``direction`` is list of string: the image will
       be ``direction[i]``ly flipped with probability of
       ``prob/len(direction)``.
       E.g., ``prob=0.5``, ``direction=['horizontal', 'vertical']``,
       then image will be horizontally flipped with probability of 0.25,
       vertically with probability of 0.25.
   - ``prob`` is list of float, ``direction`` is list of string:
       given ``len(prob) == len(direction)``, the image will
       be ``direction[i]``ly flipped with probability of ``prob[i]``.
       E.g., ``prob=[0.3, 0.5]``, ``direction=['horizontal',
       'vertical']``, then image will be horizontally flipped with
       probability of 0.3, vertically with probability of 0.5.
  
  Required Keys:
      - img
      - gt_bboxes (optional)
      - gt_polygons (optional)
  
  Modified Keys:
      - img
      - gt_bboxes (optional)
      - gt_polygons (optional)
  
  Added Keys:
      - flip
      - flip_direction
  Args:
       prob (float | list[float], optional): The flipping probability.
           Defaults to None.
       direction(str | list[str]): The flipping direction. Options
           If input is a list, the length must equal ``prob``. Each
           element in ``prob`` indicates the flip probability of
           corresponding direction. Defaults to 'horizontal'.
docstr: Flip images, bounding boxes and polygons.
  
  Args:
      results (dict): Result dict containing the data to transform.
docstr_tok: ["Flip","images",",","bounding","boxes","and","polygons",".","Args",":","results","(","dict",")",":","Result","dict","containing","the","data","to","transform","."]
code: def _flip(self, results: dict) -> None:
      """Flip images, bounding boxes and polygons.
  
      Args:
          results (dict): Result dict containing the data to transform.
      """
      super()._flip(results)
      # flip polygons
      if results.get("gt_polygons", None) is not None:
          results["gt_polygons"] = self.flip_polygons(
              results["gt_polygons"],
              results["img"].shape[:2],
              results["flip_direction"],
          )
  
imports: import math
  import random
  from typing import Dict, List, Sequence, Tuple, Union
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms import RandomFlip
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import avoid_cache_randomness, cache_randomness
  from shapely.geometry import Polygon
  from mmocr.registry import TRANSFORMS
  from mmocr.utils import crop_polygon, poly2bbox, poly_intersection
label_desc: Use image node_id 2 for calling the RandomFlip obj's underlying member method code with example usage: obj._flip(results) without return types