class_docstr: The class for implementing TextSnake loss. This is partially adapted
  from https://github.com/princewang1994/TextSnake.pytorch.
  
  TextSnake: `A Flexible Representation for Detecting Text of Arbitrary
  Shapes <https://arxiv.org/abs/1807.01544>`_.
  
  Args:
      ohem_ratio (float): The negative/positive ratio in ohem.
      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.
      resample_step (float): The step of resampling.
      center_region_shrink_ratio (float): The shrink ratio of text center.
      loss_text (dict): The loss config used to calculate the text loss.
      loss_center (dict): The loss config used to calculate the center loss.
      loss_radius (dict): The loss config used to calculate the radius loss.
      loss_sin (dict): The loss config used to calculate the sin loss.
      loss_cos (dict): The loss config used to calculate the cos loss.
docstr: Draw attributes on text center region.
  
  Args:
      top_line (ndarray): The points composing top curved sideline of
          text polygon.
      bot_line (ndarray): The points composing bottom curved sideline
          of text polygon.
      center_line (ndarray): The points composing the center line of text
          instance.
      center_region_mask (ndarray): The text center region mask.
      radius_map (ndarray): The map where the distance from point to
          sidelines will be drawn on for each pixel in text center
          region.
      sin_map (ndarray): The map where vector_sin(theta) will be drawn
          on text center regions. Theta is the angle between tangent
          line and vector (1, 0).
      cos_map (ndarray): The map where vector_cos(theta) will be drawn on
          text center regions. Theta is the angle between tangent line
          and vector (1, 0).
      region_shrink_ratio (float): The shrink ratio of text center.
docstr_tok: ["Draw","attributes","on","text","center","region",".","Args",":","top_line","(","ndarray",")",":","The","points","composing","top","curved","sideline","of","text","polygon",".","bot_line","(","ndarray",")",":","The","points","composing","bottom","curved","sideline","of","text","polygon",".","center_line","(","ndarray",")",":","The","points","composing","the","center","line","of","text","instance",".","center_region_mask","(","ndarray",")",":","The","text","center","region","mask",".","radius_map","(","ndarray",")",":","The","map","where","the","distance","from","point","to","sidelines","will","be","drawn","on","for","each","pixel","in","text","center","region",".","sin_map","(","ndarray",")",":","The","map","where","vector_sin","(","theta",")","will","be","drawn","on","text","center","regions",".","Theta","is","the","angle","between","tangent","line","and","vector","(","1",",","0",")",".","cos_map","(","ndarray",")",":","The","map","where","vector_cos","(","theta",")","will","be","drawn","on","text","center","regions",".","Theta","is","the","angle","between","tangent","line","and","vector","(","1",",","0",")",".","region_shrink_ratio","(","float",")",":","The","shrink","ratio","of","text","center","."]
code: def _draw_center_region_maps(
      self,
      top_line: ndarray,
      bot_line: ndarray,
      center_line: ndarray,
      center_region_mask: ndarray,
      radius_map: ndarray,
      sin_map: ndarray,
      cos_map: ndarray,
      region_shrink_ratio: float,
  ) -> None:
      """Draw attributes on text center region.
  
      Args:
          top_line (ndarray): The points composing top curved sideline of
              text polygon.
          bot_line (ndarray): The points composing bottom curved sideline
              of text polygon.
          center_line (ndarray): The points composing the center line of text
              instance.
          center_region_mask (ndarray): The text center region mask.
          radius_map (ndarray): The map where the distance from point to
              sidelines will be drawn on for each pixel in text center
              region.
          sin_map (ndarray): The map where vector_sin(theta) will be drawn
              on text center regions. Theta is the angle between tangent
              line and vector (1, 0).
          cos_map (ndarray): The map where vector_cos(theta) will be drawn on
              text center regions. Theta is the angle between tangent line
              and vector (1, 0).
          region_shrink_ratio (float): The shrink ratio of text center.
      """
  
      assert top_line.shape == bot_line.shape == center_line.shape
      assert (
          center_region_mask.shape
          == radius_map.shape
          == sin_map.shape
          == cos_map.shape
      )
      assert isinstance(region_shrink_ratio, float)
      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
          radius = norm(top_mid_point - bot_mid_point) / 2
  
          text_direction = center_line[i + 1] - center_line[i]
          sin_theta = self.vector_sin(text_direction)
          cos_theta = self.vector_cos(text_direction)
  
          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)
          cv2.fillPoly(radius_map, [current_center_box], color=radius)
  
imports: from typing import Dict, List, Sequence, Tuple
  import cv2
  import numpy
  import torch
  from mmcv.image import impad, 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 .seg_based_module_loss import SegBasedModuleLoss
label_desc: Use image node_id 13 for calling the TextSnakeModuleLoss obj's underlying member method code with example usage: obj._draw_center_region_maps(top_line, bot_line, center_line, center_region_mask, radius_map, sin_map, cos_map, region_shrink_ratio) without return types