code: def test_find_head_tail(self):
      # for quadrange
      polygon = np.array(
          [[1.0, 1.0], [5.0, 1.0], [5.0, 3.0], [1.0, 3.0]]
      )
      head_inds, tail_inds = self.loss._find_head_tail(polygon, 2.0)
      self.assertTrue(np.allclose(head_inds, [3, 0]))
      self.assertTrue(np.allclose(tail_inds, [1, 2]))
      polygon = np.array(
          [[1.0, 1.0], [1.0, 3.0], [5.0, 3.0], [5.0, 1.0]]
      )
      head_inds, tail_inds = self.loss._find_head_tail(polygon, 2.0)
      self.assertTrue(np.allclose(head_inds, [0, 1]))
      self.assertTrue(np.allclose(tail_inds, [2, 3]))
  
      # for polygon
      polygon = np.array(
          [
              [0.0, 10.0],
              [3.0, 3.0],
              [10.0, 0.0],
              [17.0, 3.0],
              [20.0, 10.0],
              [15.0, 10.0],
              [13.5, 6.5],
              [10.0, 5.0],
              [6.5, 6.5],
              [5.0, 10.0],
          ]
      )
      head_inds, tail_inds = self.loss._find_head_tail(polygon, 2.0)
      self.assertTrue(np.allclose(head_inds, [9, 0]))
      self.assertTrue(np.allclose(tail_inds, [4, 5]))
  
file_path: mmocr/tests/test_models/test_textdet/test_module_losses/test_textsnake_module_loss.py
imports: from unittest import TestCase
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from mmocr.models.textdet.module_losses import TextSnakeModuleLoss
  from mmocr.structures import TextDetDataSample
label_desc: Use image node_id 3 for calling the TestTextSnakeModuleLoss obj's underlying member method code with example usage: obj.test_find_head_tail() without return types