code: def class_measurement(intersect_area, pred_area, label_area):
      """
      Calculate accuracy, calss precision and class recall.
  
      Args:
          intersect_area (Tensor): The intersection area of prediction and ground truth on all classes.
          pred_area (Tensor): The prediction area on all classes.
          label_area (Tensor): The ground truth area on all classes.
  
      Returns:
          float: The mean accuracy.
          np.ndarray: The precision of all classes.
          np.ndarray: The recall of all classes.
      """
      intersect_area = intersect_area.numpy()
      pred_area = pred_area.numpy()
      label_area = label_area.numpy()
  
      mean_acc = np.sum(intersect_area) / np.sum(pred_area)
      class_precision = []
      class_recall = []
      for i in range(len(intersect_area)):
          precision = (
              0
              if pred_area[i] == 0
              else intersect_area[i] / pred_area[i]
          )
          recall = (
              0
              if label_area[i] == 0
              else intersect_area[i] / label_area[i]
          )
          class_precision.append(float(precision))
          class_recall.append(float(recall))
  
      return mean_acc, np.array(class_precision), np.array(class_recall)
  
file_path: PaddleSeg/paddleseg/utils/metrics.py
imports: import numpy
  import paddle
  import paddle.nn.functional
  import sklearn.metrics
label_desc: Use image node_id 6 for calling a global function with example usage: class_measurement(intersect_area, pred_area, label_area) and returns: mean_acc,  np,  np