class_docstr: resize image by target_size and max_size
  Args:
      target_size (int): the target size of image
      keep_ratio (bool): whether keep_ratio or not, default true
      interp (int): method of resize
class_docstr_tok: ["resize","image","by","target_size","and","max_size","Args",":","target_size","(","int",")",":","the","target","size","of","image","keep_ratio","(","bool",")",":","whether","keep_ratio","or","not",",","default","true","interp","(","int",")",":","method","of","resize"]
docstr: Args:
      im (np.ndarray): image (np.ndarray)
  Returns:
      im_scale_x: the resize ratio of X
      im_scale_y: the resize ratio of Y
docstr_tok: ["Args",":","im","(","np.ndarray",")",":","image","(","np.ndarray",")","Returns",":","im_scale_x",":","the","resize","ratio","of","X","im_scale_y",":","the","resize","ratio","of","Y"]
code: def generate_scale(self, im):
      """
      Args:
          im (np.ndarray): image (np.ndarray)
      Returns:
          im_scale_x: the resize ratio of X
          im_scale_y: the resize ratio of Y
      """
      origin_shape = im.shape[:2]
      im_c = im.shape[2]
      if self.keep_ratio:
          im_size_min = np.min(origin_shape)
          im_size_max = np.max(origin_shape)
          target_size_min = np.min(self.target_size)
          target_size_max = np.max(self.target_size)
          im_scale = float(target_size_min) / float(im_size_min)
          if np.round(im_scale * im_size_max) > target_size_max:
              im_scale = float(target_size_max) / float(im_size_max)
          im_scale_x = im_scale
          im_scale_y = im_scale
      else:
          resize_h, resize_w = self.target_size
          im_scale_y = resize_h / float(origin_shape[0])
          im_scale_x = resize_w / float(origin_shape[1])
      return im_scale_y, im_scale_x
  
imports: import cv2
  import numpy
label_desc: Use image node_id 3 for calling the Resize obj's underlying member method code with example usage: obj.generate_scale(im) and returns: im_scale_y,  im_scale_x