code: def mean_iou(intersect_area, pred_area, label_area):
      """
      Calculate iou.
  
      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:
          np.ndarray: iou on all classes.
          float: mean iou of all classes.
      """
      intersect_area = intersect_area.numpy()
      pred_area = pred_area.numpy()
      label_area = label_area.numpy()
      union = pred_area + label_area - intersect_area
      class_iou = []
      for i in range(len(intersect_area)):
          if union[i] == 0:
              iou = 0
          else:
              iou = intersect_area[i] / union[i]
          class_iou.append(iou)
      miou = np.mean(class_iou)
      return np.array(class_iou), miou
  
file_path: PaddleSeg/contrib/MedicalSeg/medicalseg/utils/metric.py
imports: import numpy
  import paddle
  import paddle.nn.functional
  import sklearn.metrics
label_desc: Use image node_id 3 for calling a global function with example usage: mean_iou(intersect_area, pred_area, label_area) and returns: np,  miou