class_docstr: Scale images.
  Args:
      short_size(float | int): Short size of an image will be scaled to the short_size.
      fixed_ratio(bool): Set whether to zoom according to a fixed ratio. default: True
      do_round(bool): Whether to round up when calculating the zoom ratio. default: False
      backend(str): Choose pillow or cv2 as the graphics processing backend. default: 'pillow'
class_docstr_tok: ["Scale","images",".","Args",":","short_size","(","float","|","int",")",":","Short","size","of","an","image","will","be","scaled","to","the","short_size",".","fixed_ratio","(","bool",")",":","Set","whether","to","zoom","according","to","a","fixed","ratio",".","default",":","True","do_round","(","bool",")",":","Whether","to","round","up","when","calculating","the","zoom","ratio",".","default",":","False","backend","(","str",")",":","Choose","pillow","or","cv2","as","the","graphics","processing","backend",".","default",":","'pillow","'"]
docstr: Performs resize operations.
  Args:
      imgs (Sequence[PIL.Image]): List where each item is a PIL.Image.
      For example, [PIL.Image0, PIL.Image1, PIL.Image2, ...]
  return:
      resized_imgs: List where each item is a PIL.Image after scaling.
docstr_tok: ["Performs","resize","operations",".","Args",":","imgs","(","Sequence","[","PIL.Image","]",")",":","List","where","each","item","is","a","PIL.Image",".","For","example",",","[","PIL.Image0",",","PIL.Image1",",","PIL.Image2",",","...","]","return",":","resized_imgs",":","List","where","each","item","is","a","PIL.Image","after","scaling","."]
code: def __call__(self, results):
      """
      Performs resize operations.
      Args:
          imgs (Sequence[PIL.Image]): List where each item is a PIL.Image.
          For example, [PIL.Image0, PIL.Image1, PIL.Image2, ...]
      return:
          resized_imgs: List where each item is a PIL.Image after scaling.
      """
      imgs = results["imgs"]
      resized_imgs = []
      for i in range(len(imgs)):
          img = imgs[i]
          if isinstance(img, np.ndarray):
              h, w, _ = img.shape
          elif isinstance(img, Image.Image):
              w, h = img.size
          else:
              raise NotImplementedError
  
          if w <= h:
              ow = self.short_size
              if self.fixed_ratio:  # default is True
                  oh = int(self.short_size * 4.0 / 3.0)
              elif not self.keep_ratio:  # no
                  oh = self.short_size
              else:
                  scale_factor = self.short_size / w
                  oh = (
                      int(h * float(scale_factor) + 0.5)
                      if self.do_round
                      else int(h * self.short_size / w)
                  )
                  ow = (
                      int(w * float(scale_factor) + 0.5)
                      if self.do_round
                      else int(w * self.short_size / h)
                  )
          else:
              oh = self.short_size
              if self.fixed_ratio:
                  ow = int(self.short_size * 4.0 / 3.0)
              elif not self.keep_ratio:  # no
                  ow = self.short_size
              else:
                  scale_factor = self.short_size / h
                  oh = (
                      int(h * float(scale_factor) + 0.5)
                      if self.do_round
                      else int(h * self.short_size / w)
                  )
                  ow = (
                      int(w * float(scale_factor) + 0.5)
                      if self.do_round
                      else int(w * self.short_size / h)
                  )
  
          if type(img) == np.ndarray:
              img = Image.fromarray(img, mode="RGB")
  
          if self.backend == "pillow":
              resized_imgs.append(img.resize((ow, oh), Image.BILINEAR))
          elif self.backend == "cv2" and (self.keep_ratio is not None):
              resized_imgs.append(
                  cv2.resize(
                      img, (ow, oh), interpolation=cv2.INTER_LINEAR
                  )
              )
          else:
              resized_imgs.append(
                  Image.fromarray(
                      cv2.resize(
                          np.asarray(img),
                          (ow, oh),
                          interpolation=cv2.INTER_LINEAR,
                      )
                  )
              )
      results["imgs"] = resized_imgs
      return results
  
imports: import cv2
  import numpy
  from PIL import Image
  import paddle
label_desc: Use image node_id 2 for calling the Scale obj's underlying member method code with example usage: obj.__call__(results) and returns: results