class_docstr: The Maskformer loss implemeted with PaddlePaddle.
  
  Args:
      num_classes(int): The number of classes that you want this network to classify. Default:150.
      eos_coef(float): The weight coefficient of the last class. Default: 0.1.
      losses(Tuple): The category of losses that you want to compute. Default: ("labels", 'masks').
      ignore_index(int): The ignored label when we calculate the loss. Default:255.
class_docstr_tok: ["The","Maskformer","loss","implemeted","with","PaddlePaddle",".","Args",":","num_classes","(","int",")",":","The","number","of","classes","that","you","want","this","network","to","classify",".","Default:150.","eos_coef","(","float",")",":","The","weight","coefficient","of","the","last","class",".","Default",":","0.1.","losses","(","Tuple",")",":","The","category","of","losses","that","you","want","to","compute",".","Default",":","(","``","labels","''",",","'masks","'",")",".","ignore_index","(","int",")",":","The","ignored","label","when","we","calculate","the","loss",".","Default:255","."]
code: def __init__(
      self,
      num_classes=150,
      eos_coef=0.1,
      losses=("labels", "masks"),
      ignore_index=255,
  ):
      super().__init__()
      mask_weight = 20.0
      dice_weight = 1.0
  
      weight_dict = {
          "loss_ce": 1,
          "loss_mask": mask_weight,
          "loss_dice": dice_weight,
      }
      eos_coef = 0.1
      dec_layers = 6
      aux_weight_dict = {}
      for i in range(dec_layers - 1):
          aux_weight_dict.update(
              {k + f"_{i}": v for k, v in weight_dict.items()}
          )
      weight_dict.update(aux_weight_dict)
      self.num_classes = num_classes
      self.ignore_index = ignore_index
      self.weight_dict = weight_dict
      self.matcher = HungarianMatcher(
          cost_class=1, cost_mask=mask_weight, cost_dice=dice_weight
      )
      self.losses = losses
      self.empty_weight = paddle.ones(shape=(num_classes + 1,))
      self.empty_weight[-1] = eos_coef
  
imports: import copy
  import numpy
  from scipy.optimize import linear_sum_assignment
  import paddle
  import paddle.nn
  import paddle.distributed
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
label_desc: Use image node_id 1 to create a new MaskFormerLoss object from inherited base classes: nn with example: obj = MaskFormerLoss(num_classes, eos_coef, losses, ignore_index)