code: def pixelAccuracy(imPred, imLab):
      """
      This function takes the prediction and label of a single image, returns pixel-wise accuracy
      To compute over many images do:
      for i = range(Nimages):
           (pixel_accuracy[i], pixel_correct[i], pixel_labeled[i]) = \
              pixelAccuracy(imPred[i], imLab[i])
      mean_pixel_accuracy = 1.0 * np.sum(pixel_correct) / (np.spacing(1) + np.sum(pixel_labeled))
      """
      # Remove classes from unlabeled pixels in gt image.
      # We should not penalize detections in unlabeled portions of the image.
      pixel_labeled = np.sum(imLab > 0)
      pixel_correct = np.sum((imPred == imLab) * (imLab > 0))
      pixel_accuracy = 1.0 * pixel_correct / pixel_labeled
      return (pixel_accuracy, pixel_correct, pixel_labeled)
  
file_path: gluon-cv/gluoncv/utils/metrics/segmentation.py
imports: import threading
  import numpy
  import mxnet
label_desc: Use image node_id 3 for calling a global function with example usage: pixelAccuracy(imPred, imLab) and returns: pixel_accuracy,  pixel_correct,  pixel_labeled