class_docstr: The PointHead implementation based on PaddlePaddle.
  
  PointHead use shared multi-layer perceptron (equivalent to
  nn.Conv1D) to predict the logit of input points. The fine-grained feature
  and coarse feature will be concatenate together for predication.
  
  The original article refers to:
  Kirillov A , Wu Y , He K , et al "PointRend: Image Segmentation As Rendering."
  (https://arxiv.org/abs/1912.08193)
  
  Args:
      num_classes (int): Number of classes for logits. Default: 19.
      num_fcs (int, optional): Number of fc layers in the head. Default: 3.
      in_channels (list): input channels of fc block. Default: [256].
      out_channels (int, optional): Fc block's output channels. Default: 256.
      in_index (list): The indexs of input features to use. Default: [0].
      num_points (int, optional): The number of point in training mode. Default: 2048.
      oversample_ratio (int, optional): The sample ratio of points when in training mode.
          sampled_point = num_points * oversample_ratio. Default: 3.
      importance_sample_ratio(float, optional): The importance sample ratio for compute num_uncertain_points. Default: 0.75.
      scale_factor(int, optional): The scale factor of F.interpolate in refine seg logits stage when in inference. Default: 2.
      subdivision_steps(int, optional): Then refine steps in refine seg logits stage when in inference. Default: 2.
      subdivision_num_points(int, optional): The points number for refine seg logits when in inference. Default: 8196.
      dropout_ratio(float, optional): If the dropout_ratio >0, to use Dropout before output and the p of dropout is dropout_ratio. Default: 0.1.
      coarse_pred_each_layer(bool, optional): Whether concatenate coarse feature with
          the output of each fc layer. Default: True.
      conv_cfg(str): The config of Conv. Default: 'Conv1D'.
      input_transform(str): The features transform method of inputs.
          it can be found in function '_transform_inputs'. Defalut: 'multiple_select'.
      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: ["The","PointHead","implementation","based","on","PaddlePaddle",".","PointHead","use","shared","multi-layer","perceptron","(","equivalent","to","nn.Conv1D",")","to","predict","the","logit","of","input","points",".","The","fine-grained","feature","and","coarse","feature","will","be","concatenate","together","for","predication",".","The","original","article","refers","to",":","Kirillov","A",",","Wu","Y",",","He","K",",","et","al","``","PointRend",":","Image","Segmentation","As","Rendering",".","''","(","https",":","\/\/arxiv.org\/abs\/1912.08193",")","Args",":","num_classes","(","int",")",":","Number","of","classes","for","logits",".","Default",":","19.","num_fcs","(","int",",","optional",")",":","Number","of","fc","layers","in","the","head",".","Default",":","3.","in_channels","(","list",")",":","input","channels","of","fc","block",".","Default",":","[","256","]",".","out_channels","(","int",",","optional",")",":","Fc","block","'s","output","channels",".","Default",":","256.","in_index","(","list",")",":","The","indexs","of","input","features","to","use",".","Default",":","[","0","]",".","num_points","(","int",",","optional",")",":","The","number","of","point","in","training","mode",".","Default",":","2048.","oversample_ratio","(","int",",","optional",")",":","The","sample","ratio","of","points","when","in","training","mode",".","sampled_point","=","num_points","*","oversample_ratio",".","Default",":","3.","importance_sample_ratio","(","float",",","optional",")",":","The","importance","sample","ratio","for","compute","num_uncertain_points",".","Default",":","0.75.","scale_factor","(","int",",","optional",")",":","The","scale","factor","of","F.interpolate","in","refine","seg","logits","stage","when","in","inference",".","Default",":","2.","subdivision_steps","(","int",",","optional",")",":","Then","refine","steps","in","refine","seg","logits","stage","when","in","inference",".","Default",":","2.","subdivision_num_points","(","int",",","optional",")",":","The","points","number","for","refine","seg","logits","when","in","inference",".","Default",":","8196.","dropout_ratio","(","float",",","optional",")",":","If","the","dropout_ratio",">","0",",","to","use","Dropout","before","output","and","the","p","of","dropout","is","dropout_ratio",".","Default",":","0.1.","coarse_pred_each_layer","(","bool",",","optional",")",":","Whether","concatenate","coarse","feature","with","the","output","of","each","fc","layer",".","Default",":","True",".","conv_cfg","(","str",")",":","The","config","of","Conv",".","Default",":","'Conv1D","'",".","input_transform","(","str",")",":","The","features","transform","method","of","inputs",".","it","can","be","found","in","function","'_transform_inputs","'",".","Defalut",":","'multiple_select","'",".","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=19,
      num_fcs=3,
      in_channels=[256],
      out_channels=256,
      in_index=[0],
      num_points=2048,
      oversample_ratio=3,
      importance_sample_ratio=0.75,
      scale_factor=2,
      subdivision_steps=2,
      subdivision_num_points=8196,
      dropout_ratio=0.1,
      coarse_pred_each_layer=True,
      conv_cfg="Conv1D",
      input_transform="multiple_select",  # resize_concat
      align_corners=False,
  ):
      super(PointHead, self).__init__()
  
      self.in_channels = in_channels
      self.channels = out_channels
      self.in_index = in_index
      self.num_classes = num_classes
      self.num_fcs = num_fcs
      self.num_points = num_points
      self.oversample_ratio = oversample_ratio
      self.importance_sample_ratio = importance_sample_ratio
      self.scale_factor = scale_factor
      self.subdivision_steps = subdivision_steps
      self.subdivision_num_points = paddle.to_tensor(
          [subdivision_num_points], dtype="int32"
      )
      self.dropout_ratio = dropout_ratio
      self.coarse_pred_each_layer = coarse_pred_each_layer
      self.align_corners = align_corners
      self.input_transform = input_transform
  
      fc_in_channels = sum(self.in_channels) + self.num_classes
      fc_channels = self.channels
      self.fcs = nn.LayerList()
      for k in range(num_fcs):
          fc = ConvModule(
              fc_in_channels,
              fc_channels,
              kernel_size=1,
              stride=1,
              padding=0,
              conv_cfg=conv_cfg,
          )
          self.fcs.append(fc)
          fc_in_channels = fc_channels
          fc_in_channels += (
              self.num_classes if self.coarse_pred_each_layer else 0
          )
      self.fc_seg = nn.Conv1D(
          fc_in_channels,
          self.num_classes,
          kernel_size=1,
          stride=1,
          padding=0,
      )
  
      if self.dropout_ratio > 0:
          self.dropout = nn.Dropout(self.dropout_ratio)
      else:
          self.dropout = None
  
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
  from paddleseg.models import layers
  from paddleseg.utils import utils
label_desc: Use image node_id 1 to create a new PointHead object from inherited base classes: nn with example: obj = PointHead(num_classes, num_fcs, in_channels, out_channels, in_index, num_points, oversample_ratio, importance_sample_ratio, scale_factor, subdivision_steps, subdivision_num_points, dropout_ratio, coarse_pred_each_layer, conv_cfg, input_transform, align_corners)