class_docstr: DB pre-process for Test mode
class_docstr_tok: ["DB","pre-process","for","Test","mode"]
docstr: resize image to a size multiple of 32 which is required by the network
  args:
      img(array): array with shape [h, w, c]
  return(tuple):
      img, (ratio_h, ratio_w)
docstr_tok: ["resize","image","to","a","size","multiple","of","32","which","is","required","by","the","network","args",":","img","(","array",")",":","array","with","shape","[","h",",","w",",","c","]","return","(","tuple",")",":","img",",","(","ratio_h",",","ratio_w",")"]
code: def resize_image_type0(self, im):
      """
      resize image to a size multiple of 32 which is required by the network
      args:
          img(array): array with shape [h, w, c]
      return(tuple):
          img, (ratio_h, ratio_w)
      """
      max_side_len = self.max_side_len
      h, w, _ = im.shape
  
      resize_w = w
      resize_h = h
  
      # limit the max side
      if max(resize_h, resize_w) > max_side_len:
          if resize_h > resize_w:
              ratio = float(max_side_len) / resize_h
          else:
              ratio = float(max_side_len) / resize_w
      else:
          ratio = 1.0
      resize_h = int(resize_h * ratio)
      resize_w = int(resize_w * ratio)
      if resize_h % 32 == 0:
          resize_h = resize_h
      elif resize_h // 32 <= 1:
          resize_h = 32
      else:
          resize_h = (resize_h // 32 - 1) * 32
      if resize_w % 32 == 0:
          resize_w = resize_w
      elif resize_w // 32 <= 1:
          resize_w = 32
      else:
          resize_w = (resize_w // 32 - 1) * 32
      try:
          if int(resize_w) <= 0 or int(resize_h) <= 0:
              return None, (None, None)
          im = cv2.resize(im, (int(resize_w), int(resize_h)))
      except:
          print(im.shape, resize_w, resize_h)
          sys.exit(0)
      ratio_h = resize_h / float(h)
      ratio_w = resize_w / float(w)
      return im, (ratio_h, ratio_w)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  import cv2
  import numpy
  import pyclipper
  from PIL import ImageDraw
  from shapely.geometry import Polygon
label_desc: Use image node_id 2 for calling the DBProcessTest obj's underlying member method code with example usage: obj.resize_image_type0(im) and returns: im,  ratio_h,  ratio_w, None,  None,  None