parameters: (im, max_side_len=2400)
return_statement: return im, (ratio_h, ratio_w)
docstring: resize image to a size multiple of 32 which is required by the network
      :param im: the resized image
      :param max_side_len: limit of max image size to avoid out of memory in gpu
      :return: the resized image and the resize ratio
docstring_summary: resize image to a size multiple of 32 which is required by the network
      :param im: the resized image
      :param max_side_len: limit of max image size to avoid out of memory in gpu
      :return: the resized image and the resize ratio
docstring_tokens: resize image to a size multiple of 32 which is required by the network : param im : the resized image : param max_side_len : limit of max image size to avoid out of memory in gpu : return : the resized image and the resize ratio
function: def resize_image(im, max_side_len=2400):
      '''
      resize image to a size multiple of 32 which is required by the network
      :param im: the resized image
      :param max_side_len: limit of max image size to avoid out of memory in gpu
      :return: the resized image and the resize ratio
      '''
      h, w, _ = im.shape
  
      resize_w = w
      resize_h = h
  
      # limit the max side
      if max(resize_h, resize_w) > max_side_len:
          ratio = float(max_side_len) / resize_h if resize_h > resize_w else float(max_side_len) / resize_w
      else:
          ratio = 1.
      resize_h = int(resize_h * ratio)
      resize_w = int(resize_w * ratio)
  
      resize_h = resize_h if resize_h % 32 == 0 else (resize_h // 32 - 1) * 32
      resize_w = resize_w if resize_w % 32 == 0 else (resize_w // 32 - 1) * 32
      resize_h = max(32, resize_h)
      resize_w = max(32, resize_w)
      im = cv2.resize(im, (int(resize_w), int(resize_h)))
  
      ratio_h = resize_h / float(h)
      ratio_w = resize_w / float(w)
  
      return im, (ratio_h, ratio_w)
function_tokens: def resize_image ( im , max_side_len = 2400 ) : h , w , _ = im . shape resize_w = w resize_h = h # limit the max side if max ( resize_h , resize_w ) > max_side_len : ratio = float ( max_side_len ) / resize_h if resize_h > resize_w else float ( max_side_len ) / resize_w else : ratio = 1. resize_h = int ( resize_h * ratio ) resize_w = int ( resize_w * ratio ) resize_h = resize_h if resize_h % 32 == 0 else ( resize_h // 32 - 1 ) * 32 resize_w = resize_w if resize_w % 32 == 0 else ( resize_w // 32 - 1 ) * 32 resize_h = max ( 32 , resize_h ) resize_w = max ( 32 , resize_w ) im = cv2 . resize ( im , ( int ( resize_w ) , int ( resize_h ) ) ) ratio_h = resize_h / float ( h ) ratio_w = resize_w / float ( w ) return im , ( ratio_h , ratio_w )