class_docstr: Mask Scoring RoIHead for `Mask Scoring RCNN.
  
  <https://arxiv.org/abs/1903.00241>`_.
  
  Args:
      mask_iou_head (:obj`ConfigDict`, dict): The config of mask_iou_head.
docstr: Network forward process. Usually includes backbone, neck and head
  forward without any post-processing.
  
  Args:
      x (List[Tensor]): Multi-level features that may have different
          resolutions.
      rpn_results_list (list[:obj:`InstanceData`]): List of region
          proposals.
      batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
      the meta information of each image and corresponding
      annotations.
  
  Returns
      tuple: A tuple of features from ``bbox_head`` and ``mask_head``
      forward.
docstr_tok: ["Network","forward","process",".","Usually","includes","backbone",",","neck","and","head","forward","without","any","post-processing",".","Args",":","x","(","List","[","Tensor","]",")",":","Multi-level","features","that","may","have","different","resolutions",".","rpn_results_list","(","list","[",":","obj",":","`","InstanceData","`","]",")",":","List","of","region","proposals",".","batch_data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",")",":","Each","item","contains","the","meta","information","of","each","image","and","corresponding","annotations",".","Returns","tuple",":","A","tuple","of","features","from","``","bbox_head","``","and","``","mask_head","``","forward","."]
code: def forward(
      self,
      x: Tuple[Tensor],
      rpn_results_list: InstanceList,
      batch_data_samples: SampleList = None,
  ) -> tuple:
      """Network forward process. Usually includes backbone, neck and head
      forward without any post-processing.
  
      Args:
          x (List[Tensor]): Multi-level features that may have different
              resolutions.
          rpn_results_list (list[:obj:`InstanceData`]): List of region
              proposals.
          batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
          the meta information of each image and corresponding
          annotations.
  
      Returns
          tuple: A tuple of features from ``bbox_head`` and ``mask_head``
          forward.
      """
      results = ()
      proposals = [
          rpn_results.bboxes for rpn_results in rpn_results_list
      ]
      rois = bbox2roi(proposals)
      # bbox head
      if self.with_bbox:
          bbox_results = self._bbox_forward(x, rois)
          results = results + (
              bbox_results["cls_score"],
              bbox_results["bbox_pred"],
          )
      # mask head
      if self.with_mask:
          mask_rois = rois[:100]
          mask_results = self._mask_forward(x, mask_rois)
          results = results + (mask_results["mask_preds"],)
  
          # mask iou head
          cls_score = bbox_results["cls_score"][:100]
          mask_preds = mask_results["mask_preds"]
          mask_feats = mask_results["mask_feats"]
          _, labels = cls_score[:, : self.bbox_head.num_classes].max(
              dim=1
          )
          mask_iou_preds = self.mask_iou_head(
              mask_feats, mask_preds[range(labels.size(0)), labels]
          )
          results = results + (mask_iou_preds,)
  
      return results
  
file_path: mmdetection/mmdet/models/roi_heads/mask_scoring_roi_head.py
imports: from typing import List, Tuple
  import torch
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi
  from mmdet.utils import ConfigType, InstanceList
  from ..task_modules.samplers import SamplingResult
  from ..utils.misc import empty_instances
  from .standard_roi_head import StandardRoIHead
label_desc: Use image node_id 2 for calling the MaskScoringRoIHead obj's underlying member method code with example usage: obj.forward(x, rpn_results_list, batch_data_samples) and returns: results