code: def scale_and_center_crop(im, scale_size, crop_size):
      """Performs scaling and center cropping (used for testing)."""
      h, w = im.shape[:2]
      if w < h and w != scale_size:
          w, h = scale_size, int(h / w * scale_size)
          im = cv2.resize(im, (w, h), interpolation=cv2.INTER_LINEAR)
      elif h <= w and h != scale_size:
          w, h = int(w / h * scale_size), scale_size
          im = cv2.resize(im, (w, h), interpolation=cv2.INTER_LINEAR)
      x = ceil((w - crop_size) / 2)
      y = ceil((h - crop_size) / 2)
      return im[y : (y + crop_size), x : (x + crop_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 1 for calling a global function with example usage: scale_and_center_crop(im, scale_size, crop_size) and returns: im