class_docstr: Randomly expand images and gt boxes by random ratio. It is a data enhancement operation for model training.
  
  Args:
      max_ratio(float): Max value for expansion ratio, default is 4.
      fill(list): Initialize the pixel value of the image with the input fill value, default is None.
      keep_ratio(bool): Whether image keeps ratio.
      thresh(float): If random ratio does not exceed the thresh, return original images and gt boxes, default is 0.5.
  
  Return:
      img(np.ndarray): Distorted image.
      data(dict): Image info and label info.
class_docstr_tok: ["Randomly","expand","images","and","gt","boxes","by","random","ratio",".","It","is","a","data","enhancement","operation","for","model","training",".","Args",":","max_ratio","(","float",")",":","Max","value","for","expansion","ratio",",","default","is","4.","fill","(","list",")",":","Initialize","the","pixel","value","of","the","image","with","the","input","fill","value",",","default","is","None",".","keep_ratio","(","bool",")",":","Whether","image","keeps","ratio",".","thresh","(","float",")",":","If","random","ratio","does","not","exceed","the","thresh",",","return","original","images","and","gt","boxes",",","default","is","0.5",".","Return",":","img","(","np.ndarray",")",":","Distorted","image",".","data","(","dict",")",":","Image","info","and","label","info","."]
code: def __call__(self, img: np.ndarray, data: dict):
      gtboxes = data["gt_boxes"]
  
      if random.random() > self.thresh:
          return img, data
      if self.max_ratio < 1.0:
          return img, data
      h, w, c = img.shape
  
      ratio_x = random.uniform(1, self.max_ratio)
      if self.keep_ratio:
          ratio_y = ratio_x
      else:
          ratio_y = random.uniform(1, self.max_ratio)
  
      oh = int(h * ratio_y)
      ow = int(w * ratio_x)
      off_x = random.randint(0, ow - w)
      off_y = random.randint(0, oh - h)
  
      out_img = np.zeros((oh, ow, c))
      if self.fill and len(self.fill) == c:
          for i in range(c):
              out_img[:, :, i] = self.fill[i] * 255.0
  
      out_img[off_y : off_y + h, off_x : off_x + w, :] = img
      gtboxes[:, 0] = ((gtboxes[:, 0] * w) + off_x) / float(ow)
      gtboxes[:, 1] = ((gtboxes[:, 1] * h) + off_y) / float(oh)
      gtboxes[:, 2] = gtboxes[:, 2] / ratio_x
      gtboxes[:, 3] = gtboxes[:, 3] / ratio_y
      data["gt_boxes"] = gtboxes
      img = out_img.astype("uint8")
  
      return img, data
  
imports: import os
  import random
  from typing import Callable
  import cv2
  import PIL
  import numpy
  import paddlehub.vision.transforms.functional
  from paddlehub.vision.utils import box_crop, box_iou_xywh
label_desc: Use image node_id 2 for calling the RandomExpand obj's underlying member method code with example usage: obj.__call__(img, data) and returns: img,  data, img,  data, img,  data