code: def __init__(
      self,
      num_classes: int,
      hidden_dim: int,
      num_queries: int,
      in_channels: list[int],
      num_decoder_layers: int,
      num_heads: int = 8,
      num_decoder_points: int = 4,
      # num_levels: int = 3,
      dropout: float = 0.0,
  ) -> None:
      super().__init__()
      self.num_queries = num_queries
      # TODO: verify this is correct
      self.num_levels = len(in_channels)
  
      # build the input projection layers
      self.input_proj = nn.ModuleList()
      for ch_in in in_channels:
          self.input_proj.append(
              ConvNormAct(ch_in, hidden_dim, 1, act="none")
          )
      # NOTE: might be missing some layers here ?
      # https://github.com/lyuwenyu/RT-DETR/blob/main/rtdetr_pytorch/src/zoo/rtdetr/rtdetr_decoder.py#L403-L410
  
      # NOTE: need to be integrated with the TransformerDecoderLayer
      self.decoder_layers = nn.ModuleList(
          [
              TransformerDecoderLayer(
                  embed_dim=hidden_dim,
                  num_heads=num_heads,
                  dropout=dropout,
                  num_levels=len(in_channels),
                  num_points=num_decoder_points,
              )
              for _ in range(num_decoder_layers)
          ]
      )
  
      self.decoder = TransformerDecoder(
          hidden_dim=hidden_dim,
          decoder_layers=self.decoder_layers,
          num_layers=num_decoder_layers,
      )
  
      # denoising part
      self.denoising_class_embed = nn.Embedding(
          num_classes, hidden_dim
      )  # not used in evaluation
  
      # decoder embedding
      self.query_pos_head = MLP(
          4, 2 * hidden_dim, hidden_dim, num_layers=2
      )
  
      # encoder head
      self.enc_output = nn.Sequential(
          nn.Linear(hidden_dim, hidden_dim), nn.LayerNorm(hidden_dim)
      )
      self.enc_score_head = nn.Linear(hidden_dim, num_classes)
      self.enc_bbox_head = MLP(hidden_dim, hidden_dim, 4, num_layers=3)
  
      # decoder head
      self.dec_score_head = nn.ModuleList(
          [
              nn.Linear(hidden_dim, num_classes)
              for _ in range(num_decoder_layers)
          ]
      )
      self.dec_bbox_head = nn.ModuleList(
          [
              MLP(hidden_dim, hidden_dim, 4, num_layers=3)
              for _ in range(num_decoder_layers)
          ]
      )
  
imports: from __future__ import annotations
  from typing import Optional
  import torch
  from torch import nn
  from kornia.contrib.models.common import MLP, ConvNormAct
  from kornia.core import Module, Tensor, concatenate
label_desc: Use image node_id 1 to create a new RTDETRHead object from inherited base classes: Module with example: obj = RTDETRHead(num_classes, hidden_dim, num_queries, in_channels, num_decoder_layers, num_heads, num_decoder_points, dropout)