code: def add_resize(img, sf=4):
      rnum = np.random.rand()
      if rnum > 0.8:  # up
          sf1 = random.uniform(1, 2)
      elif rnum < 0.7:  # down
          sf1 = random.uniform(0.5 / sf, 1)
      else:
          sf1 = 1.0
      img = cv2.resize(
          img,
          (int(sf1 * img.shape[1]), int(sf1 * img.shape[0])),
          interpolation=random.choice([1, 2, 3]),
      )
      img = np.clip(img, 0.0, 1.0)
  
      return img
  
imports: import random
  from functools import partial
  import albumentations
  import cv2
  import ldm.modules.image_degradation.utils_image
  import numpy
  import scipy
  import scipy.stats
  import torch
  from scipy import ndimage
  from scipy.interpolate import interp2d
  from scipy.linalg import orth
label_desc: Use image node_id 17 for calling a global function with example usage: add_resize(img, sf) and returns: img