class_docstr: RoI head for `Dynamic R-CNN <https://arxiv.org/abs/2004.06002>`_.
class_docstr_tok: ["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``.
docstr_tok: ["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 (not self.beta_history) or (
          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: mmdetection/mmdet/models/roi_heads/dynamic_roi_head.py
imports: from typing import List, Tuple
  import numpy
  import torch
  from torch import Tensor
  from mmdet.models.losses import SmoothL1Loss
  from mmdet.models.task_modules.samplers import SamplingResult
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi
  from mmdet.utils import InstanceList
  from ..utils.misc import unpack_gt_instances
  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