[Paper Review] Fast Convergence of DETR with Spatially Modulated Co-Attention
This paper proposes Spatially Modulated Co-Attention (SMCA), a plug-and-play module that accelerates DETR's convergence by introducing location-aware spatial priors via Gaussian-like weight maps to guide co-attention in the decoder. SMCA achieves 45.6 mAP at 108 epochs—surpassing DETR's 43.3 mAP at 500 epochs—while reducing training time significantly with minimal architectural changes.
The recently proposed Detection Transformer (DETR) model successfully applies Transformer to objects detection and achieves comparable performance with two-stage object detection frameworks, such as Faster-RCNN. However, DETR suffers from its slow convergence. Training DETR from scratch needs 500 epochs to achieve a high accuracy. To accelerate its convergence, we propose a simple yet effective scheme for improving the DETR framework, namely Spatially Modulated Co-Attention (SMCA) mechanism. The core idea of SMCA is to conduct location-aware co-attention in DETR by constraining co-attention responses to be high near initially estimated bounding box locations. Our proposed SMCA increases DETR's convergence speed by replacing the original co-attention mechanism in the decoder while keeping other operations in DETR unchanged. Furthermore, by integrating multi-head and scale-selection attention designs into SMCA, our fully-fledged SMCA can achieve better performance compared to DETR with a dilated convolution-based backbone (45.6 mAP at 108 epochs vs. 43.3 mAP at 500 epochs). We perform extensive ablation studies on COCO dataset to validate SMCA. Code is released at https://github.com/gaopengcuhk/SMCA-DETR .
Motivation & Objective
- To address the slow convergence of DETR, which requires 500 epochs to converge.
- To improve training efficiency without modifying DETR’s core architecture beyond the decoder.
- To enhance detection performance by incorporating spatial priors that guide attention toward likely object locations.
- To explore the effectiveness of global self-attention and multi-scale feature fusion in accelerating end-to-end object detection.
Proposed method
- SMCA replaces the original co-attention mechanism in DETR’s decoder with a spatially modulated version that uses dynamically predicted object center and scale to generate 2D Gaussian-like spatial weight maps.
- These spatial weight maps are element-wise multiplied with co-attention feature maps to constrain attention to regions near the predicted object location, improving feature aggregation efficiency.
- The method integrates multi-head attention in the decoder, where each head learns a distinct spatial prior, enabling diverse receptive fields for improved feature selection.
- A hybrid encoder architecture combines intra-scale and multi-scale self-attention mechanisms to efficiently propagate information across scales while minimizing FLOPs.
- The multi-scale self-attention enables interaction between features at all spatial locations and scales, enhancing feature discriminability.
- The scale-selection attention in the decoder allows each head to adaptively select relevant feature scales, improving detection robustness.
Experimental results
Research questions
- RQ1Can introducing spatial priors via learnable Gaussian-like attention maps significantly accelerate the convergence of DETR?
- RQ2How does spatial modulation of co-attention affect detection accuracy and training efficiency compared to standard DETR?
- RQ3Can multi-scale self-attention and multi-head spatial modulation further improve performance beyond the basic SMCA module?
- RQ4How does SMCA compare to other fast-converging detectors like Deformable DETR and TSP-RCNN in terms of mAP and generalization across object sizes?
- RQ5Does the integration of global self-attention and multi-scale features lead to better localization of large objects compared to local attention mechanisms?
Key findings
- The basic SMCA module achieves 41.0 mAP at 50 epochs and 42.7 mAP at 108 epochs, significantly outperforming DETR’s 43.3 mAP at 500 epochs.
- The full SMCA model reaches 45.6 mAP at 108 epochs, surpassing DETR-DC5’s 43.3 mAP at 500 epochs with a 45% reduction in training time.
- SMCA achieves better performance on large objects (60.4 mAP) than Deformable DETR (59.0 mAP), demonstrating the advantage of global attention over local sampling.
- SMCA outperforms Faster R-CNN-FPN-R50 at 109 epochs (45.6 vs. 42.0 mAP), despite using fewer backbone features and a simpler attention mechanism.
- The hybrid encoder with 2-intra-inter-2-intra self-attention design achieves 43.7 mAP with fewer parameters and lower FLOPs than pure multi-scale or intra-scale encoders.
- SMCA achieves comparable mAP to TSP-RCNN at 50 epochs (43.7 vs. 43.8) but surpasses it at longer schedules (45.6 vs. 45.0 at 96 and 108 epochs), showing superior long-term convergence.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.