class_docstr: DiceLoss normalized on each instance.
  Input:
      pred: (N, 1, H, W)
      gt: (N, 1, H, W)
      mask: (N, H, W)
  Note: This class assume that input tensors are on gpu,
      while cput computation is required to find union areas.
class_docstr_tok: ["DiceLoss","normalized","on","each","instance",".","Input",":","pred",":","(","N",",","1",",","H",",","W",")","gt",":","(","N",",","1",",","H",",","W",")","mask",":","(","N",",","H",",","W",")","Note",":","This","class","assume","that","input","tensors","are","on","gpu",",","while","cput","computation","is","required","to","find","union","areas","."]
code: def __init__(
      self,
      threshold=0.3,
      iou_thresh=0.2,
      reduction=None,
      max_regions=100,
      eps=1e-6,
  ):
      nn.Module.__init__(self)
      self.threshold = threshold
      self.iou_thresh = iou_thresh
      self.reduction = reduction
      if self.reduction is None:
          self.reduction = "mean"
      assert self.reduction in self.REDUCTION
      self.max_regions = max_regions
      self.eps = eps
  
imports: import torch
  import torch.nn
  import numpy
  import cv2
  from scipy import ndimage
label_desc: Use image node_id 1 to create a new InstanceDiceLoss object from inherited base classes: DiceLoss with example: obj = InstanceDiceLoss(threshold, iou_thresh, reduction, max_regions, eps)