class_docstr: Loss for single shot multi-box object detection
  
  Args:
      opts: command-line arguments
class_docstr_tok: ["Loss","for","single","shot","multi-box","object","detection","Args",":","opts",":","command-line","arguments"]
code: def __init__(self, opts: argparse.Namespace, *args, **kwargs) -> None:
      super().__init__(opts, *args, **kwargs)
      self.unscaled_reg_loss = 1e-7
      self.unscaled_conf_loss = 1e-7
      self.neg_pos_ratio = getattr(
          opts, "loss.detection.ssd_multibox_loss.neg_pos_ratio"
      )
      self.wt_loc = 1.0
      self.curr_iter = 0
      self.max_iter = getattr(
          opts, "loss.detection.ssd_multibox_loss.max_monitor_iter"
      )
      self.update_inter = getattr(
          opts, "loss.detection.ssd_multibox_loss.update_wt_freq"
      )
      self.is_master = is_master(opts)
      self.label_smoothing = getattr(
          opts, "loss.detection.ssd_multibox_loss.label_smoothing"
      )
      if not (0.0 <= self.label_smoothing < 1.0):
          logger.error(
              "The value of --loss.detection.ssd-multibox-loss.label-smoothing should be between 0 and 1. "
              "Got: {}".format(self.label_smoothing)
          )
  
      # Add default value to run CI/CD smoothly
      self.is_distributed = getattr(opts, "ddp.use_distributed", False)
  
      self.reset_unscaled_loss_values()
  
file_path: ml-cvnets/loss_fn/detection/ssd_multibox_loss.py
imports: import argparse
  from typing import Any, Dict
  import torch
  from torch import Tensor
  from torch.nn import functional
  from cvnets.misc.third_party.ssd_utils import hard_negative_mining
  from loss_fn import LOSS_REGISTRY
  from loss_fn.detection.base_detection_criteria import BaseDetectionCriteria
  from utils import logger
  from utils.ddp_utils import is_master
  from utils.tensor_utils import tensor_to_python_float
label_desc: Use image node_id 1 to create a new SSDLoss object from inherited base classes: BaseDetectionCriteria with example: obj = SSDLoss(opts)