code: def preprocess(self, img):
      img = (img.astype("float32") * self.scale - self.mean) / self.std
      img_height, img_width, channel = img.shape
      assert channel == 3, "Please use an rgb image."
      ratio = img_width / float(img_height)
      if math.ceil(self.height * ratio) > self.width:
          resized_w = self.width
      else:
          resized_w = int(math.ceil(self.height * ratio))
      img = cv2.resize(img, (resized_w, self.height))
  
      new_img = np.zeros([self.height, self.width, 3]).astype("float32")
      new_img[:, 0:resized_w, :] = img
      img = new_img.transpose((2, 0, 1))
      img = img[np.newaxis, :, :, :]
      return paddle.to_tensor(img)
  
file_path: PaddleOCR/StyleText/engine/predictors.py
imports: import numpy
  import cv2
  import math
  import paddle
  from arch import style_text_rec
  from utils.sys_funcs import check_gpu
  from utils.logging import get_logger
label_desc: Use image node_id 5 for calling the StyleTextRecPredictor obj's underlying member method code with example usage: obj.preprocess(img) and returns: paddle