code: def resize_norm_img_sar(
      self, img, image_shape, width_downsample_ratio=0.25
  ):
      imgC, imgH, imgW_min, imgW_max = image_shape
      h = img.shape[0]
      w = img.shape[1]
      valid_ratio = 1.0
      # make sure new_width is an integral multiple of width_divisor.
      width_divisor = int(1 / width_downsample_ratio)
      # resize
      ratio = w / float(h)
      resize_w = math.ceil(imgH * ratio)
      if resize_w % width_divisor != 0:
          resize_w = round(resize_w / width_divisor) * width_divisor
      if imgW_min is not None:
          resize_w = max(imgW_min, resize_w)
      if imgW_max is not None:
          valid_ratio = min(1.0, 1.0 * resize_w / imgW_max)
          resize_w = min(imgW_max, resize_w)
      resized_image = cv2.resize(img, (resize_w, imgH))
      resized_image = resized_image.astype("float32")
      # norm
      if image_shape[0] == 1:
          resized_image = resized_image / 255
          resized_image = resized_image[np.newaxis, :]
      else:
          resized_image = resized_image.transpose((2, 0, 1)) / 255
      resized_image -= 0.5
      resized_image /= 0.5
      resize_shape = resized_image.shape
      padding_im = -1.0 * np.ones(
          (imgC, imgH, imgW_max), dtype=np.float32
      )
      padding_im[:, :, 0:resize_w] = resized_image
      pad_shape = padding_im.shape
  
      return padding_im, resize_shape, pad_shape, valid_ratio
  
imports: import os
  import sys
  from PIL import Image
  import cv2
  import numpy
  import math
  import time
  import traceback
  import paddle
  import tools.infer.utility
  from ppocr.postprocess import build_post_process
  from ppocr.utils.logging import get_logger
  from ppocr.utils.utility import get_image_file_list, check_and_read
label_desc: Use image node_id 7 for calling the TextRecognizer obj's underlying member method code with example usage: obj.resize_norm_img_sar(img, image_shape, width_downsample_ratio) and returns: padding_im,  resize_shape,  pad_shape,  valid_ratio