code: def _recognize_text(self, img_list):
      img_num = len(img_list)
      # Calculate the aspect ratio of all text bars
      width_list = []
      for img in img_list:
          width_list.append(img.shape[1] / float(img.shape[0]))
      # Sorting can speed up the recognition process
      indices = np.argsort(np.array(width_list))
  
      rec_res = [["", 0.0]] * img_num
      batch_num = 30
      for beg_img_no in range(0, img_num, batch_num):
          end_img_no = min(img_num, beg_img_no + batch_num)
          norm_img_batch = []
          max_wh_ratio = 0
          for ino in range(beg_img_no, end_img_no):
              h, w = img_list[indices[ino]].shape[0:2]
              wh_ratio = w * 1.0 / h
              max_wh_ratio = max(max_wh_ratio, wh_ratio)
          for ino in range(beg_img_no, end_img_no):
              norm_img = self.resize_norm_img_rec(
                  img_list[indices[ino]], max_wh_ratio
              )
              norm_img = norm_img[np.newaxis, :]
              norm_img_batch.append(norm_img)
  
          norm_img_batch = np.concatenate(norm_img_batch, axis=0)
          norm_img_batch = norm_img_batch.copy()
  
          self.rec_input_tensor.copy_from_cpu(norm_img_batch)
          self.rec_predictor.run()
  
          rec_idx_batch = self.rec_output_tensors[0].copy_to_cpu()
          rec_idx_lod = self.rec_output_tensors[0].lod()[0]
          predict_batch = self.rec_output_tensors[1].copy_to_cpu()
          predict_lod = self.rec_output_tensors[1].lod()[0]
          for rno in range(len(rec_idx_lod) - 1):
              beg = rec_idx_lod[rno]
              end = rec_idx_lod[rno + 1]
              rec_idx_tmp = rec_idx_batch[beg:end, 0]
              preds_text = self.char_ops.decode(rec_idx_tmp)
              beg = predict_lod[rno]
              end = predict_lod[rno + 1]
              probs = predict_batch[beg:end, :]
              ind = np.argmax(probs, axis=1)
              blank = probs.shape[1]
              valid_ind = np.where(ind != (blank - 1))[0]
              if len(valid_ind) == 0:
                  continue
              score = np.mean(probs[valid_ind, ind[valid_ind]])
              # rec_res.append([preds_text, score])
              rec_res[indices[beg_img_no + rno]] = [preds_text, score]
  
      return rec_res
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import ast
  import copy
  import math
  import os
  import time
  import cv2
  import numpy
  import paddle
  from chinese_ocr_db_crnn_server.character import CharacterOps
  from chinese_ocr_db_crnn_server.utils import base64_to_cv2
  from chinese_ocr_db_crnn_server.utils import draw_ocr
  from chinese_ocr_db_crnn_server.utils import get_image_ext
  from chinese_ocr_db_crnn_server.utils import sorted_boxes
  from paddle.inference import Config
  from paddle.inference import create_predictor
  from PIL import Image
  import paddlehub
  from paddlehub.module.module import moduleinfo
  from paddlehub.module.module import runnable
  from paddlehub.module.module import serving
  from paddlehub.utils.log import logger
label_desc: Use image node_id 12 for calling the ChineseOCRDBCRNNServer obj's underlying member method code with example usage: obj._recognize_text(img_list) and returns: rec_res