code: def build_roi_heads(cfg, input_shape):
      """
      Build ROIHeads defined by `cfg.MODEL.ROI_HEADS.NAME`.
      """
      name = cfg.MODEL.ROI_HEADS.NAME
      return ROI_HEADS_REGISTRY.get(name)(cfg, input_shape)
  
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 for calling a global function with example usage: build_roi_heads(cfg, input_shape) and returns: ROI_HEADS_REGISTRY