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 semantic_inference(self, mask_cls, mask_pred):
      mask_cls = F.softmax(mask_cls)[..., :-1]
      mask_pred = F.sigmoid(mask_pred)
      semseg = paddle.einsum("qc,qhw->chw", mask_cls, mask_pred)
      return semseg
  
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 3 for calling the MaskFormer obj's underlying member method code with example usage: obj.semantic_inference(mask_cls, mask_pred) and returns: semseg