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: Resample n points on a line.
  
  Args:
      line (ndarray): The points composing a line.
      n (int): The resampled points number.
  
  Returns:
      resampled_line (ndarray): The points composing the resampled line.
docstr_tok: ["Resample","n","points","on","a","line",".","Args",":","line","(","ndarray",")",":","The","points","composing","a","line",".","n","(","int",")",":","The","resampled","points","number",".","Returns",":","resampled_line","(","ndarray",")",":","The","points","composing","the","resampled","line","."]
code: def _resample_line(self, line: ndarray, n: int) -> ndarray:
      """Resample n points on a line.
  
      Args:
          line (ndarray): The points composing a line.
          n (int): The resampled points number.
  
      Returns:
          resampled_line (ndarray): The points composing the resampled line.
      """
  
      assert line.ndim == 2
      assert line.shape[0] >= 2
      assert line.shape[1] == 2
      assert isinstance(n, int)
      assert n > 2
  
      edges_length, total_length = self._cal_curve_length(line)
      t_org = np.insert(np.cumsum(edges_length), 0, 0)
      unit_t = total_length / (n - 1)
      t_equidistant = np.arange(1, n - 1, dtype=np.float32) * unit_t
      edge_ind = 0
      points = [line[0]]
      for t in t_equidistant:
          while (
              edge_ind < len(edges_length) - 1
              and t > t_org[edge_ind + 1]
          ):
              edge_ind += 1
          t_l, t_r = t_org[edge_ind], t_org[edge_ind + 1]
          weight = np.array([t_r - t, t - t_l], dtype=np.float32) / (
              t_r - t_l + self.eps
          )
          p_coords = np.dot(weight, line[[edge_ind, edge_ind + 1]])
          points.append(p_coords)
      points.append(line[-1])
      resampled_line = np.vstack(points)
  
      return resampled_line
  
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 10 for calling the TextSnakeModuleLoss obj's underlying member method code with example usage: obj._resample_line(line, n) and returns: resampled_line