code: def __call__(self, im):
      if not isinstance(im, np.ndarray):
          raise TypeError("{}: image type is not numpy.".format(self))
      if len(im.shape) != 3:
          raise ValueError(
              "{}: image is not 3-dimensional.".format(self)
          )
      im_shape = im.shape
      im_size_min = np.min(im_shape[0:2])
      im_size_max = np.max(im_shape[0:2])
      if isinstance(self.target_size, list):
          # Case for multi-scale training
          selected_size = random.choice(self.target_size)
      else:
          selected_size = self.target_size
      if float(im_size_min) == 0:
          raise ZeroDivisionError(
              "{}: min size of image is 0".format(self)
          )
      if self.max_size != 0:
          im_scale = float(selected_size) / float(im_size_min)
          # Prevent the biggest axis from being more than max_size
          if np.round(im_scale * im_size_max) > self.max_size:
              im_scale = float(self.max_size) / float(im_size_max)
          im_scale_x = im_scale
          im_scale_y = im_scale
  
          resize_w = im_scale_x * float(im_shape[1])
          resize_h = im_scale_y * float(im_shape[0])
          im_info = [resize_h, resize_w, im_scale]
      else:
          im_scale_x = float(selected_size) / float(im_shape[1])
          im_scale_y = float(selected_size) / float(im_shape[0])
  
          resize_w = selected_size
          resize_h = selected_size
  
      if self.use_cv2:
          im = cv2.resize(
              im,
              None,
              None,
              fx=im_scale_x,
              fy=im_scale_y,
              interpolation=self.interp,
          )
      else:
          if self.max_size != 0:
              raise TypeError(
                  "If you set max_size to cap the maximum size of image,"
                  "please set use_cv2 to True to resize the image."
              )
          im = im.astype("uint8")
          im = Image.fromarray(im)
          im = im.resize((int(resize_w), int(resize_h)), self.interp)
          im = np.array(im)
  
      return im
  
imports: from __future__ import absolute_import
  from __future__ import print_function
  from __future__ import division
  import os
  import random
  import cv2
  import numpy
  from PIL import Image
label_desc: Use image node_id 2 for calling the ResizeImage obj's underlying member method code with example usage: obj.__call__(im) and returns: im