class_docstr: Head of Conditional DETR. Conditional DETR: Conditional DETR for Fast
  Training Convergence. More details can be found in the `paper.
  
  <https://arxiv.org/abs/2108.06152>`_ .
class_docstr_tok: ["Head","of","Conditional","DETR",".","Conditional","DETR",":","Conditional","DETR","for","Fast","Training","Convergence",".","More","details","can","be","found","in","the","`","paper",".","<","https",":","\/\/arxiv.org\/abs\/2108.06152",">","`","_","."]
docstr: Perform forward propagation of the detection head and predict
  detection results on the features of the upstream network. Over-write
  because img_metas are needed as inputs for bbox_head.
  
  Args:
      hidden_states (Tensor): Features from the transformer decoder, has
          shape (num_decoder_layers, bs, num_queries, dim).
      references (Tensor): References from the transformer decoder, has
          shape (num_decoder_layers, bs, num_queries, 2).
      batch_data_samples (List[:obj:`DetDataSample`]): The Data
          Samples. It usually includes information such as
          `gt_instance`, `gt_panoptic_seg` and `gt_sem_seg`.
      rescale (bool, optional): Whether to rescale the results.
          Defaults to True.
  
  Returns:
      list[obj:`InstanceData`]: Detection results of each image
      after the post process.
docstr_tok: ["Perform","forward","propagation","of","the","detection","head","and","predict","detection","results","on","the","features","of","the","upstream","network",".","Over-write","because","img_metas","are","needed","as","inputs","for","bbox_head",".","Args",":","hidden_states","(","Tensor",")",":","Features","from","the","transformer","decoder",",","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","dim",")",".","references","(","Tensor",")",":","References","from","the","transformer","decoder",",","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","2",")",".","batch_data_samples","(","List","[",":","obj",":","`","DetDataSample","`","]",")",":","The","Data","Samples",".","It","usually","includes","information","such","as","`","gt_instance","`",",","`","gt_panoptic_seg","`","and","`","gt_sem_seg","`",".","rescale","(","bool",",","optional",")",":","Whether","to","rescale","the","results",".","Defaults","to","True",".","Returns",":","list","[","obj",":","`","InstanceData","`","]",":","Detection","results","of","each","image","after","the","post","process","."]
code: def predict(
      self,
      hidden_states: Tensor,
      references: Tensor,
      batch_data_samples: SampleList,
      rescale: bool = True,
  ) -> InstanceList:
      """Perform forward propagation of the detection head and predict
      detection results on the features of the upstream network. Over-write
      because img_metas are needed as inputs for bbox_head.
  
      Args:
          hidden_states (Tensor): Features from the transformer decoder, has
              shape (num_decoder_layers, bs, num_queries, dim).
          references (Tensor): References from the transformer decoder, has
              shape (num_decoder_layers, bs, num_queries, 2).
          batch_data_samples (List[:obj:`DetDataSample`]): The Data
              Samples. It usually includes information such as
              `gt_instance`, `gt_panoptic_seg` and `gt_sem_seg`.
          rescale (bool, optional): Whether to rescale the results.
              Defaults to True.
  
      Returns:
          list[obj:`InstanceData`]: Detection results of each image
          after the post process.
      """
      batch_img_metas = [
          data_samples.metainfo for data_samples in batch_data_samples
      ]
  
      last_layer_hidden_state = hidden_states[-1].unsqueeze(0)
      outs = self(last_layer_hidden_state, references)
  
      predictions = self.predict_by_feat(
          *outs, batch_img_metas=batch_img_metas, rescale=rescale
      )
  
      return predictions
  
file_path: mmdetection/mmdet/models/dense_heads/conditional_detr_head.py
imports: from typing import Tuple
  import torch
  import torch.nn
  from mmengine.model import bias_init_with_prob
  from torch import Tensor
  from mmdet.models.layers.transformer import inverse_sigmoid
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import InstanceList
  from .detr_head import DETRHead
label_desc: Use image node_id 5 for calling the ConditionalDETRHead obj's underlying member method code with example usage: obj.predict(hidden_states, references, batch_data_samples, rescale) and returns: predictions