code: def random_sized_crop(image, size, area_frac=0.08):
      """
      Perform random sized cropping on the given image. Random crop with size
          8% - 100% image area and aspect ratio in [3/4, 4/3].
      Args:
          image (array): image to crop.
          size (int): size to crop.
          area_frac (float): area of fraction.
      Returns:
          (array): cropped image.
      """
      for _ in range(0, 10):
          height = image.shape[0]
          width = image.shape[1]
          area = height * width
          target_area = np.random.uniform(area_frac, 1.0) * area
          aspect_ratio = np.random.uniform(3.0 / 4.0, 4.0 / 3.0)
          w = int(round(math.sqrt(float(target_area) * aspect_ratio)))
          h = int(round(math.sqrt(float(target_area) / aspect_ratio)))
          if np.random.uniform() < 0.5:
              w, h = h, w
          if h <= height and w <= width:
              if height == h:
                  y_offset = 0
              else:
                  y_offset = np.random.randint(0, height - h)
              if width == w:
                  x_offset = 0
              else:
                  x_offset = np.random.randint(0, width - w)
              y_offset = int(y_offset)
              x_offset = int(x_offset)
              cropped = image[
                  y_offset : y_offset + h, x_offset : x_offset + w, :
              ]
              assert (
                  cropped.shape[0] == h and cropped.shape[1] == w
              ), "Wrong crop size"
              cropped = cv2.resize(
                  cropped, (size, size), interpolation=cv2.INTER_LINEAR
              )
              return cropped.astype(np.float32)
      return center_crop(size, scale(size, image))
  
imports: import math
  import numpy
  import cv2
label_desc: Use image node_id 20 for calling a global function with example usage: random_sized_crop(image, size, area_frac) and returns: center_crop, cropped