class_docstr: Resize and Keep Aspect Ratio
      
class_docstr_tok: ["Resize","and","Keep","Aspect","Ratio"]
docstr: Args:
      img (PIL Image): Image to be cropped and resized.
  
  Returns:
      PIL Image: Resized, padded to at least target size, possibly cropped to exactly target size
docstr_tok: ["Args",":","img","(","PIL","Image",")",":","Image","to","be","cropped","and","resized",".","Returns",":","PIL","Image",":","Resized",",","padded","to","at","least","target","size",",","possibly","cropped","to","exactly","target","size"]
code: def __call__(self, img):
      """
      Args:
          img (PIL Image): Image to be cropped and resized.
  
      Returns:
          PIL Image: Resized, padded to at least target size, possibly cropped to exactly target size
      """
      size = self.get_params(
          img,
          self.size,
          self.longest,
          self.random_scale_prob,
          self.random_scale_range,
          self.random_scale_area,
          self.random_aspect_prob,
          self.random_aspect_range,
      )
      if isinstance(self.interpolation, (tuple, list)):
          interpolation = random.choice(self.interpolation)
      else:
          interpolation = self.interpolation
      img = F.resize(img, size, interpolation)
      return img
  
imports: import math
  import numbers
  import random
  import warnings
  from typing import List, Sequence, Tuple, Union
  import torch
  import torchvision.transforms.functional
  from PIL import Image
  import numpy
label_desc: Use image node_id 3 for calling the ResizeKeepRatio obj's underlying member method code with example usage: obj.__call__(img) and returns: img