Abstract
Detection Transformer (DETR) introduced a streamlined end-to-end object detection pipeline but suffered from slow training convergence, often requiring 500 epochs to reach competitive performance. Conditional DETR addresses this bottleneck by introducing a conditional cross-attention mechanism. By disentangling content and spatial queries and explicitly searching for object extremities, Conditional DETR achieves up to a 10x speedup in convergence while improving detection accuracy on the COCO benchmark.
Introduction
The original DETR model revolutionized object detection by removing the need for hand-crafted components like anchor boxes and non-maximum suppression (NMS). However, its slow convergence remained a significant barrier to adoption. The primary reason for this inefficiency lies in the decoder's cross-attention mechanism, where object queries must learn to locate object boundaries using weak spatial information. Conditional DETR proposes a more efficient way to "look" at the image by making spatial queries dependent on the predicted object location.
The Localization Bottleneck
In the standard DETR architecture, object queries are formed by adding a content embedding to a spatial embedding. Early in training, the spatial component is non-specific, forcing the content query to handle both classification ("what") and localization ("where"). This dual requirement slows down the learning process as the model struggles to refine the attention maps toward object extremities.
Conditional Cross-Attention
Conditional DETR introduces a mechanism to generate spatial queries dynamically. Instead of static embeddings, the model predicts a 2D reference point (representing the object center) and calculates displacement and scale offsets from the decoder's output.
Key architectural changes include:
- Conditional Spatial Query Generation: The model learns to map object queries to specific 2D coordinates. These coordinates are then transformed into a spatial query that is conditioned on the current estimate of the object's location.
- Disentangled Concatenation: Unlike the original DETR which adds content and spatial queries, Conditional DETR concatenates them. This prevents interference between the two types of information during the dot-product attention calculation, allowing the model to process "what" and "where" independently.
- Multi-Head Specialization: The explicit spatial conditioning allows different attention heads to specialize in finding specific object boundaries (e.g., top, bottom, left, or right edges), leading to sharper and more accurate bounding box predictions much earlier in the training process.
Experimental Results
The authors evaluated Conditional DETR on the COCO 2017 detection dataset. The results demonstrate a dramatic improvement in training efficiency without sacrificing accuracy.
As shown in the convergence plots, Conditional DETR reaches the performance of a 500-epoch DETR baseline in approximately 75 to 108 epochs. Specifically, with a ResNet-50 backbone, it achieves 40.9 AP at just 50 epochs, whereas the original DETR only reaches 34.9 AP in the same timeframe. For higher-resolution backbones (DC5), the speedup reaches 10x. Importantly, this performance gain comes with negligible increases in parameter count (from 41M to 44M) and computational cost.
Conclusion
Conditional DETR effectively solves the slow convergence problem of the original DETR by treating localization as a conditional search task. By disentangling spatial and content information, the model learns to focus on object extremities much faster. This approach not only makes DETR-based models more practical for real-world training schedules but also provides a general framework for improving transformer-based localization in tasks like pose estimation and line detection.
Summary updated