class_docstr: Implementation of a postprocessor based on adding class labels to classifier output.
class_docstr_tok: ["Implementation","of","a","postprocessor","based","on","adding","class","labels","to","classifier","output","."]
docstr: Perform model postprocessing and return postprocessed output.
  
  :param preds: model output to be postprocessed.
  :return: Postprocessed model output.
docstr_tok: ["Perform","model","postprocessing","and","return","postprocessed","output",".",":","param","preds",":","model","output","to","be","postprocessed",".",":","return",":","Postprocessed","model","output","."]
code: def __call__(self, preds: np.ndarray) -> np.ndarray:
      """
      Perform model postprocessing and return postprocessed output.
  
      :param preds: model output to be postprocessed.
      :return: Postprocessed model output.
      """
      class_labels = np.zeros_like(preds)
      if preds.shape[1] > 1:
          index_labels = np.argmax(preds, axis=1)
          class_labels[:, index_labels] = 1
      else:
          class_labels[preds > 0.5] = 1
  
      return class_labels
  
imports: import logging
  import numpy
  from art.defences.postprocessor.postprocessor import Postprocessor
label_desc: Use image node_id 2 for calling the ClassLabels obj's underlying member method code with example usage: obj.__call__(preds) and returns: class_labels