class_docstr: Resize image & bboxes & polygons.
  
  This transform resizes the input image according to ``scale`` or
  ``scale_factor``. Bboxes and polygons are then resized with the same
  scale factor. if ``scale`` and ``scale_factor`` are both set, it will use
  ``scale`` to resize.
  
  Required Keys:
  
  - img
  - img_shape
  - gt_bboxes
  - gt_polygons
  
  
  Modified Keys:
  
  - img
  - img_shape
  - gt_bboxes
  - gt_polygons
  
  Added Keys:
  
  - scale
  - scale_factor
  - keep_ratio
  
  Args:
      scale (int or tuple): Image scales for resizing. Defaults to None.
      scale_factor (float or tuple[float, float]): Scale factors for
          resizing. It's either a factor applicable to both dimensions or
          in the form of (scale_w, scale_h). Defaults to None.
      keep_ratio (bool): Whether to keep the aspect ratio when resizing the
          image. Defaults to False.
      clip_object_border (bool): Whether to clip the objects outside the
          border of the image. Defaults to True.
      backend (str): Image resize backend, choices are 'cv2' and 'pillow'.
          These two backends generates slightly different results. Defaults
          to 'cv2'.
      interpolation (str): Interpolation method, accepted values are
          "nearest", "bilinear", "bicubic", "area", "lanczos" for 'cv2'
          backend, "nearest", "bilinear" for 'pillow' backend. Defaults
          to 'bilinear'.
class_docstr_tok: ["Resize","image","&","bboxes","&","polygons",".","This","transform","resizes","the","input","image","according","to","``","scale","``","or","``","scale_factor","``",".","Bboxes","and","polygons","are","then","resized","with","the","same","scale","factor",".","if","``","scale","``","and","``","scale_factor","``","are","both","set",",","it","will","use","``","scale","``","to","resize",".","Required","Keys",":","-","img","-","img_shape","-","gt_bboxes","-","gt_polygons","Modified","Keys",":","-","img","-","img_shape","-","gt_bboxes","-","gt_polygons","Added","Keys",":","-","scale","-","scale_factor","-","keep_ratio","Args",":","scale","(","int","or","tuple",")",":","Image","scales","for","resizing",".","Defaults","to","None",".","scale_factor","(","float","or","tuple","[","float",",","float","]",")",":","Scale","factors","for","resizing",".","It","'s","either","a","factor","applicable","to","both","dimensions","or","in","the","form","of","(","scale_w",",","scale_h",")",".","Defaults","to","None",".","keep_ratio","(","bool",")",":","Whether","to","keep","the","aspect","ratio","when","resizing","the","image",".","Defaults","to","False",".","clip_object_border","(","bool",")",":","Whether","to","clip","the","objects","outside","the","border","of","the","image",".","Defaults","to","True",".","backend","(","str",")",":","Image","resize","backend",",","choices","are","'cv2","'","and","'pillow","'",".","These","two","backends","generates","slightly","different","results",".","Defaults","to","'cv2","'",".","interpolation","(","str",")",":","Interpolation","method",",","accepted","values","are","``","nearest","''",",","``","bilinear","''",",","``","bicubic","''",",","``","area","''",",","``","lanczos","''","for","'cv2'","backend",",","``","nearest","''",",","``","bilinear","''","for","'pillow","'","backend",".","Defaults","to","'bilinear","'","."]
docstr: Resize polygons with ``results['scale_factor']``.
docstr_tok: ["Resize","polygons","with","``","results","[","'scale_factor","'","]","``","."]
code: def _resize_polygons(self, results: dict) -> None:
      """Resize polygons with ``results['scale_factor']``."""
      if results.get("gt_polygons", None) is not None:
          polygons = results["gt_polygons"]
          polygons_resize = []
          for idx, polygon in enumerate(polygons):
              polygon = rescale_polygon(
                  polygon, results["scale_factor"]
              )
              if self.clip_object_border:
                  crop_bbox = np.array(
                      [
                          0,
                          0,
                          results["img_shape"][1],
                          results["img_shape"][0],
                      ]
                  )
                  polygon = crop_polygon(polygon, crop_bbox)
              if polygon is not None:
                  polygons_resize.append(polygon.astype(np.float32))
              else:
                  polygons_resize.append(
                      np.zeros_like(polygons[idx], dtype=np.float32)
                  )
          results["gt_polygons"] = polygons_resize
  
imports: import math
  from typing import Dict, Tuple
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms import Resize
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import avoid_cache_randomness, cache_randomness
  from mmocr.registry import TRANSFORMS
  from mmocr.utils import bbox2poly, crop_polygon, is_poly_inside_rect, poly2bbox, poly2shapely, poly_make_valid, remove_pipeline_elements, rescale_polygon, shapely2poly
  from .wrappers import ImgAugWrapper
label_desc: Use image node_id 3 for calling the Resize obj's underlying member method code with example usage: obj._resize_polygons(results) without return types