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: Generate text center region mask and geometry attribute maps.
  
  Args:
      img_size (tuple): The image size (height, width).
      text_polys (list[ndarray]): The list of text polygons.
  
  Returns:
      text_region_mask (ndarray): The text region mask.
docstr_tok: ["Generate","text","center","region","mask","and","geometry","attribute","maps",".","Args",":","img_size","(","tuple",")",":","The","image","size","(","height",",","width",")",".","text_polys","(","list","[","ndarray","]",")",":","The","list","of","text","polygons",".","Returns",":","text_region_mask","(","ndarray",")",":","The","text","region","mask","."]
code: def _generate_text_region_mask(
      self, img_size: Tuple[int, int], text_polys: List[ndarray]
  ) -> ndarray:
      """Generate text center region mask and geometry attribute maps.
  
      Args:
          img_size (tuple): The image size (height, width).
          text_polys (list[ndarray]): The list of text polygons.
  
      Returns:
          text_region_mask (ndarray): The text region mask.
      """
  
      assert isinstance(img_size, tuple)
  
      text_region_mask = np.zeros(img_size, dtype=np.uint8)
  
      for poly in text_polys:
          polygon = np.array(poly, dtype=np.int32).reshape((1, -1, 2))
          cv2.fillPoly(text_region_mask, polygon, 1)
  
      return text_region_mask
  
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 6 for calling the TextSnakeModuleLoss obj's underlying member method code with example usage: obj._generate_text_region_mask(img_size, text_polys) and returns: text_region_mask