code: def iou_binary(preds, labels, EMPTY=1.0, ignore=None, per_image=True):
      """
      IoU for foreground class
      binary: 1 foreground, 0 background
      """
      if not per_image:
          preds, labels = (preds,), (labels,)
      ious = []
      for pred, label in zip(preds, labels):
          intersection = ((label == 1) & (pred == 1)).sum()
          union = (
              (label == 1) | ((pred == 1) & (label != ignore))
          ).sum()
          if not union:
              iou = EMPTY
          else:
              iou = float(intersection) / float(union)
          ious.append(iou)
      iou = mean(ious)  # mean accross images if per_image
      return 100 * iou
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
  from torch.autograd import Variable
label_desc: Use image node_id 2 for calling a global function with example usage: iou_binary(preds, labels, EMPTY, ignore, per_image) and returns: unknown