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","."]
docstr: Sample points for testing.
  Find ``num_points`` most uncertain points from ``uncertainty_map``.
  
  Args:
      seg_logits (Tensor): A tensor of shape (batch_size, num_classes,
          height, width) for class-specific or class-agnostic prediction.
      uncertainty_func (func): uncertainty calculation function.
      cfg (dict): Testing config of point head.
  Returns:
      point_indices (Tensor): A tensor of shape (batch_size, num_points)
          that contains indices from [0, height x width) of the most
          uncertain points.
      point_coords (Tensor): A tensor of shape (batch_size, num_points,
          2) that contains [0, 1] x [0, 1] normalized coordinates of the
          most uncertain points from the ``height x width`` grid .
code: def get_points_test(self, seg_logits, uncertainty_func):  # finish
      """
      Sample points for testing.
      Find ``num_points`` most uncertain points from ``uncertainty_map``.
  
      Args:
          seg_logits (Tensor): A tensor of shape (batch_size, num_classes,
              height, width) for class-specific or class-agnostic prediction.
          uncertainty_func (func): uncertainty calculation function.
          cfg (dict): Testing config of point head.
      Returns:
          point_indices (Tensor): A tensor of shape (batch_size, num_points)
              that contains indices from [0, height x width) of the most
              uncertain points.
          point_coords (Tensor): A tensor of shape (batch_size, num_points,
              2) that contains [0, 1] x [0, 1] normalized coordinates of the
              most uncertain points from the ``height x width`` grid .
      """
  
      num_points = self.subdivision_num_points
      uncertainty_map = uncertainty_func(seg_logits)
      batch_size = paddle.shape(uncertainty_map)[0:1]
      height = paddle.shape(uncertainty_map)[2:3]
      width = paddle.shape(uncertainty_map)[3:4]
      h_step = 1.0 / height
      w_step = 1.0 / width
  
      uncertainty_map = uncertainty_map.reshape(
          [batch_size, height * width]
      )
      num_points = paddle.min(
          paddle.concat([height * width, num_points])
      )
      point_indices = paddle.topk(uncertainty_map, num_points, axis=1)[
          1
      ]
      point_coords = paddle.zeros(
          [batch_size, num_points, 2], dtype="float32"
      )
      point_coords[:, :, 0] = (
          w_step / 2.0
          + (point_indices % width).astype("float32") * w_step
      )
      point_coords[:, :, 1] = (
          h_step / 2.0
          + (point_indices // width).astype("float32") * h_step
      )
      return point_indices, point_coords
  
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 7 for calling the PointHead obj's underlying member method code with example usage: obj.get_points_test(seg_logits, uncertainty_func) and returns: point_indices,  point_coords