class_docstr: The post process for PSE.
code: def generate_box(self, score, label, shape):
      src_h, src_w, ratio_h, ratio_w = shape
      label_num = np.max(label) + 1
  
      boxes = []
      scores = []
      for i in range(1, label_num):
          ind = label == i
          points = np.array(np.where(ind)).transpose((1, 0))[:, ::-1]
  
          if points.shape[0] < self.min_area:
              label[ind] = 0
              continue
  
          score_i = np.mean(score[ind])
          if score_i < self.box_thresh:
              label[ind] = 0
              continue
  
          if self.box_type == "quad":
              rect = cv2.minAreaRect(points)
              bbox = cv2.boxPoints(rect)
          elif self.box_type == "poly":
              box_height = np.max(points[:, 1]) + 10
              box_width = np.max(points[:, 0]) + 10
  
              mask = np.zeros((box_height, box_width), np.uint8)
              mask[points[:, 1], points[:, 0]] = 255
  
              contours, _ = cv2.findContours(
                  mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE
              )
              bbox = np.squeeze(contours[0], 1)
          else:
              raise NotImplementedError
  
          bbox[:, 0] = np.clip(np.round(bbox[:, 0] / ratio_w), 0, src_w)
          bbox[:, 1] = np.clip(np.round(bbox[:, 1] / ratio_h), 0, src_h)
          boxes.append(bbox)
          scores.append(score_i)
      return boxes, scores
  
file_path: PaddleOCR/ppocr/postprocess/pse_postprocess/pse_postprocess.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import cv2
  import paddle
  from paddle.nn import functional
  from ppocr.postprocess.pse_postprocess.pse import pse
label_desc: Use image node_id 4 for calling the PSEPostProcess obj's underlying member method code with example usage: obj.generate_box(score, label, shape) and returns: boxes,  scores