class_docstr: RoI head for `Dynamic R-CNN <https://arxiv.org/abs/2004.06002>`_.
docstr: Update hyperparameters like IoU thresholds for assigner and beta for
  SmoothL1 loss based on the training statistics.
  
  Returns:
      tuple[float]: the updated ``iou_thr`` and ``beta``.
code: def update_hyperparameters(self):
      """Update hyperparameters like IoU thresholds for assigner and beta for
      SmoothL1 loss based on the training statistics.
  
      Returns:
          tuple[float]: the updated ``iou_thr`` and ``beta``.
      """
      new_iou_thr = max(
          self.train_cfg.dynamic_rcnn.initial_iou,
          np.mean(self.iou_history),
      )
      self.iou_history = []
      self.bbox_assigner.pos_iou_thr = new_iou_thr
      self.bbox_assigner.neg_iou_thr = new_iou_thr
      self.bbox_assigner.min_pos_iou = new_iou_thr
      if np.median(self.beta_history) < EPS:
          # avoid 0 or too small value for new_beta
          new_beta = self.bbox_head.loss_bbox.beta
      else:
          new_beta = min(
              self.train_cfg.dynamic_rcnn.initial_beta,
              np.median(self.beta_history),
          )
      self.beta_history = []
      self.bbox_head.loss_bbox.beta = new_beta
      return new_iou_thr, new_beta
  
file_path: insightface/detection/scrfd/mmdet/models/roi_heads/dynamic_roi_head.py
imports: import numpy
  import torch
  from mmdet.core import bbox2roi
  from mmdet.models.losses import SmoothL1Loss
  from ..builder import HEADS
  from .standard_roi_head import StandardRoIHead
label_desc: Use image node_id 4 for calling the DynamicRoIHead obj's underlying member method code with example usage: obj.update_hyperparameters() and returns: new_iou_thr,  new_beta