class_docstr: The Mask2Former implementation based on PaddlePaddle.
  
  The original article refers to
   Bowen Cheng, et, al. "Masked-attention Mask Transformer for Universal Image Segmentation"
   (https://arxiv.org/abs/2112.01527)
  
  Args:
      num_classes (int): The number of target semantic classes.
      backbone (paddle.nn.Layer): The backbone network. Currently supports ResNet50-vd/ResNet101-vd/Xception65.
      backbone_indices (tuple|None): The indices of backbone output feature maps to use.
      backbone_feat_os (tuple|None): The output strides of backbone output feature maps.
      num_queries (int): The number of queries to use in the decoder.
      pd_num_heads (int): The number of heads of the multi-head attention modules used in the pixel decoder.
      pd_conv_dim (int): The number of convolutional filters used for input projection in the pixel decoder.
      pd_mask_dim (int): The number of convolutional filters used to produce mask features in the pixel decoder.
      pd_ff_dim (int): The number of feature channels in the feed-forward networks used in the pixel decoder.
      pd_num_layers (int): The number of basic layers used in the pixel decoder.
      pd_common_stride (int): The base output stride of feature maps in the pixel decoder.
      td_hidden_dim (int): The dimension of the hidden features in the transformer decoder.
      td_num_head (int): The number of heads of the multi-head attention modules used in the transformer decoder.
      td_ff_dim (int): The number of feature channels in the feed-forward networks used in the transformer decoder.
      td_num_layers (int): The number of basic layers used in the transformer decoder.
      td_pre_norm (bool): Whether or not to normalize features before the attention operation in the transformer 
          decoder.
      td_mask_dim (bool): The number of convolutional filters used for mask prediction in the transformer decoder.
      td_enforce_proj (bool): Whether or not to use an additional input projection layer in the transformer decoder.
      pretrained (str|None, optional): The path or url of pretrained model. If None, no pretrained model will be used.
          Default: None.
code: def __init__(
      self,
      num_classes,
      backbone,
      backbone_indices,
      backbone_feat_os,
      num_queries,
      pd_num_heads,
      pd_conv_dim,
      pd_mask_dim,
      pd_ff_dim,
      pd_num_layers,
      pd_common_stride,
      td_hidden_dim,
      td_num_heads,
      td_ff_dim,
      td_num_layers,
      td_pre_norm,
      td_mask_dim,
      td_enforce_proj,
      pretrained=None,
  ):
      super().__init__()
  
      self.backbone = backbone
      self.num_queries = num_queries
      self.pixel_decoder = MSDeformAttnPixelDecoder(
          in_feat_strides=backbone_feat_os,
          in_feat_chns=self.backbone.feat_channels,
          feat_indices=backbone_indices,
          num_heads=pd_num_heads,
          ff_dim=pd_ff_dim,
          num_enc_layers=pd_num_layers,
          conv_dim=pd_conv_dim,
          mask_dim=pd_mask_dim,
          common_stride=pd_common_stride,
      )
      self.transformer_decoder = MultiScaleMaskedTransformerDecoder(
          in_channels=pd_conv_dim,
          num_classes=num_classes,
          hidden_dim=td_hidden_dim,
          num_queries=self.num_queries,
          num_heads=td_num_heads,
          ff_dim=td_ff_dim,
          num_dec_layers=td_num_layers,
          pre_norm=td_pre_norm,
          mask_dim=td_mask_dim,
          enforce_input_proj=td_enforce_proj,
      )
  
      self.pretrained = pretrained
      self.init_weight()
  
file_path: PaddleSeg/contrib/PanopticSeg/paddlepanseg/models/mask2former/mask2former.py
imports: import paddle.nn
  import paddle.nn.functional
  from paddleseg.utils import utils
  from paddlepanseg.cvlibs import manager
  from paddlepanseg.cvlibs import build_info_dict
  from .pixel_decoder import MSDeformAttnPixelDecoder
  from .transformer_decoder import MultiScaleMaskedTransformerDecoder
label_desc: Use image node_id 1 to create a new Mask2Former object from inherited base classes: nn with example: obj = Mask2Former(num_classes, backbone, backbone_indices, backbone_feat_os, num_queries, pd_num_heads, pd_conv_dim, pd_mask_dim, pd_ff_dim, pd_num_layers, pd_common_stride, td_hidden_dim, td_num_heads, td_ff_dim, td_num_layers, td_pre_norm, td_mask_dim, td_enforce_proj, pretrained)