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: Calculate the length of each edge on the discrete curve and the sum.
  
  Args:
      line (ndarray): The points composing a discrete curve.
  
  Returns:
      Tuple(edges_length, total_length):
  
      - edge_length (ndarray): The length of each edge on the
        discrete curve.
      - total_length (float): The total length of the discrete
        curve.
docstr_tok: ["Calculate","the","length","of","each","edge","on","the","discrete","curve","and","the","sum",".","Args",":","line","(","ndarray",")",":","The","points","composing","a","discrete","curve",".","Returns",":","Tuple","(","edges_length",",","total_length",")",":","-","edge_length","(","ndarray",")",":","The","length","of","each","edge","on","the","discrete","curve",".","-","total_length","(","float",")",":","The","total","length","of","the","discrete","curve","."]
code: def _cal_curve_length(self, line: ndarray) -> Tuple[ndarray, float]:
      """Calculate the length of each edge on the discrete curve and the sum.
  
      Args:
          line (ndarray): The points composing a discrete curve.
  
      Returns:
          Tuple(edges_length, total_length):
  
          - edge_length (ndarray): The length of each edge on the
            discrete curve.
          - total_length (float): The total length of the discrete
            curve.
      """
  
      assert line.ndim == 2
      assert len(line) >= 2
  
      edges_length = np.sqrt(
          (line[1:, 0] - line[:-1, 0]) ** 2
          + (line[1:, 1] - line[:-1, 1]) ** 2
      )
      total_length = np.sum(edges_length)
      return edges_length, total_length
  
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 12 for calling the TextSnakeModuleLoss obj's underlying member method code with example usage: obj._cal_curve_length(line) and returns: edges_length,  total_length