class_docstr: Cascade roi head including one bbox head and one mask head.
  
  https://arxiv.org/abs/1712.00726
docstr: Initialize mask head and mask roi extractor.
  
  Args:
      mask_head (dict): Config of mask in mask head.
      mask_roi_extractor (:obj:`ConfigDict`, dict or list):
          Config of mask roi extractor.
docstr_tok: ["Initialize","mask","head","and","mask","roi","extractor",".","Args",":","mask_head","(","dict",")",":","Config","of","mask","in","mask","head",".","mask_roi_extractor","(",":","obj",":","`","ConfigDict","`",",","dict","or","list",")",":","Config","of","mask","roi","extractor","."]
code: def init_mask_head(
      self, mask_roi_extractor: MultiConfig, mask_head: MultiConfig
  ) -> None:
      """Initialize mask head and mask roi extractor.
  
      Args:
          mask_head (dict): Config of mask in mask head.
          mask_roi_extractor (:obj:`ConfigDict`, dict or list):
              Config of mask roi extractor.
      """
      self.mask_head = nn.ModuleList()
      if not isinstance(mask_head, list):
          mask_head = [mask_head for _ in range(self.num_stages)]
      assert len(mask_head) == self.num_stages
      for head in mask_head:
          self.mask_head.append(MODELS.build(head))
      if mask_roi_extractor is not None:
          self.share_roi_extractor = False
          self.mask_roi_extractor = ModuleList()
          if not isinstance(mask_roi_extractor, list):
              mask_roi_extractor = [
                  mask_roi_extractor for _ in range(self.num_stages)
              ]
          assert len(mask_roi_extractor) == self.num_stages
          for roi_extractor in mask_roi_extractor:
              self.mask_roi_extractor.append(
                  MODELS.build(roi_extractor)
              )
      else:
          self.share_roi_extractor = True
          self.mask_roi_extractor = self.bbox_roi_extractor
  
imports: from typing import List, Sequence, Tuple, Union
  import torch
  import torch.nn
  from mmengine.model import ModuleList
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.models.task_modules.samplers import SamplingResult
  from mmdet.models.test_time_augs import merge_aug_masks
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi, get_box_tensor
  from mmdet.utils import ConfigType, InstanceList, MultiConfig, OptConfigType, OptMultiConfig
  from ..utils.misc import empty_instances, unpack_gt_instances
  from .base_roi_head import BaseRoIHead
label_desc: Use image node_id 3 for calling the CascadeRoIHead obj's underlying member method code with example usage: obj.init_mask_head(mask_roi_extractor, mask_head) without return types