code: def get_score_C(gt_label, text, pred_bboxes):
      """
      get score for CentripetalText (CT) prediction.
      """
      check_install("Polygon", "Polygon3")
      import Polygon as plg
  
      def gt_reading_mod(gt_label, text):
          """This helper reads groundtruths from mat files"""
          groundtruths = []
          nbox = len(gt_label)
          for i in range(nbox):
              label = {
                  "transcription": text[i][0],
                  "points": gt_label[i].numpy(),
              }
              groundtruths.append(label)
  
          return groundtruths
  
      def get_union(pD, pG):
          areaA = pD.area()
          areaB = pG.area()
          return areaA + areaB - get_intersection(pD, pG)
  
      def get_intersection(pD, pG):
          pInt = pD & pG
          if len(pInt) == 0:
              return 0
          return pInt.area()
  
      def detection_filtering(detections, groundtruths, threshold=0.5):
          for gt in groundtruths:
              point_num = gt["points"].shape[1] // 2
              if gt["transcription"] == "###" and (point_num > 1):
                  gt_p = (
                      np.array(gt["points"])
                      .reshape(point_num, 2)
                      .astype("int32")
                  )
                  gt_p = plg.Polygon(gt_p)
  
                  for det_id, detection in enumerate(detections):
                      det_y = detection[0::2]
                      det_x = detection[1::2]
  
                      det_p = np.concatenate(
                          (np.array(det_x), np.array(det_y))
                      )
                      det_p = det_p.reshape(2, -1).transpose()
                      det_p = plg.Polygon(det_p)
  
                      try:
                          det_gt_iou = (
                              get_intersection(det_p, gt_p)
                              / det_p.area()
                          )
                      except:
                          print(det_x, det_y, gt_p)
                      if det_gt_iou > threshold:
                          detections[det_id] = []
  
                  detections[:] = [
                      item for item in detections if item != []
                  ]
          return detections
  
      def sigma_calculation(det_p, gt_p):
          """
          sigma = inter_area / gt_area
          """
          if gt_p.area() == 0.0:
              return 0
          return get_intersection(det_p, gt_p) / gt_p.area()
  
      def tau_calculation(det_p, gt_p):
          """
          tau = inter_area / det_area
          """
          if det_p.area() == 0.0:
              return 0
          return get_intersection(det_p, gt_p) / det_p.area()
  
      detections = []
  
      for item in pred_bboxes:
          detections.append(item[:, ::-1].reshape(-1))
  
      groundtruths = gt_reading_mod(gt_label, text)
  
      detections = detection_filtering(
          detections, groundtruths
      )  # filters detections overlapping with DC area
  
      for idx in range(len(groundtruths) - 1, -1, -1):
          # NOTE: source code use 'orin' to indicate '#', here we use 'anno',
          # which may cause slight drop in fscore, about 0.12
          if groundtruths[idx]["transcription"] == "###":
              groundtruths.pop(idx)
  
      local_sigma_table = np.zeros((len(groundtruths), len(detections)))
      local_tau_table = np.zeros((len(groundtruths), len(detections)))
  
      for gt_id, gt in enumerate(groundtruths):
          if len(detections) > 0:
              for det_id, detection in enumerate(detections):
                  point_num = gt["points"].shape[1] // 2
  
                  gt_p = (
                      np.array(gt["points"])
                      .reshape(point_num, 2)
                      .astype("int32")
                  )
                  gt_p = plg.Polygon(gt_p)
  
                  det_y = detection[0::2]
                  det_x = detection[1::2]
  
                  det_p = np.concatenate(
                      (np.array(det_x), np.array(det_y))
                  )
  
                  det_p = det_p.reshape(2, -1).transpose()
                  det_p = plg.Polygon(det_p)
  
                  local_sigma_table[gt_id, det_id] = sigma_calculation(
                      det_p, gt_p
                  )
                  local_tau_table[gt_id, det_id] = tau_calculation(
                      det_p, gt_p
                  )
  
      data = {}
      data["sigma"] = local_sigma_table
      data["global_tau"] = local_tau_table
      data["global_pred_str"] = ""
      data["global_gt_str"] = ""
      return data
  
file_path: PaddleOCR/ppocr/utils/e2e_metric/Deteval.py
imports: import json
  import numpy
  import scipy.io
  from ppocr.utils.utility import check_install
  from ppocr.utils.e2e_metric.polygon_fast import iod, area_of_intersection, area
label_desc: Use image node_id 3 for calling a global function with example usage: get_score_C(gt_label, text, pred_bboxes) and returns: data, groundtruths, unknown, pInt, detections, unknown, unknown, int, int, int