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 targets from data samples.
  
  Args:
      data_samples (list(TextDetDataSample)): Ground truth data samples.
  
  Returns:
      tuple(gt_text_masks, gt_masks, gt_center_region_masks,
      gt_radius_maps, gt_sin_maps, gt_cos_maps):
      A tuple of six lists of ndarrays as the targets.
docstr_tok: ["Generate","loss","targets","from","data","samples",".","Args",":","data_samples","(","list","(","TextDetDataSample",")",")",":","Ground","truth","data","samples",".","Returns",":","tuple","(","gt_text_masks",",","gt_masks",",","gt_center_region_masks",",","gt_radius_maps",",","gt_sin_maps",",","gt_cos_maps",")",":","A","tuple","of","six","lists","of","ndarrays","as","the","targets","."]
code: def get_targets(self, data_samples: List[TextDetDataSample]) -> Tuple:
      """Generate loss targets from data samples.
  
      Args:
          data_samples (list(TextDetDataSample)): Ground truth data samples.
  
      Returns:
          tuple(gt_text_masks, gt_masks, gt_center_region_masks,
          gt_radius_maps, gt_sin_maps, gt_cos_maps):
          A tuple of six lists of ndarrays as the targets.
      """
      return multi_apply(self._get_target_single, data_samples)
  
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 4 for calling the TextSnakeModuleLoss obj's underlying member method code with example usage: obj.get_targets(data_samples) and returns: multi_apply