End-to-End Object Detection with Transformers

Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko

2020 · ECCV

End-to-End Object Detection with Transformers

Problem

Framing

Anchor- and proposal-based detectors solved detection through surrogate dense prediction plus hand-tuned post-processing. DETR replaces that stack with direct set prediction: a transformer emits a fixed detection set, and Hungarian matching enforces one-to-one supervision. On COCO, it reaches 42.0 AP with ResNet-50 while removing anchors and NMS.

Currently Used Methods

Foundational

Proposed Method

Architecture

DETR uses a CNN backbone, a transformer encoder-decoder, and N=100N=100 learned object queries. The reference model uses 6 encoder layers, 6 decoder layers, width d=256d=256, and 8 attention heads; each query feeds an FFN for class and normalized box prediction.

Pipeline diagram: CNN features enter a transformer encoder-decoder; learned queries produce parallel class/box predictions trained with bipartite matching.

Loss / Objective

Training solves set prediction by Hungarian assignment, then applies classification plus box loss on the matched pairs.

σ^=argminσSNi=1NLmatch(yi,y^σ(i))\hat{\sigma} = \arg\min_{\sigma \in \mathfrak{S}_N} \sum_{i=1}^{N} \mathcal{L}_{\mathrm{match}}(y_i, \hat{y}_{\sigma(i)}) LHungarian(y,y^)=i=1N[logp^σ^(i)(ci)+1{ci}Lbox(bi,b^σ^(i))]\mathcal{L}_{\mathrm{Hungarian}}(y, \hat{y}) = \sum_{i=1}^{N} \left[-\log \hat{p}_{\hat{\sigma}(i)}(c_i) + \mathbf{1}_{\{c_i \neq \varnothing\}}\,\mathcal{L}_{\mathrm{box}}(b_i, \hat{b}_{\hat{\sigma}(i)})\right] Lbox(bi,b^σ^(i))=λiouLiou(bi,b^σ^(i))+λL1bib^σ^(i)1\mathcal{L}_{\mathrm{box}}(b_i, \hat{b}_{\hat{\sigma}(i)}) = \lambda_{\mathrm{iou}}\,\mathcal{L}_{\mathrm{iou}}(b_i, \hat{b}_{\hat{\sigma}(i)}) + \lambda_{L1}\,\|b_i - \hat{b}_{\hat{\sigma}(i)}\|_1

Sampling Rule / Algorithm

Inference is one parallel decoder pass over the fixed query set, followed by per-query class and box prediction.

y^i=(p^i(c),b^i),i{1,,N}\hat{y}_i = \big(\hat{p}_i(c), \hat{b}_i\big), \qquad i \in \{1,\dots,N\} b^i=FFN(zi),p^i(c)=softmax(Wzi)c\hat{b}_i = \mathrm{FFN}(\mathbf{z}_i), \qquad \hat{p}_i(c) = \mathrm{softmax}(W\mathbf{z}_i)_c

Training Procedure

Evaluation

Datasets

Metrics

Headline results

Table 1: Comparison with Faster R-CNN on COCO validation.

ModelGFLOPS/FPS#paramsAPAP50AP75APSAPMAPL
Faster RCNN-DC5320/16166M39.060.542.321.443.552.5
Faster RCNN-FPN180/2642M40.261.043.824.243.552.0
Faster RCNN-R101-FPN246/2060M42.062.545.925.245.654.6
Faster RCNN-DC5+320/16166M41.161.444.322.945.955.0
Faster RCNN-FPN+180/2642M42.062.145.526.645.453.4
Faster RCNN-R101-FPN+246/2060M44.063.947.827.248.156.0
DETR86/2841M42.062.444.220.545.861.1
DETR-DC5187/1241M43.363.145.922.547.361.1
DETR-R101152/2060M43.563.846.421.948.061.8
DETR-DC5-R101253/1060M44.964.747.723.749.562.3

Sample grid: DETR detects 24 giraffes in a synthetic crowded image, illustrating generalization beyond observed instance counts.

Ablations

Method Strengths and Weaknesses

Strengths

Weaknesses

Suggestions from the authors

Links

Prior Papers

Further Papers