class_docstr: Cascade roi head including one bbox head and one mask head.
  
  https://arxiv.org/abs/1712.00726
docstr: Run forward function and calculate loss for box head in training.
docstr_tok: ["Run","forward","function","and","calculate","loss","for","box","head","in","training","."]
code: def _bbox_forward_train(
      self,
      stage,
      x,
      sampling_results,
      gt_bboxes,
      gt_labels,
      rcnn_train_cfg,
  ):
      """Run forward function and calculate loss for box head in training."""
      rois = bbox2roi([res.bboxes for res in sampling_results])
      bbox_results = self._bbox_forward(stage, x, rois)
      bbox_targets = self.bbox_head[stage].get_targets(
          sampling_results, gt_bboxes, gt_labels, rcnn_train_cfg
      )
      loss_bbox = self.bbox_head[stage].loss(
          bbox_results["cls_score"],
          bbox_results["bbox_pred"],
          rois,
          *bbox_targets,
      )
  
      bbox_results.update(
          loss_bbox=loss_bbox, rois=rois, bbox_targets=bbox_targets
      )
      return bbox_results
  
imports: import torch
  import torch.nn
  from mmdet.core import bbox2result, bbox2roi, bbox_mapping, build_assigner, build_sampler, merge_aug_bboxes, merge_aug_masks, multiclass_nms
  from ..builder import HEADS, build_head, build_roi_extractor
  from .base_roi_head import BaseRoIHead
  from .test_mixins import BBoxTestMixin, MaskTestMixin
label_desc: Use image node_id 8 for calling the CascadeRoIHead obj's underlying member method code with example usage: obj._bbox_forward_train(stage, x, sampling_results, gt_bboxes, gt_labels, rcnn_train_cfg) and returns: bbox_results