class_docstr: Resize an image.
  
  Args:
      target_size (list|tuple, optional): The target size of image. Default: (512, 512).
      interp (str, optional): The interpolation mode of resize is consistent with opencv.
          ['NEAREST', 'LINEAR', 'CUBIC', 'AREA', 'LANCZOS4', 'RANDOM']. Note that when it is
          'RANDOM', a random interpolation mode would be specified. Default: "LINEAR".
  
  Raises:
      TypeError: When 'target_size' type is neither list nor tuple.
      ValueError: When "interp" is out of pre-defined methods ('NEAREST', 'LINEAR', 'CUBIC',
      'AREA', 'LANCZOS4', 'RANDOM').
code: def __init__(
      self,
      target_size: Union[List[int], Tuple[int]] = (512, 512),
      interp: str = "LINEAR",
  ):
      self.interp = interp
      if not (interp == "RANDOM" or interp in self.interp_dict):
          raise ValueError(
              "`interp` should be one of {}".format(
                  self.interp_dict.keys()
              )
          )
      if isinstance(target_size, list) or isinstance(
          target_size, tuple
      ):
          if len(target_size) != 2:
              raise ValueError(
                  "`target_size` should include 2 elements, but it is {}".format(
                      target_size
                  )
              )
      else:
          raise TypeError(
              "Type of `target_size` is invalid. It should be list or tuple, but it is {}".format(
                  type(target_size)
              )
          )
  
      self.target_size = target_size
  
imports: import os
  import random
  from typing import Callable, Union, List, Tuple
  import cv2
  import numpy
  from PIL import Image
  import paddlehub.vision.functional
label_desc: Use image node_id 1 to create a new Resize object  with example: obj = Resize(target_size, interp)