code: def random_sized_crop(im, size, area_frac=0.08, max_iter=10):
      """Performs Inception-style cropping (used for training)."""
      h, w = im.shape[:2]
      area = h * w
      for _ in range(max_iter):
          target_area = np.random.uniform(area_frac, 1.0) * area
          aspect_ratio = np.random.uniform(3.0 / 4.0, 4.0 / 3.0)
          w_crop = round(sqrt(target_area * aspect_ratio))
          h_crop = round(sqrt(target_area / aspect_ratio))
          if np.random.uniform() < 0.5:
              w_crop, h_crop = h_crop, w_crop
          if h_crop <= h and w_crop <= w:
              y = 0 if h_crop == h else np.random.randint(0, h - h_crop)
              x = 0 if w_crop == w else np.random.randint(0, w - w_crop)
              im = im[y : (y + h_crop), x : (x + w_crop), :]
              return cv2.resize(
                  im, (size, size), interpolation=cv2.INTER_LINEAR
              )
      return scale_and_center_crop(im, size, size)
  
file_path: pycls/pycls/datasets/transforms.py
imports: from math import ceil, sqrt
  import cv2
  import numpy
  from PIL import Image
  from pycls.datasets.augment import make_augment
label_desc: Use image node_id 2 for calling a global function with example usage: random_sized_crop(im, size, area_frac, max_iter) and returns: scale_and_center_crop, cv2