class_docstr: The class for implementing DRRG loss. This is partially adapted from
  https://github.com/GXYM/DRRG licensed under the MIT license.
  
  DRRG: `Deep Relational Reasoning Graph Network for Arbitrary Shape Text
  Detection <https://arxiv.org/abs/1908.05900>`_.
  
  Args:
      ohem_ratio (float): The negative/positive ratio in ohem. Defaults to
          3.0.
      downsample_ratio (float): Downsample ratio. Defaults to 1.0. TODO:
          remove it.
      orientation_thr (float): The threshold for distinguishing between
          head edge and tail edge among the horizontal and vertical edges
          of a quadrangle. Defaults to 2.0.
      resample_step (float): The step size for resampling the text center
          line. Defaults to 8.0.
      num_min_comps (int): The minimum number of text components, which
          should be larger than k_hop1 mentioned in paper. Defaults to 9.
      num_max_comps (int): The maximum number of text components. Defaults
          to 600.
      min_width (float): The minimum width of text components. Defaults to
          8.0.
      max_width (float): The maximum width of text components. Defaults to
          24.0.
      center_region_shrink_ratio (float): The shrink ratio of text center
          regions. Defaults to 0.3.
      comp_shrink_ratio (float): The shrink ratio of text components.
          Defaults to 1.0.
      comp_w_h_ratio (float): The width to height ratio of text components.
          Defaults to 0.3.
      min_rand_half_height(float): The minimum half-height of random text
          components. Defaults to 8.0.
      max_rand_half_height (float): The maximum half-height of random
          text components. Defaults to 24.0.
      jitter_level (float): The jitter level of text component geometric
          features. Defaults to 0.2.
      loss_text (dict): The loss config used to calculate the text loss.
          Defaults to ``dict(type='MaskedBalancedBCEWithLogitsLoss',
          fallback_negative_num=100, eps=1e-5)``.
      loss_center (dict): The loss config used to calculate the center loss.
          Defaults to ``dict(type='MaskedBCEWithLogitsLoss')``.
      loss_top (dict): The loss config used to calculate the top loss, which
          is a part of the height loss. Defaults to
          ``dict(type='SmoothL1Loss', reduction='none')``.
      loss_btm (dict): The loss config used to calculate the bottom loss,
          which is a part of the height loss. Defaults to
          ``dict(type='SmoothL1Loss', reduction='none')``.
      loss_sin (dict): The loss config used to calculate the sin loss.
          Defaults to ``dict(type='MaskedSmoothL1Loss')``.
      loss_cos (dict): The loss config used to calculate the cos loss.
          Defaults to ``dict(type='MaskedSmoothL1Loss')``.
      loss_gcn (dict): The loss config used to calculate the GCN loss.
          Defaults to ``dict(type='CrossEntropyLoss')``.
docstr: Draw attributes of text components on text center regions.
  
  Args:
      top_line (ndarray): The points composing the top side lines of text
          polygons.
      bot_line (ndarray): The points composing bottom side lines of text
          polygons.
      center_line (ndarray): The points composing the center lines of
          text instances.
      center_region_mask (ndarray): The text center region mask.
      top_height_map (ndarray): The map on which the distance from points
          to top side lines will be drawn for each pixel in text center
          regions.
      bot_height_map (ndarray): The map on which the distance from points
          to bottom side lines will be drawn for each pixel in text
          center regions.
      sin_map (ndarray): The map of vector_sin(top_point - bot_point)
          that will be drawn on text center regions.
      cos_map (ndarray): The map of vector_cos(top_point - bot_point)
          will be drawn on text center regions.
      region_shrink_ratio (float): The shrink ratio of text center
          regions.
docstr_tok: ["Draw","attributes","of","text","components","on","text","center","regions",".","Args",":","top_line","(","ndarray",")",":","The","points","composing","the","top","side","lines","of","text","polygons",".","bot_line","(","ndarray",")",":","The","points","composing","bottom","side","lines","of","text","polygons",".","center_line","(","ndarray",")",":","The","points","composing","the","center","lines","of","text","instances",".","center_region_mask","(","ndarray",")",":","The","text","center","region","mask",".","top_height_map","(","ndarray",")",":","The","map","on","which","the","distance","from","points","to","top","side","lines","will","be","drawn","for","each","pixel","in","text","center","regions",".","bot_height_map","(","ndarray",")",":","The","map","on","which","the","distance","from","points","to","bottom","side","lines","will","be","drawn","for","each","pixel","in","text","center","regions",".","sin_map","(","ndarray",")",":","The","map","of","vector_sin","(","top_point","-","bot_point",")","that","will","be","drawn","on","text","center","regions",".","cos_map","(","ndarray",")",":","The","map","of","vector_cos","(","top_point","-","bot_point",")","will","be","drawn","on","text","center","regions",".","region_shrink_ratio","(","float",")",":","The","shrink","ratio","of","text","center","regions","."]
code: def _draw_center_region_maps(
      self,
      top_line: ndarray,
      bot_line: ndarray,
      center_line: ndarray,
      center_region_mask: ndarray,
      top_height_map: ndarray,
      bot_height_map: ndarray,
      sin_map: ndarray,
      cos_map: ndarray,
      region_shrink_ratio: float,
  ) -> None:
      """Draw attributes of text components on text center regions.
  
      Args:
          top_line (ndarray): The points composing the top side lines of text
              polygons.
          bot_line (ndarray): The points composing bottom side lines of text
              polygons.
          center_line (ndarray): The points composing the center lines of
              text instances.
          center_region_mask (ndarray): The text center region mask.
          top_height_map (ndarray): The map on which the distance from points
              to top side lines will be drawn for each pixel in text center
              regions.
          bot_height_map (ndarray): The map on which the distance from points
              to bottom side lines will be drawn for each pixel in text
              center regions.
          sin_map (ndarray): The map of vector_sin(top_point - bot_point)
              that will be drawn on text center regions.
          cos_map (ndarray): The map of vector_cos(top_point - bot_point)
              will be drawn on text center regions.
          region_shrink_ratio (float): The shrink ratio of text center
              regions.
      """
  
      assert top_line.shape == bot_line.shape == center_line.shape
      assert (
          center_region_mask.shape
          == top_height_map.shape
          == bot_height_map.shape
          == sin_map.shape
          == cos_map.shape
      )
      assert isinstance(region_shrink_ratio, float)
  
      h, w = center_region_mask.shape
      for i in range(0, len(center_line) - 1):
          top_mid_point = (top_line[i] + top_line[i + 1]) / 2
          bot_mid_point = (bot_line[i] + bot_line[i + 1]) / 2
  
          sin_theta = self.vector_sin(top_mid_point - bot_mid_point)
          cos_theta = self.vector_cos(top_mid_point - bot_mid_point)
  
          tl = (
              center_line[i]
              + (top_line[i] - center_line[i]) * region_shrink_ratio
          )
          tr = (
              center_line[i + 1]
              + (top_line[i + 1] - center_line[i + 1])
              * region_shrink_ratio
          )
          br = (
              center_line[i + 1]
              + (bot_line[i + 1] - center_line[i + 1])
              * region_shrink_ratio
          )
          bl = (
              center_line[i]
              + (bot_line[i] - center_line[i]) * region_shrink_ratio
          )
          current_center_box = np.vstack([tl, tr, br, bl]).astype(
              np.int32
          )
  
          cv2.fillPoly(
              center_region_mask, [current_center_box], color=1
          )
          cv2.fillPoly(sin_map, [current_center_box], color=sin_theta)
          cv2.fillPoly(cos_map, [current_center_box], color=cos_theta)
  
          current_center_box[:, 0] = np.clip(
              current_center_box[:, 0], 0, w - 1
          )
          current_center_box[:, 1] = np.clip(
              current_center_box[:, 1], 0, h - 1
          )
          min_coord = np.min(current_center_box, axis=0).astype(
              np.int32
          )
          max_coord = np.max(current_center_box, axis=0).astype(
              np.int32
          )
          current_center_box = current_center_box - min_coord
          box_sz = max_coord - min_coord + 1
  
          center_box_mask = np.zeros(
              (box_sz[1], box_sz[0]), dtype=np.uint8
          )
          cv2.fillPoly(center_box_mask, [current_center_box], color=1)
  
          inds = np.argwhere(center_box_mask > 0)
          inds = inds + (min_coord[1], min_coord[0])
          inds_xy = np.fliplr(inds)
          top_height_map[
              (inds[:, 0], inds[:, 1])
          ] = self._dist_point2line(
              inds_xy, (top_line[i], top_line[i + 1])
          )
          bot_height_map[
              (inds[:, 0], inds[:, 1])
          ] = self._dist_point2line(
              inds_xy, (bot_line[i], bot_line[i + 1])
          )
  
imports: from typing import Dict, List, Sequence, Tuple
  import cv2
  import numpy
  import torch
  from mmcv.image import imrescale
  from mmdet.models.utils import multi_apply
  from numpy import ndarray
  from numpy.linalg import norm
  from torch import Tensor
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
  from mmocr.utils import check_argument
  from .textsnake_module_loss import TextSnakeModuleLoss
label_desc: Use image node_id 9 for calling the DRRGModuleLoss obj's underlying member method code with example usage: obj._draw_center_region_maps(top_line, bot_line, center_line, center_region_mask, top_height_map, bot_height_map, sin_map, cos_map, region_shrink_ratio) without return types