class_docstr: Random crop and flip a patch in the image. Only used in text detection
  task.
  
  Required Keys:
  
  - img
  - gt_bboxes
  - gt_polygons
  
  Modified Keys:
  
  - img
  - gt_bboxes
  - gt_polygons
  
  Args:
      pad_ratio (float): The ratio of padding. Defaults to 0.1.
      crop_ratio (float): The ratio of cropping. Defaults to 0.5.
      iter_num (int): Number of operations. Defaults to 1.
      min_area_ratio (float): Minimal area ratio between cropped patch
          and original image. Defaults to 0.2.
      epsilon (float): The threshold of polygon IoU between cropped area
          and polygon, which is used to avoid cropping text instances.
          Defaults to 0.01.
docstr: Generate cropping target and make sure not to crop the polygon
  instances.
  
  Args:
      image (np.ndarray): The image waited to be crop.
      all_polys (list[np.ndarray]): Ground-truth polygons.
      pad_h (int): Padding length of height.
      pad_w (int): Padding length of width.
  
  Returns:
      (np.ndarray, np.ndarray): Returns a tuple ``(h_axis, w_axis)``,
      where ``h_axis`` is the vertical cropping range and ``w_axis``
      is the horizontal cropping range.
docstr_tok: ["Generate","cropping","target","and","make","sure","not","to","crop","the","polygon","instances",".","Args",":","image","(","np.ndarray",")",":","The","image","waited","to","be","crop",".","all_polys","(","list","[","np.ndarray","]",")",":","Ground-truth","polygons",".","pad_h","(","int",")",":","Padding","length","of","height",".","pad_w","(","int",")",":","Padding","length","of","width",".","Returns",":","(","np.ndarray",",","np.ndarray",")",":","Returns","a","tuple","``","(","h_axis",",","w_axis",")","``",",","where","``","h_axis","``","is","the","vertical","cropping","range","and","``","w_axis","``","is","the","horizontal","cropping","range","."]
code: def _generate_crop_target(
      self,
      image: np.ndarray,
      all_polys: List[np.ndarray],
      pad_h: int,
      pad_w: int,
  ) -> Tuple[np.ndarray, np.ndarray]:
      """Generate cropping target and make sure not to crop the polygon
      instances.
  
      Args:
          image (np.ndarray): The image waited to be crop.
          all_polys (list[np.ndarray]): Ground-truth polygons.
          pad_h (int): Padding length of height.
          pad_w (int): Padding length of width.
  
      Returns:
          (np.ndarray, np.ndarray): Returns a tuple ``(h_axis, w_axis)``,
          where ``h_axis`` is the vertical cropping range and ``w_axis``
          is the horizontal cropping range.
      """
      h, w, _ = image.shape
      h_array = np.zeros((h + pad_h * 2), dtype=np.int32)
      w_array = np.zeros((w + pad_w * 2), dtype=np.int32)
  
      text_polys = []
      for polygon in all_polys:
          rect = cv2.minAreaRect(
              polygon.astype(np.int32).reshape(-1, 2)
          )
          box = cv2.boxPoints(rect)
          box = np.int0(box)
          text_polys.append([box[0], box[1], box[2], box[3]])
  
      polys = np.array(text_polys, dtype=np.int32)
      for poly in polys:
          poly = np.round(poly, decimals=0).astype(np.int32)
          minx, maxx = np.min(poly[:, 0]), np.max(poly[:, 0])
          miny, maxy = np.min(poly[:, 1]), np.max(poly[:, 1])
          w_array[minx + pad_w : maxx + pad_w] = 1
          h_array[miny + pad_h : maxy + pad_h] = 1
  
      h_axis = np.where(h_array == 0)[0]
      w_axis = np.where(w_array == 0)[0]
      return h_axis, w_axis
  
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 7 for calling the TextDetRandomCropFlip obj's underlying member method code with example usage: obj._generate_crop_target(image, all_polys, pad_h, pad_w) and returns: h_axis,  w_axis