class_docstr: Mask IoU Head.
  
  This head predicts the IoU of predicted masks and corresponding gt masks.
  
  Args:
      num_convs (int): The number of convolution layers. Defaults to 4.
      num_fcs (int): The number of fully connected layers. Defaults to 2.
      roi_feat_size (int): RoI feature size. Default to 14.
      in_channels (int): The channel number of inputs features.
          Defaults to 256.
      conv_out_channels (int): The feature channels of convolution layers.
          Defaults to 256.
      fc_out_channels (int): The feature channels of fully connected layers.
          Defaults to 1024.
      num_classes (int): Number of categories excluding the background
          category. Defaults to 80.
      loss_iou (:obj:`ConfigDict` or dict): IoU loss.
      init_cfg (:obj:`ConfigDict` or dict or list[:obj:`ConfigDict` or             dict], optional): Initialization config dict.
class_docstr_tok: ["Mask","IoU","Head",".","This","head","predicts","the","IoU","of","predicted","masks","and","corresponding","gt","masks",".","Args",":","num_convs","(","int",")",":","The","number","of","convolution","layers",".","Defaults","to","4.","num_fcs","(","int",")",":","The","number","of","fully","connected","layers",".","Defaults","to","2.","roi_feat_size","(","int",")",":","RoI","feature","size",".","Default","to","14.","in_channels","(","int",")",":","The","channel","number","of","inputs","features",".","Defaults","to","256.","conv_out_channels","(","int",")",":","The","feature","channels","of","convolution","layers",".","Defaults","to","256.","fc_out_channels","(","int",")",":","The","feature","channels","of","fully","connected","layers",".","Defaults","to","1024.","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","Defaults","to","80.","loss_iou","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","IoU","loss",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict","or","list","[",":","obj",":","`","ConfigDict","`","or","dict","]",",","optional",")",":","Initialization","config","dict","."]
code: def __init__(
      self,
      num_convs: int = 4,
      num_fcs: int = 2,
      roi_feat_size: int = 14,
      in_channels: int = 256,
      conv_out_channels: int = 256,
      fc_out_channels: int = 1024,
      num_classes: int = 80,
      loss_iou: ConfigType = dict(type="MSELoss", loss_weight=0.5),
      init_cfg: OptMultiConfig = [
          dict(type="Kaiming", override=dict(name="convs")),
          dict(type="Caffe2Xavier", override=dict(name="fcs")),
          dict(
              type="Normal", std=0.01, override=dict(name="fc_mask_iou")
          ),
      ],
  ) -> None:
      super().__init__(init_cfg=init_cfg)
      self.in_channels = in_channels
      self.conv_out_channels = conv_out_channels
      self.fc_out_channels = fc_out_channels
      self.num_classes = num_classes
  
      self.convs = nn.ModuleList()
      for i in range(num_convs):
          if i == 0:
              # concatenation of mask feature and mask prediction
              in_channels = self.in_channels + 1
          else:
              in_channels = self.conv_out_channels
          stride = 2 if i == num_convs - 1 else 1
          self.convs.append(
              Conv2d(
                  in_channels,
                  self.conv_out_channels,
                  3,
                  stride=stride,
                  padding=1,
              )
          )
  
      roi_feat_size = _pair(roi_feat_size)
      pooled_area = (roi_feat_size[0] // 2) * (roi_feat_size[1] // 2)
      self.fcs = nn.ModuleList()
      for i in range(num_fcs):
          in_channels = (
              self.conv_out_channels * pooled_area
              if i == 0
              else self.fc_out_channels
          )
          self.fcs.append(Linear(in_channels, self.fc_out_channels))
  
      self.fc_mask_iou = Linear(self.fc_out_channels, self.num_classes)
      self.relu = nn.ReLU()
      self.max_pool = MaxPool2d(2, 2)
      self.loss_iou = MODELS.build(loss_iou)
  
imports: from typing import List, Tuple
  import numpy
  import torch
  import torch.nn
  from mmcv.cnn import Conv2d, Linear, MaxPool2d
  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.task_modules.samplers import SamplingResult
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, InstanceList, OptMultiConfig
label_desc: Use image node_id 1 to create a new MaskIoUHead object from inherited base classes: BaseModule with example: obj = MaskIoUHead(num_convs, num_fcs, roi_feat_size, in_channels, conv_out_channels, fc_out_channels, num_classes, loss_iou, init_cfg)