code: def _get_resize_target(img, crop_target, do_crop=False)->TensorImageSize:
      "Calc size of `img` to fit in `crop_target` - adjust based on `do_crop`."
      if crop_target is None: return None
      ch,r,c = img.shape
      target_r,target_c = crop_target
      ratio = (min if do_crop else max)(r/target_r, c/target_c)
      return ch,int(round(r/ratio)),int(round(c/ratio)f _get_resize_target(img, crop_target, do_crop=False)->TensorImageSize:
      "Calc size of `img` to fit in `crop_target` - adjust based on `do_crop`."
      if crop_target is None: return None
      ch,r,c = img.shape
      target_r,target_c = crop_target
      ratio = (min if do_crop else max)(r/target_r, c/target_c)
      return ch,int(round(r/ratio)),int(round(c/ratio))
docs: Calc size of `img` to fit in `crop_target` - adjust based on `do_crop`.