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: Get the randomized factor.
  
  Returns:
      float: The randomized factor.
docstr_tok: ["Get","the","randomized","factor",".","Returns",":","float",":","The","randomized","factor","."]
code: def get_random_factor(self) -> float:
      """Get the randomized factor.
  
      Returns:
          float: The randomized factor.
      """
      return np.random.randint(0, self.factor + 1)
  
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 2 for calling the PyramidRescale obj's underlying member method code with example usage: obj.get_random_factor() and returns: np