class_docstr: The PP_MobileSeg implementation based on PaddlePaddle.
  
  The original article refers to "Shiyu Tang, Ting Sun, Juncai Peng, Guowei Chen, Yuying Hao, 
  Manhui Lin, Zhihong Xiao, Jiangbin You, Yi Liu. PP-MobileSeg: Explore the Fast and Accurate 
  Semantic Segmentation Model on Mobile Devices. https://arxiv.org/abs/2304.05152"
  
  
  Args:
      num_classes(int): The unique number of target classes.
      backbone(nn.Layer): Backbone network.
      head_use_dw (bool, optional): Whether the head use depthwise convolutions. Default: True.
      align_corners (bool, optional): Set the align_corners in resizing. Default: False.
      pretrained (str, optional): The path or url of pretrained model. Default: None.
      upsample (str, optional): The type of upsample module, valid for VIM is recommend to be used during inference. Default: intepolate.
class_docstr_tok: ["The","PP_MobileSeg","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","``","Shiyu","Tang",",","Ting","Sun",",","Juncai","Peng",",","Guowei","Chen",",","Yuying","Hao",",","Manhui","Lin",",","Zhihong","Xiao",",","Jiangbin","You",",","Yi","Liu",".","PP-MobileSeg",":","Explore","the","Fast","and","Accurate","Semantic","Segmentation","Model","on","Mobile","Devices",".","https",":","\/\/arxiv.org\/abs\/2304.05152","''","Args",":","num_classes","(","int",")",":","The","unique","number","of","target","classes",".","backbone","(","nn.Layer",")",":","Backbone","network",".","head_use_dw","(","bool",",","optional",")",":","Whether","the","head","use","depthwise","convolutions",".","Default",":","True",".","align_corners","(","bool",",","optional",")",":","Set","the","align_corners","in","resizing",".","Default",":","False",".","pretrained","(","str",",","optional",")",":","The","path","or","url","of","pretrained","model",".","Default",":","None",".","upsample","(","str",",","optional",")",":","The","type","of","upsample","module",",","valid","for","VIM","is","recommend","to","be","used","during","inference",".","Default",":","intepolate","."]
code: def forward(self, x):
      x_hw = x.shape[2:]
      x = self.backbone(x)
      x = self.decode_head(x)
      if (
          self.upsample == "intepolate"
          or self.training
          or self.num_classes < 30
      ):
          x = F.interpolate(
              x, x_hw, mode="bilinear", align_corners=self.align_corners
          )
      elif self.upsample == "vim":
          labelset = paddle.unique(paddle.argmax(x, 1))
          x = paddle.gather(x, labelset, axis=1)
          x = F.interpolate(
              x, x_hw, mode="bilinear", align_corners=self.align_corners
          )
  
          pred = paddle.argmax(x, 1)
          pred_retrieve = paddle.zeros(pred.shape, dtype="int32")
          for i, val in enumerate(labelset):
              pred_retrieve[pred == i] = labelset[i].cast("int32")
  
          x = pred_retrieve
      else:
          raise NotImplementedError(
              self.upsample, " is not implemented"
          )
  
      return [x]
  
file_path: PaddleSeg/paddleseg/models/pp_mobileseg.py
imports: import warnings
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
  from paddleseg.models import layers
  from paddleseg.utils import utils
  from paddleseg.models.backbones.strideformer import ConvBNAct
label_desc: Use image node_id 3 for calling the PPMobileSeg obj's underlying member method code with example usage: obj.forward(x) and returns: list