class_docstr: GHM Regression Loss.
  
  Details of the theorem can be viewed in the paper
  `Gradient Harmonized Single-stage Detector
  <https://arxiv.org/abs/1811.05181>`_.
  
  Args:
      mu (float): The parameter for the Authentic Smooth L1 loss.
      bins (int): Number of the unit regions for distribution calculation.
      momentum (float): The parameter for moving average.
      loss_weight (float): The weight of the total GHM-R loss.
class_docstr_tok: ["GHM","Regression","Loss",".","Details","of","the","theorem","can","be","viewed","in","the","paper","`","Gradient","Harmonized","Single-stage","Detector","<","https",":","\/\/arxiv.org\/abs\/1811.05181",">","`","_",".","Args",":","mu","(","float",")",":","The","parameter","for","the","Authentic","Smooth","L1","loss",".","bins","(","int",")",":","Number","of","the","unit","regions","for","distribution","calculation",".","momentum","(","float",")",":","The","parameter","for","moving","average",".","loss_weight","(","float",")",":","The","weight","of","the","total","GHM-R","loss","."]
code: def __init__(self, mu=0.02, bins=10, momentum=0, loss_weight=1.0):
      super(GHMR, self).__init__()
      self.mu = mu
      self.bins = bins
      edges = torch.arange(bins + 1).float() / bins
      self.register_buffer("edges", edges)
      self.edges[-1] = 1e3
      self.momentum = momentum
      if momentum > 0:
          acc_sum = torch.zeros(bins)
          self.register_buffer("acc_sum", acc_sum)
      self.loss_weight = loss_weight
  
file_path: insightface/detection/scrfd/mmdet/models/losses/ghm_loss.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from ..builder import LOSSES
label_desc: Use image node_id 1 to create a new GHMR object from inherited base classes: nn with example: obj = GHMR(mu, bins, momentum, loss_weight)