code: def get_size_with_aspect_ratio(image_size, size, max_size=None):
      w, h = image_size
      if max_size is not None:
          min_original_size = float(min((w, h)))
          max_original_size = float(max((w, h)))
          if max_original_size / min_original_size * size > max_size:
              size = int(
                  round(
                      max_size * min_original_size / max_original_size
                  )
              )
  
      if (w <= h and w == size) or (h <= w and h == size):
          return (w, h)
  
      if w < h:
          ow = size
          oh = int(size * h / w)
      else:
          oh = size
          ow = int(size * w / h)
  
      return (ow, oh)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from ppdet.core.workspace import register, create, merge_config
  import paddle
  import numpy
  import paddle
  import paddle.nn.functional
  from ppdet.core.workspace import register, create
  from ppdet.utils.logger import setup_logger
  from ppdet.modeling.ssod.utils import filter_invalid
  from .multi_stream_detector import MultiSteamDetector
label_desc: Use image node_id 3 for calling a global function with example usage: get_size_with_aspect_ratio(image_size, size, max_size) and returns: ow,  oh, w,  h