class_docstr: Hybrid task cascade roi head including one bbox head and one mask head.
  
  https://arxiv.org/abs/1901.07518
class_docstr_tok: ["Hybrid","task","cascade","roi","head","including","one","bbox","head","and","one","mask","head",".","https",":","\/\/arxiv.org\/abs\/1901.07518"]
docstr: Box head forward function used in both training and testing.
docstr_tok: ["Box","head","forward","function","used","in","both","training","and","testing","."]
code: def _bbox_forward(self, stage, x, rois, semantic_feat=None):
      """Box head forward function used in both training and testing."""
      bbox_roi_extractor = self.bbox_roi_extractor[stage]
      bbox_head = self.bbox_head[stage]
      bbox_feats = bbox_roi_extractor(
          x[: len(bbox_roi_extractor.featmap_strides)], rois
      )
      if self.with_semantic and "bbox" in self.semantic_fusion:
          bbox_semantic_feat = self.semantic_roi_extractor(
              [semantic_feat], rois
          )
          if bbox_semantic_feat.shape[-2:] != bbox_feats.shape[-2:]:
              bbox_semantic_feat = F.adaptive_avg_pool2d(
                  bbox_semantic_feat, bbox_feats.shape[-2:]
              )
          bbox_feats += bbox_semantic_feat
      cls_score, bbox_pred = bbox_head(bbox_feats)
  
      bbox_results = dict(cls_score=cls_score, bbox_pred=bbox_pred)
      return bbox_results
  
file_path: insightface/detection/scrfd/mmdet/models/roi_heads/htc_roi_head.py
imports: import torch
  import torch.nn.functional
  from mmdet.core import bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes, merge_aug_masks, multiclass_nms
  from ..builder import HEADS, build_head, build_roi_extractor
  from .cascade_roi_head import CascadeRoIHead
label_desc: Use image node_id 7 for calling the HybridTaskCascadeRoIHead obj's underlying member method code with example usage: obj._bbox_forward(stage, x, rois, semantic_feat) and returns: bbox_results