code: def crop_resize(img, box, image_size):
      if isinstance(img, np.ndarray):
          img = img[box[1] : box[3], box[0] : box[2]]
          out = cv2.resize(
              img,
              (image_size, image_size),
              interpolation=cv2.INTER_AREA,
          ).copy()
      elif isinstance(img, torch.Tensor):
          img = img[box[1] : box[3], box[0] : box[2]]
          out = (
              imresample(
                  img.permute(2, 0, 1).unsqueeze(0).float(),
                  (image_size, image_size),
              )
              .byte()
              .squeeze(0)
              .permute(1, 2, 0)
          )
      else:
          out = (
              img.crop(box)
              .copy()
              .resize((image_size, image_size), Image.BILINEAR)
          )
      return out
  
imports: import torch
  from torch.nn.functional import interpolate
  from torchvision.transforms import functional
  from torchvision.ops.boxes import batched_nms
  from PIL import Image
  import numpy
  import os
  import math
label_desc: Use image node_id 10 for calling a global function with example usage: crop_resize(img, box, image_size) and returns: out