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","."]
docstr: Transform a batch of output features extracted from the head into
  bbox results.
  
  Args:
      rois (tuple[Tensor]): Tuple of boxes to be transformed.
          Each has shape  (num_boxes, 5). last dimension 5 arrange as
          (batch_index, x1, y1, x2, y2).
      cls_scores (tuple[Tensor]): Tuple of box scores, each has shape
          (num_boxes, num_classes + 1).
      bbox_preds (tuple[Tensor]): Tuple of box energies / deltas, each
          has shape (num_boxes, num_classes * 4).
      batch_img_metas (list[dict]): List of image information.
      rcnn_test_cfg (obj:`ConfigDict`, optional): `test_cfg` of R-CNN.
          Defaults to None.
      rescale (bool): If True, return boxes in original image space.
          Defaults to False.
  
  Returns:
      list[:obj:`InstanceData`]: Instance segmentation
      results of each image after the post process.
      Each item usually contains following keys.
  
          - scores (Tensor): Classification scores, has a shape
            (num_instance, )
          - labels (Tensor): Labels of bboxes, has a shape
            (num_instances, ).
          - bboxes (Tensor): Has a shape (num_instances, 4),
            the last dimension 4 arrange as (x1, y1, x2, y2).
docstr_tok: ["Transform","a","batch","of","output","features","extracted","from","the","head","into","bbox","results",".","Args",":","rois","(","tuple","[","Tensor","]",")",":","Tuple","of","boxes","to","be","transformed",".","Each","has","shape","(","num_boxes",",","5",")",".","last","dimension","5","arrange","as","(","batch_index",",","x1",",","y1",",","x2",",","y2",")",".","cls_scores","(","tuple","[","Tensor","]",")",":","Tuple","of","box","scores",",","each","has","shape","(","num_boxes",",","num_classes","+","1",")",".","bbox_preds","(","tuple","[","Tensor","]",")",":","Tuple","of","box","energies","\/","deltas",",","each","has","shape","(","num_boxes",",","num_classes","*","4",")",".","batch_img_metas","(","list","[","dict","]",")",":","List","of","image","information",".","rcnn_test_cfg","(","obj",":","`","ConfigDict","`",",","optional",")",":","`","test_cfg","`","of","R-CNN",".","Defaults","to","None",".","rescale","(","bool",")",":","If","True",",","return","boxes","in","original","image","space",".","Defaults","to","False",".","Returns",":","list","[",":","obj",":","`","InstanceData","`","]",":","Instance","segmentation","results","of","each","image","after","the","post","process",".","Each","item","usually","contains","following","keys",".","-","scores","(","Tensor",")",":","Classification","scores",",","has","a","shape","(","num_instance",",",")","-","labels","(","Tensor",")",":","Labels","of","bboxes",",","has","a","shape","(","num_instances",",",")",".","-","bboxes","(","Tensor",")",":","Has","a","shape","(","num_instances",",","4",")",",","the","last","dimension","4","arrange","as","(","x1",",","y1",",","x2",",","y2",")","."]
code: def predict_by_feat(
      self,
      rois: Tuple[Tensor],
      cls_scores: Tuple[Tensor],
      bbox_preds: Tuple[Tensor],
      batch_img_metas: List[dict],
      rcnn_test_cfg: Optional[ConfigDict] = None,
      rescale: bool = False,
  ) -> InstanceList:
      """Transform a batch of output features extracted from the head into
      bbox results.
  
      Args:
          rois (tuple[Tensor]): Tuple of boxes to be transformed.
              Each has shape  (num_boxes, 5). last dimension 5 arrange as
              (batch_index, x1, y1, x2, y2).
          cls_scores (tuple[Tensor]): Tuple of box scores, each has shape
              (num_boxes, num_classes + 1).
          bbox_preds (tuple[Tensor]): Tuple of box energies / deltas, each
              has shape (num_boxes, num_classes * 4).
          batch_img_metas (list[dict]): List of image information.
          rcnn_test_cfg (obj:`ConfigDict`, optional): `test_cfg` of R-CNN.
              Defaults to None.
          rescale (bool): If True, return boxes in original image space.
              Defaults to False.
  
      Returns:
          list[:obj:`InstanceData`]: Instance segmentation
          results of each image after the post process.
          Each item usually contains following keys.
  
              - scores (Tensor): Classification scores, has a shape
                (num_instance, )
              - labels (Tensor): Labels of bboxes, has a shape
                (num_instances, ).
              - bboxes (Tensor): Has a shape (num_instances, 4),
                the last dimension 4 arrange as (x1, y1, x2, y2).
      """
      assert len(cls_scores) == len(bbox_preds)
      result_list = []
      for img_id in range(len(batch_img_metas)):
          img_meta = batch_img_metas[img_id]
          results = self._predict_by_feat_single(
              roi=rois[img_id],
              cls_score=cls_scores[img_id],
              bbox_pred=bbox_preds[img_id],
              img_meta=img_meta,
              rescale=rescale,
              rcnn_test_cfg=rcnn_test_cfg,
          )
          result_list.append(results)
  
      return result_list
  
imports: from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from mmengine.config import ConfigDict
  from mmengine.model import BaseModule
  from mmengine.structures import InstanceData
  from torch import Tensor
  from torch.nn.modules.utils import _pair
  from mmdet.models.layers import multiclass_nms
  from mmdet.models.losses import accuracy
  from mmdet.models.task_modules.samplers import SamplingResult
  from mmdet.models.utils import empty_instances, multi_apply
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures.bbox import get_box_tensor, scale_boxes
  from mmdet.utils import ConfigType, InstanceList, OptMultiConfig
label_desc: Use image node_id 10 for calling the BBoxHead obj's underlying member method code with example usage: obj.predict_by_feat(rois, cls_scores, bbox_preds, batch_img_metas, rcnn_test_cfg, rescale) and returns: result_list