class_docstr: Mask RCNN loss is computed inside the MaskRCNN model. This class is a wrapper to extract
  loss values for different heads (RPN, classification, etc.) and compute the weighted sum.
  
  Args:
      opts: command-line arguments
class_docstr_tok: ["Mask","RCNN","loss","is","computed","inside","the","MaskRCNN","model",".","This","class","is","a","wrapper","to","extract","loss","values","for","different","heads","(","RPN",",","classification",",","etc",".",")","and","compute","the","weighted","sum",".","Args",":","opts",":","command-line","arguments"]
code: def __init__(self, opts: argparse.Namespace, *args, **kwargs) -> None:
      super().__init__(opts, *args, **kwargs)
  
      self.classifier_weight = getattr(
          opts, "loss.detection.mask_rcnn_loss.classifier_weight"
      )
      self.box_reg_weight = getattr(
          opts, "loss.detection.mask_rcnn_loss.box_reg_weight"
      )
      self.mask_weight = getattr(
          opts, "loss.detection.mask_rcnn_loss.mask_weight"
      )
      self.objectness_weight = getattr(
          opts, "loss.detection.mask_rcnn_loss.objectness_weight"
      )
      self.rpn_box_reg = getattr(
          opts, "loss.detection.mask_rcnn_loss.rpn_box_reg"
      )
      # dev.device is not a part of model arguments. so test fails.
      # Setting a default value so test works
      self.device = getattr(opts, "dev.device", torch.device("cpu"))
  
file_path: ml-cvnets/loss_fn/detection/mask_rcnn_loss.py
imports: import argparse
  from typing import Any, Dict
  import torch
  from torch import Tensor
  from loss_fn import LOSS_REGISTRY
  from loss_fn.detection.base_detection_criteria import BaseDetectionCriteria
  from utils import logger
label_desc: Use image node_id 1 to create a new MaskRCNNLoss object from inherited base classes: BaseDetectionCriteria with example: obj = MaskRCNNLoss(opts)