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: Get the respective points composing head edge, tail edge, top
  sideline and bottom sideline.
  
  Args:
      points (ndarray): The points composing a text polygon.
  
  Returns:
      Tuple(center_region_mask, radius_map, sin_map, cos_map):
  
      - head_edge (ndarray): The two points composing the head edge of
        text polygon.
      - tail_edge (ndarray): The two points composing the tail edge of
        text polygon.
      - top_sideline (ndarray): The points composing top curved sideline
        of text polygon.
      - bot_sideline (ndarray): The points composing bottom curved
        sideline of text polygon.
docstr_tok: ["Get","the","respective","points","composing","head","edge",",","tail","edge",",","top","sideline","and","bottom","sideline",".","Args",":","points","(","ndarray",")",":","The","points","composing","a","text","polygon",".","Returns",":","Tuple","(","center_region_mask",",","radius_map",",","sin_map",",","cos_map",")",":","-","head_edge","(","ndarray",")",":","The","two","points","composing","the","head","edge","of","text","polygon",".","-","tail_edge","(","ndarray",")",":","The","two","points","composing","the","tail","edge","of","text","polygon",".","-","top_sideline","(","ndarray",")",":","The","points","composing","top","curved","sideline","of","text","polygon",".","-","bot_sideline","(","ndarray",")",":","The","points","composing","bottom","curved","sideline","of","text","polygon","."]
code: def _reorder_poly_edge(
      self, points: ndarray
  ) -> Tuple[ndarray, ndarray, ndarray, ndarray]:
      """Get the respective points composing head edge, tail edge, top
      sideline and bottom sideline.
  
      Args:
          points (ndarray): The points composing a text polygon.
  
      Returns:
          Tuple(center_region_mask, radius_map, sin_map, cos_map):
  
          - head_edge (ndarray): The two points composing the head edge of
            text polygon.
          - tail_edge (ndarray): The two points composing the tail edge of
            text polygon.
          - top_sideline (ndarray): The points composing top curved sideline
            of text polygon.
          - bot_sideline (ndarray): The points composing bottom curved
            sideline of text polygon.
      """
  
      assert points.ndim == 2
      assert points.shape[0] >= 4
      assert points.shape[1] == 2
  
      head_inds, tail_inds = self._find_head_tail(
          points, self.orientation_thr
      )
      head_edge, tail_edge = points[head_inds], points[tail_inds]
  
      pad_points = np.vstack([points, points])
      if tail_inds[1] < 1:
          tail_inds[1] = len(points)
      sideline1 = pad_points[head_inds[1] : tail_inds[1]]
      sideline2 = pad_points[
          tail_inds[1] : (head_inds[1] + len(points))
      ]
      sideline_mean_shift = np.mean(sideline1, axis=0) - np.mean(
          sideline2, axis=0
      )
  
      if sideline_mean_shift[1] > 0:
          top_sideline, bot_sideline = sideline2, sideline1
      else:
          top_sideline, bot_sideline = sideline1, sideline2
  
      return head_edge, tail_edge, top_sideline, bot_sideline
  
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 8 for calling the TextSnakeModuleLoss obj's underlying member method code with example usage: obj._reorder_poly_edge(points) and returns: head_edge,  tail_edge,  top_sideline,  bot_sideline