docstr: Get the text box in the predicted images.
  Args:
      images (list(numpy.ndarray)): images data, shape of each is [H, W, C]. If images not paths
      paths (list[str]): The paths of images. If paths not images
      use_gpu (bool): Whether to use gpu. Default false.
      output_dir (str): The directory to store output images.
      visualization (bool): Whether to save image or not.
      box_thresh(float): the threshold of the detected text box's confidence
      det_db_unclip_ratio(float): unclip ratio for post processing in DB detection.
      det_db_score_mode(str): method to calc the final det score, one of fast(using box) and slow(using poly).
  Returns:
      res (list): The result of text detection box and save path of images.
docstr_tok: ["Get","the","text","box","in","the","predicted","images",".","Args",":","images","(","list","(","numpy.ndarray",")",")",":","images","data",",","shape","of","each","is","[","H",",","W",",","C","]",".","If","images","not","paths","paths","(","list","[","str","]",")",":","The","paths","of","images",".","If","paths","not","images","use_gpu","(","bool",")",":","Whether","to","use","gpu",".","Default","false",".","output_dir","(","str",")",":","The","directory","to","store","output","images",".","visualization","(","bool",")",":","Whether","to","save","image","or","not",".","box_thresh","(","float",")",":","the","threshold","of","the","detected","text","box","'s","confidence","det_db_unclip_ratio","(","float",")",":","unclip","ratio","for","post","processing","in","DB","detection",".","det_db_score_mode","(","str",")",":","method","to","calc","the","final","det","score",",","one","of","fast","(","using","box",")","and","slow","(","using","poly",")",".","Returns",":","res","(","list",")",":","The","result","of","text","detection","box","and","save","path","of","images","."]
code: def detect_text(
      self,
      images=[],
      paths=[],
      use_gpu=False,
      output_dir="detection_result",
      visualization=False,
      box_thresh=0.6,
      det_db_unclip_ratio=1.5,
      det_db_score_mode="fast",
  ):
      """
      Get the text box in the predicted images.
      Args:
          images (list(numpy.ndarray)): images data, shape of each is [H, W, C]. If images not paths
          paths (list[str]): The paths of images. If paths not images
          use_gpu (bool): Whether to use gpu. Default false.
          output_dir (str): The directory to store output images.
          visualization (bool): Whether to save image or not.
          box_thresh(float): the threshold of the detected text box's confidence
          det_db_unclip_ratio(float): unclip ratio for post processing in DB detection.
          det_db_score_mode(str): method to calc the final det score, one of fast(using box) and slow(using poly).
      Returns:
          res (list): The result of text detection box and save path of images.
      """
      self.check_requirements()
  
      from .processor import (
          DBProcessTest,
          DBPostProcess,
          draw_boxes,
          get_image_ext,
      )
  
      if use_gpu:
          try:
              _places = os.environ["CUDA_VISIBLE_DEVICES"]
              int(_places[0])
          except:
              raise RuntimeError(
                  "Environment Variable CUDA_VISIBLE_DEVICES is not set correctly. If you wanna use gpu, please set CUDA_VISIBLE_DEVICES via export CUDA_VISIBLE_DEVICES=cuda_device_id."
              )
  
      if images != [] and isinstance(images, list) and paths == []:
          predicted_data = images
      elif images == [] and isinstance(paths, list) and paths != []:
          predicted_data = self.read_images(paths)
      else:
          raise TypeError(
              "The input data is inconsistent with expectations."
          )
  
      assert (
          predicted_data != []
      ), "There is not any image to be predicted. Please check the input data."
  
      preprocessor = DBProcessTest(params={"max_side_len": 960})
      postprocessor = DBPostProcess(
          params={
              "thresh": 0.3,
              "box_thresh": box_thresh,
              "max_candidates": 1000,
              "unclip_ratio": det_db_unclip_ratio,
              "det_db_score_mode": det_db_score_mode,
          }
      )
  
      all_imgs = []
      all_ratios = []
      all_results = []
      for original_image in predicted_data:
          ori_im = original_image.copy()
          im, ratio_list = preprocessor(original_image)
          res = {"save_path": ""}
          if im is None:
              res["data"] = []
  
          else:
              im = im.copy()
              self.input_tensor.copy_from_cpu(im)
              self.predictor.run()
  
              outputs = []
              for output_tensor in self.output_tensors:
                  output = output_tensor.copy_to_cpu()
                  outputs.append(output)
  
              outs_dict = {}
              outs_dict["maps"] = outputs[0]
  
              dt_boxes_list = postprocessor(outs_dict, [ratio_list])
              dt_boxes = dt_boxes_list[0]
              boxes = self.filter_tag_det_res(
                  dt_boxes_list[0], original_image.shape
              )
              res["data"] = boxes.astype(np.int64).tolist()
              all_imgs.append(im)
              all_ratios.append(ratio_list)
              if visualization:
                  img = Image.fromarray(
                      cv2.cvtColor(original_image, cv2.COLOR_BGR2RGB)
                  )
                  draw_img = draw_boxes(img, boxes)
                  draw_img = np.array(draw_img)
                  if not os.path.exists(output_dir):
                      os.makedirs(output_dir)
                  ext = get_image_ext(original_image)
                  saved_name = "ndarray_{}{}".format(time.time(), ext)
                  cv2.imwrite(
                      os.path.join(output_dir, saved_name),
                      draw_img[:, :, ::-1],
                  )
                  res["save_path"] = os.path.join(
                      output_dir, saved_name
                  )
  
          all_results.append(res)
  
      return all_results
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import ast
  import base64
  import os
  import time
  from io import BytesIO
  import cv2
  import numpy
  import paddle.inference
  from PIL import Image
  from paddlehub.module.module import moduleinfo
  from paddlehub.module.module import runnable
  from paddlehub.module.module import serving
  from paddlehub.utils.utils import logger
label_desc: Use image node_id 9 for calling the ChPPOCRv3Det obj's underlying member method code with example usage: obj.detect_text(images, paths, use_gpu, output_dir, visualization, box_thresh, det_db_unclip_ratio, det_db_score_mode) and returns: all_results