class_docstr: Head of DDQDETR: Dense Distinct Query for
      End-to-End Object Detection.
  
  Code is modified from the `official github repo
      <https://github.com/jshilong/DDQ>`_.
  
  More details can be found in the `paper
      <https://arxiv.org/abs/2303.12776>`_ .
  
  Args:
      aux_num_pos (int): Number of positive targets assigned to a
          perdicted object. Defaults to 4.
docstr: Initialize classification branch and regression branch of aux head
  for dense queries.
docstr_tok: ["Initialize","classification","branch","and","regression","branch","of","aux","head","for","dense","queries","."]
code: def _init_layers(self) -> None:
      """Initialize classification branch and regression branch of aux head
      for dense queries."""
      super(DDQDETRHead, self)._init_layers()
      # If decoder `num_layers` = 6 and `as_two_stage` = True, then:
      #   1) 6 main heads are required for
      #       each decoder output of distinct queries.
      #   2) 1 main head is required for `output_memory` of distinct queries.
      #   3) 1 aux head is required for `output_memory` of dense queries,
      #       which is done by code below this comment.
      # So 8 heads are required in sum.
      # aux head for dense queries on encoder feature map
      self.cls_branches.append(copy.deepcopy(self.cls_branches[-1]))
      self.reg_branches.append(copy.deepcopy(self.reg_branches[-1]))
  
      # If decoder `num_layers` = 6 and `as_two_stage` = True, then:
      #   6 aux heads are required for each decoder output of dense queries.
      # So 8 + 6 = 14 heads and heads are requires in sum.
      # self.num_pred_layer is 7
      # aux head for dense queries in decoder
      self.aux_cls_branches = nn.ModuleList(
          [
              copy.deepcopy(self.cls_branches[-1])
              for _ in range(self.num_pred_layer - 1)
          ]
      )
      self.aux_reg_branches = nn.ModuleList(
          [
              copy.deepcopy(self.reg_branches[-1])
              for _ in range(self.num_pred_layer - 1)
          ]
      )
  
imports: import copy
  from typing import Dict, List, Tuple
  import torch
  from mmengine.model import bias_init_with_prob, constant_init
  from torch import Tensor, nn
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox_cxcywh_to_xyxy
  from mmdet.utils import InstanceList, OptInstanceList, reduce_mean
  from ..layers import inverse_sigmoid
  from ..losses import DDQAuxLoss
  from ..utils import multi_apply
  from .dino_head import DINOHead
label_desc: Use image node_id 2 for calling the DDQDETRHead obj's underlying member method code with example usage: obj._init_layers() without return types