class_docstr: Padding input image if crop size is greater than image size. Otherwise, crop the input image to given size.
  
  Args:
      crop_size(Union[List[int], Tuple[int], int]): Targeted image size.
      im_padding_value(list): Border value for 3 channels, default is [127.5, 127.5, 127.5].
class_docstr_tok: ["Padding","input","image","if","crop","size","is","greater","than","image","size",".","Otherwise",",","crop","the","input","image","to","given","size",".","Args",":","crop_size","(","Union","[","List","[","int","]",",","Tuple","[","int","]",",","int","]",")",":","Targeted","image","size",".","im_padding_value","(","list",")",":","Border","value","for","3","channels",",","default","is","[","127.5",",","127.5",",","127.5","]","."]
code: def __call__(self, im):
      if isinstance(self.crop_size, int):
          crop_width = self.crop_size
          crop_height = self.crop_size
      else:
          crop_width = self.crop_size[0]
          crop_height = self.crop_size[1]
  
      img_height = im.shape[0]
      img_width = im.shape[1]
  
      if img_height == crop_height and img_width == crop_width:
          return im
      else:
          pad_height = max(crop_height - img_height, 0)
          pad_width = max(crop_width - img_width, 0)
          if pad_height > 0 or pad_width > 0:
              im = cv2.copyMakeBorder(
                  im,
                  0,
                  pad_height,
                  0,
                  pad_width,
                  cv2.BORDER_CONSTANT,
                  value=self.im_padding_value,
              )
  
          if crop_height > 0 and crop_width > 0:
              h_off = np.random.randint(img_height - crop_height + 1)
              w_off = np.random.randint(img_width - crop_width + 1)
  
              im = im[
                  h_off : (crop_height + h_off),
                  w_off : (w_off + crop_width),
                  :,
              ]
  
          return im
  
imports: import random
  from typing import Callable, Union, List, Tuple
  import cv2
  import PIL
  import numpy
  import paddlehub.vision.functional
label_desc: Use image node_id 2 for calling the RandomPaddingCrop obj's underlying member method code with example usage: obj.__call__(im) and returns: im, im