docstr: Refer to part of the code:
  https://github.com/open-mmlab/mmocr/blob/main/mmocr/datasets/pipelines/textdet_targets/base_textdet_targets.py
docstr_tok: ["Refer","to","part","of","the","code",":","https",":","\/\/github.com\/open-mmlab\/mmocr\/blob\/main\/mmocr\/datasets\/pipelines\/textdet_targets\/base_textdet_targets.py"]
code: def generate_kernel(
      self, img_size, shrink_ratio, text_polys, ignore_tags=None
  ):
      """
      Refer to part of the code:
      https://github.com/open-mmlab/mmocr/blob/main/mmocr/datasets/pipelines/textdet_targets/base_textdet_targets.py
      """
  
      h, w = img_size
      text_kernel = np.zeros((h, w), dtype=np.float32)
      for i, poly in enumerate(text_polys):
          polygon = Polygon(poly)
          distance = (
              polygon.area
              * (1 - shrink_ratio * shrink_ratio)
              / (polygon.length + 1e-6)
          )
          subject = [tuple(l) for l in poly]
          pco = pyclipper.PyclipperOffset()
          pco.AddPath(
              subject, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON
          )
          shrinked = np.array(pco.Execute(-distance))
  
          if len(shrinked) == 0 or shrinked.size == 0:
              if ignore_tags is not None:
                  ignore_tags[i] = True
              continue
          try:
              shrinked = np.array(shrinked[0]).reshape(-1, 2)
          except:
              if ignore_tags is not None:
                  ignore_tags[i] = True
              continue
          cv2.fillPoly(text_kernel, [shrinked.astype(np.int32)], i + 1)
      return text_kernel, ignore_tags
  
file_path: PaddleOCR/ppocr/data/imaug/make_pse_gt.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import cv2
  import numpy
  import pyclipper
  from shapely.geometry import Polygon
label_desc: Use image node_id 3 for calling the MakePseGt obj's underlying member method code with example usage: obj.generate_kernel(img_size, shrink_ratio, text_polys, ignore_tags) and returns: text_kernel,  ignore_tags