class_docstr: Simplest RoI head, with only two fc layers for classification and
  regression respectively.
class_docstr_tok: ["Simplest","RoI","head",",","with","only","two","fc","layers","for","classification","and","regression","respectively","."]
code: def __init__(
      self,
      with_avg_pool=False,
      with_cls=True,
      with_reg=True,
      roi_feat_size=7,
      in_channels=256,
      num_classes=80,
      bbox_coder=dict(
          type="DeltaXYWHBBoxCoder",
          clip_border=True,
          target_means=[0.0, 0.0, 0.0, 0.0],
          target_stds=[0.1, 0.1, 0.2, 0.2],
      ),
      reg_class_agnostic=False,
      reg_decoded_bbox=False,
      loss_cls=dict(
          type="CrossEntropyLoss", use_sigmoid=False, loss_weight=1.0
      ),
      loss_bbox=dict(type="SmoothL1Loss", beta=1.0, loss_weight=1.0),
  ):
      super(BBoxHead, self).__init__()
      assert with_cls or with_reg
      self.with_avg_pool = with_avg_pool
      self.with_cls = with_cls
      self.with_reg = with_reg
      self.roi_feat_size = _pair(roi_feat_size)
      self.roi_feat_area = self.roi_feat_size[0] * self.roi_feat_size[1]
      self.in_channels = in_channels
      self.num_classes = num_classes
      self.reg_class_agnostic = reg_class_agnostic
      self.reg_decoded_bbox = reg_decoded_bbox
      self.fp16_enabled = False
  
      self.bbox_coder = build_bbox_coder(bbox_coder)
      self.loss_cls = build_loss(loss_cls)
      self.loss_bbox = build_loss(loss_bbox)
  
      in_channels = self.in_channels
      if self.with_avg_pool:
          self.avg_pool = nn.AvgPool2d(self.roi_feat_size)
      else:
          in_channels *= self.roi_feat_area
      if self.with_cls:
          # need to add background class
          self.fc_cls = nn.Linear(in_channels, num_classes + 1)
      if self.with_reg:
          out_dim_reg = 4 if reg_class_agnostic else 4 * num_classes
          self.fc_reg = nn.Linear(in_channels, out_dim_reg)
      self.debug_imgs = None
  
file_path: insightface/detection/scrfd/mmdet/models/roi_heads/bbox_heads/bbox_head.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.runner import auto_fp16, force_fp32
  from torch.nn.modules.utils import _pair
  from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
  from mmdet.models.builder import HEADS, build_loss
  from mmdet.models.losses import accuracy
label_desc: Use image node_id 1 to create a new BBoxHead object from inherited base classes: nn with example: obj = BBoxHead(with_avg_pool, with_cls, with_reg, roi_feat_size, in_channels, num_classes, bbox_coder, reg_class_agnostic, reg_decoded_bbox, loss_cls, loss_bbox)