code: def test_crop_polygons(self):
      trans = TextDetRandomCrop(target_size=(3, 3))
      crop_box = np.array([2, 3, 5, 5])
      polygons = [
          bbox2poly([2, 3, 4, 4]),
          bbox2poly([0, 0, 1, 1]),
          bbox2poly([1, 2, 4, 4]),
          bbox2poly([0, 0, 10, 10]),
      ]
      kept_polygons, kept_idx = trans._crop_polygons(polygons, crop_box)
      target_polygons = [
          bbox2poly([0, 0, 2, 1]),
          bbox2poly([0, 0, 2, 1]),
          bbox2poly([0, 0, 3, 2]),
      ]
      self.assertEqual(len(kept_polygons), 3)
      self.assertEqual(kept_idx, [0, 2, 3])
      self.assertTrue(
          poly2shapely(target_polygons[0]).equals(
              poly2shapely(kept_polygons[0])
          )
      )
      self.assertTrue(
          poly2shapely(target_polygons[1]).equals(
              poly2shapely(kept_polygons[1])
          )
      )
      self.assertTrue(
          poly2shapely(target_polygons[2]).equals(
              poly2shapely(kept_polygons[2])
          )
      )
  
imports: import copy
  import unittest
  import unittest.mock
  import numpy
  from mmcv.transforms import Pad, RandomResize
  from mmocr.datasets.transforms import BoundedScaleAspectJitter, RandomCrop, RandomFlip, Resize, ShortScaleAspectJitter, SourceImagePad, TextDetRandomCrop, TextDetRandomCropFlip
  from mmocr.utils import bbox2poly, poly2shapely
label_desc: Use image node_id 4 for calling the TestTextDetRandomCrop obj's underlying member method code with example usage: obj.test_crop_polygons() without return types