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 loss target from a data sample.
  
  Args:
      data_sample (TextDetDataSample): The data sample.
  
  Returns:
      tuple(gt_text_mask, gt_mask, gt_center_region_mask, gt_radius_map,
      gt_sin_map, gt_cos_map):
      A tuple of six ndarrays as the targets of one prediction.
docstr_tok: ["Generate","loss","target","from","a","data","sample",".","Args",":","data_sample","(","TextDetDataSample",")",":","The","data","sample",".","Returns",":","tuple","(","gt_text_mask",",","gt_mask",",","gt_center_region_mask",",","gt_radius_map",",","gt_sin_map",",","gt_cos_map",")",":","A","tuple","of","six","ndarrays","as","the","targets","of","one","prediction","."]
code: def _get_target_single(self, data_sample: TextDetDataSample) -> Tuple:
      """Generate loss target from a data sample.
  
      Args:
          data_sample (TextDetDataSample): The data sample.
  
      Returns:
          tuple(gt_text_mask, gt_mask, gt_center_region_mask, gt_radius_map,
          gt_sin_map, gt_cos_map):
          A tuple of six ndarrays as the targets of one prediction.
      """
  
      gt_instances = data_sample.gt_instances
      ignore_flags = gt_instances.ignored
  
      polygons = gt_instances[~ignore_flags].polygons
      ignored_polygons = gt_instances[ignore_flags].polygons
  
      gt_text_mask = self._generate_text_region_mask(
          data_sample.img_shape, polygons
      )
      gt_mask = self._generate_effective_mask(
          data_sample.img_shape, ignored_polygons
      )
  
      (
          gt_center_region_mask,
          gt_radius_map,
          gt_sin_map,
          gt_cos_map,
      ) = self._generate_center_mask_attrib_maps(
          data_sample.img_shape, polygons
      )
  
      return (
          gt_text_mask,
          gt_mask,
          gt_center_region_mask,
          gt_radius_map,
          gt_sin_map,
          gt_cos_map,
      )
  
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 5 for calling the TextSnakeModuleLoss obj's underlying member method code with example usage: obj._get_target_single(data_sample) and returns: gt_text_mask,  gt_mask,  gt_center_region_mask,  gt_radius_map,  gt_sin_map,  gt_cos_map