class_docstr: Confusion Matrix for segmentation evaluation.
  
  Args:
      num_classes (int): Number of categories of the confusion matrix.
      streaming (bool): Whether to use streaming mode. If the value is set to True, the data will be
                        accumulated every time the `calculate` interface is called. Default to False.
code: def accuracy(self) -> float:
      total = self.confusion_matrix.sum()
      total_right = 0
      for c in range(self.num_classes):
          total_right += self.confusion_matrix[c][c]
      if total == 0:
          avg_acc = 0
      else:
          avg_acc = float(total_right) / total
  
      vij = np.zeros(self.num_classes, dtype=int)
      for i in range(self.num_classes):
          v_i = 0
          for j in range(self.num_classes):
              v_i += self.confusion_matrix[j][i]
          vij[i] = v_i
  
      acc_list = []
      for c in range(self.num_classes):
          if vij[c] == 0:
              acc = 0
          else:
              acc = self.confusion_matrix[c][c] / float(vij[c])
          acc_list.append(acc)
      return np.array(acc_list), avg_acc
  
imports: import os
  from typing import Callable, Union, List, Tuple
  import cv2
  import paddle
  import PIL
  import numpy
  import paddle.nn.functional
  from scipy.sparse import csr_matrix
label_desc: Use image node_id 5 for calling the ConfusionMatrix obj's underlying member method code with example usage: obj.accuracy() and returns: np,  avg_acc