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","."]
docstr: Return semantic segmentation predictions in the original resolution.
  
  The input images are often resized when entering semantic segmentor. Moreover, in same
  cases, they also padded inside segmentor to be divisible by maximum network stride.
  As a result, we often need the predictions of the segmentor in a different
  resolution from its inputs.
  
  Args:
      result (Tensor): semantic segmentation prediction logits. A tensor of shape (C, H, W),
          where C is the number of classes, and H, W are the height and width of the prediction.
      img_size (tuple): image size that segmentor is taking as input.
      output_height, output_width: the desired output resolution.
  
  Returns:
      semantic segmentation prediction (Tensor): A tensor of the shape
          (C, output_height, output_width) that contains per-pixel soft predictions.
code: def sem_seg_postprocess(
      self, result, img_size, output_height, output_width
  ):
      """
      Return semantic segmentation predictions in the original resolution.
  
      The input images are often resized when entering semantic segmentor. Moreover, in same
      cases, they also padded inside segmentor to be divisible by maximum network stride.
      As a result, we often need the predictions of the segmentor in a different
      resolution from its inputs.
  
      Args:
          result (Tensor): semantic segmentation prediction logits. A tensor of shape (C, H, W),
              where C is the number of classes, and H, W are the height and width of the prediction.
          img_size (tuple): image size that segmentor is taking as input.
          output_height, output_width: the desired output resolution.
  
      Returns:
          semantic segmentation prediction (Tensor): A tensor of the shape
              (C, output_height, output_width) that contains per-pixel soft predictions.
      """
      result = paddle.unsqueeze(
          result[:, : img_size[0], : img_size[1]], axis=0
      )
      result = F.interpolate(
          result,
          size=(output_height, output_width),
          mode="bilinear",
          align_corners=False,
      )[0]
      return result
  
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 5 for calling the MaskFormer obj's underlying member method code with example usage: obj.sem_seg_postprocess(result, img_size, output_height, output_width) and returns: result