class_docstr: The MaskFormer model implement on PaddlePaddle.
  
  The original article please refer to :
  Cheng, Bowen, Alex Schwing, and Alexander Kirillov. "Per-pixel classification is not all you need for semantic segmentation." Advances in Neural Information Processing Systems 34 (2021): 17864-17875.
  (https://github.com/facebookresearch/MaskFormer)
  
  Args:
      num_classes(int): The number of classes that you want the model to classify.
      backbone(nn.Layer): The backbone module defined in the paddleseg backbones.
      sem_seg_postprocess_before_inference(bool): If True, do result postprocess before inference. 
      pretrained(str): The path to the pretrained model of MaskFormer.
class_docstr_tok: ["The","MaskFormer","model","implement","on","PaddlePaddle",".","The","original","article","please","refer","to",":","Cheng",",","Bowen",",","Alex","Schwing",",","and","Alexander","Kirillov",".","``","Per-pixel","classification","is","not","all","you","need","for","semantic","segmentation",".","''","Advances","in","Neural","Information","Processing","Systems","34","(","2021",")",":","17864-17875",".","(","https",":","\/\/github.com\/facebookresearch\/MaskFormer",")","Args",":","num_classes","(","int",")",":","The","number","of","classes","that","you","want","the","model","to","classify",".","backbone","(","nn.Layer",")",":","The","backbone","module","defined","in","the","paddleseg","backbones",".","sem_seg_postprocess_before_inference","(","bool",")",":","If","True",",","do","result","postprocess","before","inference",".","pretrained","(","str",")",":","The","path","to","the","pretrained","model","of","MaskFormer","."]
code: def forward(self, x):
      features = self.backbone(x)
      outputs = self.seghead(features)
  
      if self.training:
          return [outputs]
      else:
          mask_cls_results = outputs["pred_logits"]  # [2, 100, 151]
          mask_pred_results = outputs[
              "pred_masks"
          ]  # [2, 100, 512, 512]
  
          mask_pred_results = F.interpolate(
              mask_pred_results,
              size=(x.shape[-2], x.shape[-1]),
              mode="bilinear",
              align_corners=False,
          )
          processed_results = []
  
          for mask_cls_result, mask_pred_result in zip(
              mask_cls_results, mask_pred_results
          ):
              image_size = x.shape[-2:]
              if self.sem_seg_postprocess_before_inference:
                  mask_pred_result = self.sem_seg_postprocess(
                      mask_pred_result,
                      image_size,
                      image_size[0],
                      image_size[1],
                  )
  
              r = self.semantic_inference(
                  mask_cls_result, mask_pred_result
              )
  
              if not self.sem_seg_postprocess_before_inference:
                  r = self.sem_seg_postprocess(
                      r, image_size, image_size[0], image_size[1]
                  )
              processed_results.append({"sem_seg": r})
  
          r = r[None, ...]
          return [r]
  
imports: import math
  import copy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.models import layers
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.utils import utils
  from paddleseg.core.train import check_logits_losses
label_desc: Use image node_id 4 for calling the MaskFormer obj's underlying member method code with example usage: obj.forward(x) and returns: list, list