class_docstr: Resize the image to the base shape, downsample it with gaussian pyramid,
  and rescale it back to original size.
  
  Adapted from https://github.com/FangShancheng/ABINet.
  
  Required Keys:
  
  - img (ndarray)
  
  Modified Keys:
  
  - img (ndarray)
  
  Args:
      factor (int): The decay factor from base size, or the number of
          downsampling operations from the base layer.
      base_shape (tuple[int, int]): The shape (width, height) of the base
          layer of the pyramid.
      randomize_factor (bool): If True, the final factor would be a random
          integer in [0, factor].
class_docstr_tok: ["Resize","the","image","to","the","base","shape",",","downsample","it","with","gaussian","pyramid",",","and","rescale","it","back","to","original","size",".","Adapted","from","https",":","\/\/github.com\/FangShancheng\/ABINet",".","Required","Keys",":","-","img","(","ndarray",")","Modified","Keys",":","-","img","(","ndarray",")","Args",":","factor","(","int",")",":","The","decay","factor","from","base","size",",","or","the","number","of","downsampling","operations","from","the","base","layer",".","base_shape","(","tuple","[","int",",","int","]",")",":","The","shape","(","width",",","height",")","of","the","base","layer","of","the","pyramid",".","randomize_factor","(","bool",")",":","If","True",",","the","final","factor","would","be","a","random","integer","in","[","0",",","factor","]","."]
docstr: Applying pyramid rescale on results.
  
  Args:
      results (dict): Result dict containing the data to transform.
  
  Returns:
      Dict: The transformed data.
docstr_tok: ["Applying","pyramid","rescale","on","results",".","Args",":","results","(","dict",")",":","Result","dict","containing","the","data","to","transform",".","Returns",":","Dict",":","The","transformed","data","."]
code: def transform(self, results: Dict) -> Dict:
      """Applying pyramid rescale on results.
  
      Args:
          results (dict): Result dict containing the data to transform.
  
      Returns:
          Dict: The transformed data.
      """
  
      assert "img" in results, "`img` is not found in results"
      if self.randomize_factor:
          self.factor = self.get_random_factor()
      if self.factor == 0:
          return results
      img = results["img"]
      src_h, src_w = img.shape[:2]
      scale_img = mmcv.imresize(img, (self.base_w, self.base_h))
      for _ in range(self.factor):
          scale_img = cv2.pyrDown(scale_img)
      scale_img = mmcv.imresize(scale_img, (src_w, src_h))
      results["img"] = scale_img
      return results
  
imports: import math
  import random
  from typing import Dict, List, Optional, Tuple
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import cache_randomness
  from mmocr.registry import TRANSFORMS
label_desc: Use image node_id 3 for calling the PyramidRescale obj's underlying member method code with example usage: obj.transform(results) and returns: results, results