class_docstr: Implementation of `DINO: DETR with Improved DeNoising Anchor Boxes
  for End-to-End Object Detection <https://arxiv.org/abs/2203.03605>`_
  
  Code is modified from the `official github repo
  <https://github.com/IDEA-Research/DINO>`_.
  
  Args:
      dn_cfg (:obj:`ConfigDict` or dict, optional): Config of denoising
          query generator. Defaults to `None`.
class_docstr_tok: ["Implementation","of","`","DINO",":","DETR","with","Improved","DeNoising","Anchor","Boxes","for","End-to-End","Object","Detection","<","https",":","\/\/arxiv.org\/abs\/2203.03605",">","`","_","Code","is","modified","from","the","`","official","github","repo","<","https",":","\/\/github.com\/IDEA-Research\/DINO",">","`","_",".","Args",":","dn_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","of","denoising","query","generator",".","Defaults","to","`","None","`","."]
docstr: Initialize layers except for backbone, neck and bbox_head.
docstr_tok: ["Initialize","layers","except","for","backbone",",","neck","and","bbox_head","."]
code: def _init_layers(self) -> None:
      """Initialize layers except for backbone, neck and bbox_head."""
      self.positional_encoding = SinePositionalEncoding(
          **self.positional_encoding
      )
      self.encoder = DeformableDetrTransformerEncoder(**self.encoder)
      self.decoder = DinoTransformerDecoder(**self.decoder)
      self.embed_dims = self.encoder.embed_dims
      self.query_embedding = nn.Embedding(
          self.num_queries, self.embed_dims
      )
      # NOTE In DINO, the query_embedding only contains content
      # queries, while in Deformable DETR, the query_embedding
      # contains both content and spatial queries, and in DETR,
      # it only contains spatial queries.
  
      num_feats = self.positional_encoding.num_feats
      assert num_feats * 2 == self.embed_dims, (
          f"embed_dims should be exactly 2 times of num_feats. "
          f"Found {self.embed_dims} and {num_feats}."
      )
  
      self.level_embed = nn.Parameter(
          torch.Tensor(self.num_feature_levels, self.embed_dims)
      )
      self.memory_trans_fc = nn.Linear(self.embed_dims, self.embed_dims)
      self.memory_trans_norm = nn.LayerNorm(self.embed_dims)
  
file_path: mmdetection/mmdet/models/detectors/dino.py
imports: from typing import Dict, Optional, Tuple
  import torch
  from torch import Tensor, nn
  from torch.nn.init import normal_
  from mmdet.registry import MODELS
  from mmdet.structures import OptSampleList
  from mmdet.utils import OptConfigType
  from ..layers import CdnQueryGenerator, DeformableDetrTransformerEncoder, DinoTransformerDecoder, SinePositionalEncoding
  from .deformable_detr import DeformableDETR, MultiScaleDeformableAttention
label_desc: Use image node_id 2 for calling the DINO obj's underlying member method code with example usage: obj._init_layers() without return types