class_docstr: PicoHeadV2
  Args:
      conv_feat (object): Instance of 'PicoFeat'
      num_classes (int): Number of classes
      fpn_stride (list): The stride of each FPN Layer
      prior_prob (float): Used to set the bias init for the class prediction layer
      loss_class (object): Instance of VariFocalLoss.
      loss_dfl (object): Instance of DistributionFocalLoss.
      loss_bbox (object): Instance of bbox loss.
      assigner (object): Instance of label assigner.
      reg_max: Max value of integral set :math: `{0, ..., reg_max}`
              n QFL setting. Default: 7.
class_docstr_tok: ["PicoHeadV2","Args",":","conv_feat","(","object",")",":","Instance","of","'PicoFeat'","num_classes","(","int",")",":","Number","of","classes","fpn_stride","(","list",")",":","The","stride","of","each","FPN","Layer","prior_prob","(","float",")",":","Used","to","set","the","bias","init","for","the","class","prediction","layer","loss_class","(","object",")",":","Instance","of","VariFocalLoss",".","loss_dfl","(","object",")",":","Instance","of","DistributionFocalLoss",".","loss_bbox","(","object",")",":","Instance","of","bbox","loss",".","assigner","(","object",")",":","Instance","of","label","assigner",".","reg_max",":","Max","value","of","integral","set",":","math",":","`","{","0",",","...",",","reg_max","}","`","n","QFL","setting",".","Default",":","7","."]
code: def __init__(
      self,
      conv_feat="PicoFeatV2",
      dgqp_module=None,
      num_classes=80,
      fpn_stride=[8, 16, 32],
      prior_prob=0.01,
      use_align_head=True,
      loss_class="VariFocalLoss",
      loss_dfl="DistributionFocalLoss",
      loss_bbox="GIoULoss",
      static_assigner_epoch=60,
      static_assigner="ATSSAssigner",
      assigner="TaskAlignedAssigner",
      reg_max=16,
      feat_in_chan=96,
      nms=None,
      nms_pre=1000,
      cell_offset=0,
      act="hard_swish",
      grid_cell_scale=5.0,
      eval_size=None,
  ):
      super(PicoHeadV2, self).__init__(
          conv_feat=conv_feat,
          dgqp_module=dgqp_module,
          num_classes=num_classes,
          fpn_stride=fpn_stride,
          prior_prob=prior_prob,
          loss_class=loss_class,
          loss_dfl=loss_dfl,
          loss_bbox=loss_bbox,
          reg_max=reg_max,
          feat_in_chan=feat_in_chan,
          nms=nms,
          nms_pre=nms_pre,
          cell_offset=cell_offset,
      )
      self.conv_feat = conv_feat
      self.num_classes = num_classes
      self.fpn_stride = fpn_stride
      self.prior_prob = prior_prob
      self.loss_vfl = loss_class
      self.loss_dfl = loss_dfl
      self.loss_bbox = loss_bbox
  
      self.static_assigner_epoch = static_assigner_epoch
      self.static_assigner = static_assigner
      self.assigner = assigner
  
      self.reg_max = reg_max
      self.feat_in_chan = feat_in_chan
      self.nms = nms
      self.nms_pre = nms_pre
      self.cell_offset = cell_offset
      self.act = act
      self.grid_cell_scale = grid_cell_scale
      self.use_align_head = use_align_head
      self.cls_out_channels = self.num_classes
      self.eval_size = eval_size
  
      bias_init_value = -math.log(
          (1 - self.prior_prob) / self.prior_prob
      )
      # Clear the super class initialization
      self.gfl_head_cls = None
      self.gfl_head_reg = None
      self.scales_regs = None
  
      self.head_cls_list = nn.LayerList()
      self.head_reg_list = nn.LayerList()
      self.cls_align = nn.LayerList()
  
      for i in range(len(fpn_stride)):
          head_cls = self.add_sublayer(
              "head_cls" + str(i),
              nn.Conv2D(
                  in_channels=self.feat_in_chan,
                  out_channels=self.cls_out_channels,
                  kernel_size=1,
                  stride=1,
                  padding=0,
                  weight_attr=ParamAttr(
                      initializer=Normal(mean=0.0, std=0.01)
                  ),
                  bias_attr=ParamAttr(
                      initializer=Constant(value=bias_init_value)
                  ),
              ),
          )
          self.head_cls_list.append(head_cls)
          head_reg = self.add_sublayer(
              "head_reg" + str(i),
              nn.Conv2D(
                  in_channels=self.feat_in_chan,
                  out_channels=4 * (self.reg_max + 1),
                  kernel_size=1,
                  stride=1,
                  padding=0,
                  weight_attr=ParamAttr(
                      initializer=Normal(mean=0.0, std=0.01)
                  ),
                  bias_attr=ParamAttr(initializer=Constant(value=0)),
              ),
          )
          self.head_reg_list.append(head_reg)
          if self.use_align_head:
              self.cls_align.append(
                  DPModule(
                      self.feat_in_chan,
                      1,
                      5,
                      act=self.act,
                      use_act_in_out=False,
                  )
              )
  
      # initialize the anchor points
      if self.eval_size:
          (
              self.anchor_points,
              self.stride_tensor,
          ) = self._generate_anchors()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from paddle.nn.initializer import Normal, Constant
  from ppdet.modeling.ops import get_static_shape
  from ..initializer import normal_
  from ..assigners.utils import generate_anchors_for_grid_cell
  from ..bbox_utils import bbox_center, batch_distance2bbox, bbox2distance
  from ppdet.core.workspace import register
  from ppdet.modeling.layers import ConvNormLayer
  from .simota_head import OTAVFLHead
  from .gfl_head import Integral, GFLHead
  from ppdet.modeling.necks.csp_pan import DPModule
label_desc: Use image node_id 1 to create a new PicoHeadV2 object from inherited base classes: GFLHead with example: obj = PicoHeadV2(conv_feat, dgqp_module, num_classes, fpn_stride, prior_prob, use_align_head, loss_class, loss_dfl, loss_bbox, static_assigner_epoch, static_assigner, assigner, reg_max, feat_in_chan, nms, nms_pre, cell_offset, act, grid_cell_scale, eval_size)