class_docstr: The ROIHeads in a typical "C4" R-CNN model, where
  the box and mask head share the cropping and
  the per-region feature computation by a Res5 block.
  See :paper:`ResNet` Appendix A.
class_docstr_tok: ["The","ROIHeads","in","a","typical","``","C4","''","R-CNN","model",",","where","the","box","and","mask","head","share","the","cropping","and","the","per-region","feature","computation","by","a","Res5","block",".","See",":","paper",":","`","ResNet","`","Appendix","A","."]
docstr: NOTE: this interface is experimental.
  
  Args:
      in_features (list[str]): list of backbone feature map names to use for
          feature extraction
      pooler (ROIPooler): pooler to extra region features from backbone
      res5 (nn.Sequential): a CNN to compute per-region features, to be used by
          ``box_predictor`` and ``mask_head``. Typically this is a "res5"
          block from a ResNet.
      box_predictor (nn.Module): make box predictions from the feature.
          Should have the same interface as :class:`FastRCNNOutputLayers`.
      mask_head (nn.Module): transform features to make mask predictions
docstr_tok: ["NOTE",":","this","interface","is","experimental",".","Args",":","in_features","(","list","[","str","]",")",":","list","of","backbone","feature","map","names","to","use","for","feature","extraction","pooler","(","ROIPooler",")",":","pooler","to","extra","region","features","from","backbone","res5","(","nn.Sequential",")",":","a","CNN","to","compute","per-region","features",",","to","be","used","by","``","box_predictor","``","and","``","mask_head","``",".","Typically","this","is","a","``","res5","''","block","from","a","ResNet",".","box_predictor","(","nn.Module",")",":","make","box","predictions","from","the","feature",".","Should","have","the","same","interface","as",":","class",":","`","FastRCNNOutputLayers","`",".","mask_head","(","nn.Module",")",":","transform","features","to","make","mask","predictions"]
code: def __init__(
      self,
      *,
      in_features: List[str],
      pooler: ROIPooler,
      res5: nn.Module,
      box_predictor: nn.Module,
      mask_head: Optional[nn.Module] = None,
      **kwargs,
  ):
      """
      NOTE: this interface is experimental.
  
      Args:
          in_features (list[str]): list of backbone feature map names to use for
              feature extraction
          pooler (ROIPooler): pooler to extra region features from backbone
          res5 (nn.Sequential): a CNN to compute per-region features, to be used by
              ``box_predictor`` and ``mask_head``. Typically this is a "res5"
              block from a ResNet.
          box_predictor (nn.Module): make box predictions from the feature.
              Should have the same interface as :class:`FastRCNNOutputLayers`.
          mask_head (nn.Module): transform features to make mask predictions
      """
      super().__init__(**kwargs)
      self.in_features = in_features
      self.pooler = pooler
      if isinstance(res5, (list, tuple)):
          res5 = nn.Sequential(*res5)
      self.res5 = res5
      self.box_predictor = box_predictor
      self.mask_on = mask_head is not None
      if self.mask_on:
          self.mask_head = mask_head
  
imports: import inspect
  import logging
  import numpy
  from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn
  from detectron2.config import configurable
  from detectron2.layers import ShapeSpec, nonzero_tuple
  from detectron2.structures import Boxes, ImageList, Instances, pairwise_iou
  from detectron2.utils.events import get_event_storage
  from detectron2.utils.registry import Registry
  from ..backbone.resnet import BottleneckBlock, ResNet
  from ..matcher import Matcher
  from ..poolers import ROIPooler
  from ..proposal_generator.proposal_utils import add_ground_truth_to_proposals
  from ..sampling import subsample_labels
  from .box_head import build_box_head
  from .fast_rcnn import FastRCNNOutputLayers
  from .keypoint_head import build_keypoint_head
  from .mask_head import build_mask_head
label_desc: Use image node_id 1 to create a new Res5ROIHeads object from inherited base classes: ROIHeads with example: obj = Res5ROIHeads()