code: def __init__(
      self,
      *args,
      num_query=900,
      transformer=None,
      in_channels=2048,
      max_pos_coords=300,
      dn_cfg=None,
      use_zero_padding=False,
      positional_encoding=dict(
          type="SinePositionalEncoding", num_feats=128, normalize=True
      ),
      **kwargs,
  ):
      self.with_box_refine = True
      self.mixed_selection = True
      self.in_channels = in_channels
      self.max_pos_coords = max_pos_coords
      self.positional_encoding = positional_encoding
      self.num_query = num_query
      self.use_zero_padding = use_zero_padding
  
      if "two_stage_num_proposals" in transformer:
          assert (
              transformer["two_stage_num_proposals"] == num_query
          ), "two_stage_num_proposals must be equal to num_query for DINO"
      else:
          transformer["two_stage_num_proposals"] = num_query
      transformer["as_two_stage"] = True
      if self.mixed_selection:
          transformer["mixed_selection"] = self.mixed_selection
      self.transformer = transformer
      self.act_cfg = transformer.get(
          "act_cfg", dict(type="ReLU", inplace=True)
      )
  
      super().__init__(*args, **kwargs)
  
      self.activate = MODELS.build(self.act_cfg)
      self.positional_encoding = MODELS.build(self.positional_encoding)
      self.init_denoising(dn_cfg)
  
imports: import copy
  from typing import List
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import Linear
  from mmcv.ops import batched_nms
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.models import DINOHead
  from mmdet.models.layers import CdnQueryGenerator
  from mmdet.models.layers.transformer import inverse_sigmoid
  from mmdet.models.utils import multi_apply
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox_cxcywh_to_xyxy, bbox_overlaps, bbox_xyxy_to_cxcywh
  from mmdet.utils import InstanceList, reduce_mean
label_desc: Use image node_id 1 to create a new CoDINOHead object from inherited base classes: DINOHead with example: obj = CoDINOHead()