class_docstr: This head is the implementation of "Unified Perceptual Parsing for Scene Understanding".
  This is heavily based on https://github.com/czczup/ViT-Adapter
  
  Args:
      num_classes (int): The unique number of target classes.
      in_channels (list[int]): The channels of input features.
      channels (int, optional): The channels of inter layers in upernet head. Default: 512.
      pool_scales (list, optional): The scales in PPM. Default: [1, 2, 3, 6].
      dropout_ratio (float, optional): The dropout ratio for upernet head. Default: 0.1.
      aux_loss (bool, optional): A bool value indicates whether adding auxiliary loss. Default: True.
      aux_channels (int, optional): The channels of inter layers in auxiliary head. Default: 256.
      align_corners (bool, optional): An argument of F.interpolate. It should be set to False when the feature size is even,
          e.g. 1024x512, otherwise it is True, e.g. 769x769. Default: False.
class_docstr_tok: ["This","head","is","the","implementation","of","``","Unified","Perceptual","Parsing","for","Scene","Understanding","''",".","This","is","heavily","based","on","https",":","\/\/github.com\/czczup\/ViT-Adapter","Args",":","num_classes","(","int",")",":","The","unique","number","of","target","classes",".","in_channels","(","list","[","int","]",")",":","The","channels","of","input","features",".","channels","(","int",",","optional",")",":","The","channels","of","inter","layers","in","upernet","head",".","Default",":","512.","pool_scales","(","list",",","optional",")",":","The","scales","in","PPM",".","Default",":","[","1",",","2",",","3",",","6","]",".","dropout_ratio","(","float",",","optional",")",":","The","dropout","ratio","for","upernet","head",".","Default",":","0.1.","aux_loss","(","bool",",","optional",")",":","A","bool","value","indicates","whether","adding","auxiliary","loss",".","Default",":","True",".","aux_channels","(","int",",","optional",")",":","The","channels","of","inter","layers","in","auxiliary","head",".","Default",":","256.","align_corners","(","bool",",","optional",")",":","An","argument","of","F.interpolate",".","It","should","be","set","to","False","when","the","feature","size","is","even",",","e.g",".","1024x512",",","otherwise","it","is","True",",","e.g",".","769x769",".","Default",":","False","."]
code: def __init__(
      self,
      num_classes,
      in_channels,
      channels,
      pool_scales=[1, 2, 3, 6],
      dropout_ratio=0.1,
      aux_loss=False,
      aux_channels=256,
      align_corners=False,
  ):
      super().__init__()
      self.align_corners = align_corners
  
      # PSP Module
      self.psp_modules = PPM(
          pool_scales,
          in_channels[-1],
          channels,
          align_corners=align_corners,
      )
      self.bottleneck = ConvBNReLU(
          in_channels[-1] + len(pool_scales) * channels,
          channels,
          3,
          padding=1,
      )
      # FPN Module
      self.lateral_convs = nn.LayerList()
      self.fpn_convs = nn.LayerList()
      for ch in in_channels[:-1]:  # skip the top layer
          l_conv = ConvBNReLU(ch, channels, 1)
          fpn_conv = ConvBNReLU(channels, channels, 3, padding=1)
          self.lateral_convs.append(l_conv)
          self.fpn_convs.append(fpn_conv)
  
      self.fpn_bottleneck = ConvBNReLU(
          len(in_channels) * channels, channels, 3, padding=1
      )
      if dropout_ratio > 0:
          self.dropout = nn.Dropout2D(dropout_ratio)
      else:
          self.dropout = None
      self.conv_seg = nn.Conv2D(channels, num_classes, kernel_size=1)
  
      self.aux_loss = aux_loss
      if self.aux_loss:
          self.aux_conv = ConvBNReLU(
              in_channels[2], aux_channels, 3, padding=1
          )
          self.aux_conv_seg = nn.Conv2D(
              aux_channels, num_classes, kernel_size=1
          )
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg import utils
  from paddleseg.cvlibs import manager
  from paddleseg.models import layers
label_desc: Use image node_id 1 to create a new UPerNetHead object from inherited base classes: nn with example: obj = UPerNetHead(num_classes, in_channels, channels, pool_scales, dropout_ratio, aux_loss, aux_channels, align_corners)