class_docstr: This part is partially derivated from:
  
  https://github.com/facebookresearch/detr/blob/main/models/detr.py.
class_docstr_tok: ["This","part","is","partially","derivated","from",":","https",":","\/\/github.com\/facebookresearch\/detr\/blob\/main\/models\/detr.py","."]
code: def __init__(
      self,
      num_classes,
      assigner,
      loss_cls=dict(
          type="FocalLoss",
          use_sigmoid=True,
          alpha=0.25,
          gamma=2.0,
          reduction="sum",
          loss_weight=2.0,
      ),
      loss_obj=dict(
          type="CrossEntropyLoss",
          use_sigmoid=True,
          reduction="mean",
          loss_weight=1.0,
      ),
      loss_mask=dict(
          type="CrossEntropyLoss",
          use_sigmoid=True,
          reduction="mean",
          loss_weight=5.0,
      ),
      loss_dice=dict(
          type="DiceLoss",
          use_sigmoid=True,
          reduction="sum",
          eps=5e-5,
          loss_weight=2.0,
      ),
  ):
      super().__init__()
      self.matcher = TASK_UTILS.build(assigner)
      self.num_classes = num_classes
      self.loss_cls = MODELS.build(loss_cls)
      self.loss_obj = MODELS.build(loss_obj)
      self.loss_mask = MODELS.build(loss_mask)
      self.loss_dice = MODELS.build(loss_dice)
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from scipy.optimize import linear_sum_assignment
  from torch.cuda.amp import autocast
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.utils import reduce_mean
label_desc: Use image node_id 1 to create a new SparseInstCriterion object from inherited base classes: nn with example: obj = SparseInstCriterion(num_classes, assigner, loss_cls, loss_obj, loss_mask, loss_dice)