class_docstr: RepPoint head.
  
  Args:
      point_feat_channels (int): Number of channels of points features.
      gradient_mul (float): The multiplier to gradients from
          points refinement and recognition.
      point_strides (Iterable): points strides.
      point_base_scale (int): bbox scale for assigning labels.
      loss_cls (dict): Config of classification loss.
      loss_bbox_init (dict): Config of initial points loss.
      loss_bbox_refine (dict): Config of points loss in refinement.
      use_grid_points (bool): If we use bounding box representation, the
      reppoints is represented as grid points on the bounding box.
      center_init (bool): Whether to use center point assignment.
      transform_method (str): The methods to transform RepPoints to bbox.
class_docstr_tok: ["RepPoint","head",".","Args",":","point_feat_channels","(","int",")",":","Number","of","channels","of","points","features",".","gradient_mul","(","float",")",":","The","multiplier","to","gradients","from","points","refinement","and","recognition",".","point_strides","(","Iterable",")",":","points","strides",".","point_base_scale","(","int",")",":","bbox","scale","for","assigning","labels",".","loss_cls","(","dict",")",":","Config","of","classification","loss",".","loss_bbox_init","(","dict",")",":","Config","of","initial","points","loss",".","loss_bbox_refine","(","dict",")",":","Config","of","points","loss","in","refinement",".","use_grid_points","(","bool",")",":","If","we","use","bounding","box","representation",",","the","reppoints","is","represented","as","grid","points","on","the","bounding","box",".","center_init","(","bool",")",":","Whether","to","use","center","point","assignment",".","transform_method","(","str",")",":","The","methods","to","transform","RepPoints","to","bbox","."]
docstr: Converting the points set into bounding box.
  
  :param pts: the input points sets (fields), each points
      set (fields) is represented as 2n scalar.
  :param y_first: if y_fisrt=True, the point set is represented as
      [y1, x1, y2, x2 ... yn, xn], otherwise the point set is
      represented as [x1, y1, x2, y2 ... xn, yn].
  :return: each points set is converting to a bbox [x1, y1, x2, y2].
docstr_tok: ["Converting","the","points","set","into","bounding","box",".",":","param","pts",":","the","input","points","sets","(","fields",")",",","each","points","set","(","fields",")","is","represented","as","2n","scalar",".",":","param","y_first",":","if","y_fisrt=True",",","the","point","set","is","represented","as","[","y1",",","x1",",","y2",",","x2","...","yn",",","xn","]",",","otherwise","the","point","set","is","represented","as","[","x1",",","y1",",","x2",",","y2","...","xn",",","yn","]",".",":","return",":","each","points","set","is","converting","to","a","bbox","[","x1",",","y1",",","x2",",","y2","]","."]
code: def points2bbox(self, pts, y_first=True):
      """Converting the points set into bounding box.
  
      :param pts: the input points sets (fields), each points
          set (fields) is represented as 2n scalar.
      :param y_first: if y_fisrt=True, the point set is represented as
          [y1, x1, y2, x2 ... yn, xn], otherwise the point set is
          represented as [x1, y1, x2, y2 ... xn, yn].
      :return: each points set is converting to a bbox [x1, y1, x2, y2].
      """
      pts_reshape = pts.view(pts.shape[0], -1, 2, *pts.shape[2:])
      pts_y = (
          pts_reshape[:, :, 0, ...]
          if y_first
          else pts_reshape[:, :, 1, ...]
      )
      pts_x = (
          pts_reshape[:, :, 1, ...]
          if y_first
          else pts_reshape[:, :, 0, ...]
      )
      if self.transform_method == "minmax":
          bbox_left = pts_x.min(dim=1, keepdim=True)[0]
          bbox_right = pts_x.max(dim=1, keepdim=True)[0]
          bbox_up = pts_y.min(dim=1, keepdim=True)[0]
          bbox_bottom = pts_y.max(dim=1, keepdim=True)[0]
          bbox = torch.cat(
              [bbox_left, bbox_up, bbox_right, bbox_bottom], dim=1
          )
      elif self.transform_method == "partial_minmax":
          pts_y = pts_y[:, :4, ...]
          pts_x = pts_x[:, :4, ...]
          bbox_left = pts_x.min(dim=1, keepdim=True)[0]
          bbox_right = pts_x.max(dim=1, keepdim=True)[0]
          bbox_up = pts_y.min(dim=1, keepdim=True)[0]
          bbox_bottom = pts_y.max(dim=1, keepdim=True)[0]
          bbox = torch.cat(
              [bbox_left, bbox_up, bbox_right, bbox_bottom], dim=1
          )
      elif self.transform_method == "moment":
          pts_y_mean = pts_y.mean(dim=1, keepdim=True)
          pts_x_mean = pts_x.mean(dim=1, keepdim=True)
          pts_y_std = torch.std(pts_y - pts_y_mean, dim=1, keepdim=True)
          pts_x_std = torch.std(pts_x - pts_x_mean, dim=1, keepdim=True)
          moment_transfer = (self.moment_transfer * self.moment_mul) + (
              self.moment_transfer.detach() * (1 - self.moment_mul)
          )
          moment_width_transfer = moment_transfer[0]
          moment_height_transfer = moment_transfer[1]
          half_width = pts_x_std * torch.exp(moment_width_transfer)
          half_height = pts_y_std * torch.exp(moment_height_transfer)
          bbox = torch.cat(
              [
                  pts_x_mean - half_width,
                  pts_y_mean - half_height,
                  pts_x_mean + half_width,
                  pts_y_mean + half_height,
              ],
              dim=1,
          )
      else:
          raise NotImplementedError
      return bbox
  
imports: import numpy
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init
  from mmcv.ops import DeformConv2d
  from mmdet.core import PointGenerator, build_assigner, build_sampler, images_to_levels, multi_apply, multiclass_nms, unmap
  from ..builder import HEADS, build_loss
  from .anchor_free_head import AnchorFreeHead
label_desc: Use image node_id 4 for calling the RepPointsHead obj's underlying member method code with example usage: obj.points2bbox(pts, y_first) and returns: bbox