code: def batch_pix_accuracy(output, target):
      """PixAcc"""
      # inputs are NDarray, output 4D, target 3D
      # the category -1 is ignored class, typically for background / boundary
      predict = np.argmax(output.asnumpy(), 1).astype("int64") + 1
  
      target = target.asnumpy().astype("int64") + 1
  
      pixel_labeled = np.sum(target > 0)
      pixel_correct = np.sum((predict == target) * (target > 0))
  
      assert (
          pixel_correct <= pixel_labeled
      ), "Correct area should be smaller than Labeled"
      return 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 1 for calling a global function with example usage: batch_pix_accuracy(output, target) and returns: pixel_correct,  pixel_labeled