End-to-End Object Detection with Transformers
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
- @renFasterRCNN2015 — two-stage detection with proposals and box/class heads.
- Limitation in context: depends on anchors, proposal heuristics, and NMS.
- @vaswaniAttentionAllNeed2017 — encoder-decoder self-attention for global sequence modeling.
- Limitation in context: no set loss or detection-specific object queries.
- @heMaskRCNN2017 — extends two-stage detectors to instance-level masks.
- Limitation in context: keeps proposal pipeline and handcrafted post-processing.
- @redmonYOLO2016 — single-stage dense prediction over grid locations.
- Limitation in context: still relies on surrogate local predictions and duplicates control.
Proposed Method
Architecture
DETR uses a CNN backbone, a transformer encoder-decoder, and learned object queries. The reference model uses 6 encoder layers, 6 decoder layers, width , and 8 attention heads; each query feeds an FFN for class and normalized box prediction.

Loss / Objective
Training solves set prediction by Hungarian assignment, then applies classification plus box loss on the matched pairs.
Sampling Rule / Algorithm
Inference is one parallel decoder pass over the fixed query set, followed by per-query class and box prediction.
Training Procedure
- Optimizer: AdamW.
- Transformer learning rate: .
- Backbone learning rate: .
- Weight decay: .
- Dropout: .
- Batch size: total, 4 images per GPU on 16 V100s.
- Base schedule: 300 epochs, LR drop after 200.
- Comparison schedule: 500 epochs, LR drop after 400.
- Gradient clipping max norm: .
- Augmentation: scale resize to short side , long side , random crop with probability .
- Auxiliary Hungarian losses after each decoder layer.
Evaluation
Datasets
- COCO 2017 detection: 118k train, 5k val.
- COCO 2017 panoptic segmentation.
Metrics
- Bounding-box AP, AP50, AP75.
- AP by scale: , , .
- Panoptic Quality: PQ, PQth, PQst.
- Throughput and compute: FPS, GFLOPS.
Headline results
- COCO detection, DETR-R50: AP 42.0, AP50 62.4, AP75 44.2.
- COCO detection, DETR-DC5-R101: AP 44.9, AP50 64.7, AP75 47.7.
- COCO detection, DETR-R50: 61.1, exceeding Faster R-CNN-FPN+ by 7.7.
- COCO panoptic, DETR-R101: PQ 45.1, PQth 50.5, PQst 37.0.
- COCO panoptic, DETR-DC5-R50: PQ 44.6.
Table 1: Comparison with Faster R-CNN on COCO validation.
| Model | GFLOPS/FPS | #params | AP | AP50 | AP75 | APS | APM | APL |
|---|---|---|---|---|---|---|---|---|
| Faster RCNN-DC5 | 320/16 | 166M | 39.0 | 60.5 | 42.3 | 21.4 | 43.5 | 52.5 |
| Faster RCNN-FPN | 180/26 | 42M | 40.2 | 61.0 | 43.8 | 24.2 | 43.5 | 52.0 |
| Faster RCNN-R101-FPN | 246/20 | 60M | 42.0 | 62.5 | 45.9 | 25.2 | 45.6 | 54.6 |
| Faster RCNN-DC5+ | 320/16 | 166M | 41.1 | 61.4 | 44.3 | 22.9 | 45.9 | 55.0 |
| Faster RCNN-FPN+ | 180/26 | 42M | 42.0 | 62.1 | 45.5 | 26.6 | 45.4 | 53.4 |
| Faster RCNN-R101-FPN+ | 246/20 | 60M | 44.0 | 63.9 | 47.8 | 27.2 | 48.1 | 56.0 |
| DETR | 86/28 | 41M | 42.0 | 62.4 | 44.2 | 20.5 | 45.8 | 61.1 |
| DETR-DC5 | 187/12 | 41M | 43.3 | 63.1 | 45.9 | 22.5 | 47.3 | 61.1 |
| DETR-R101 | 152/20 | 60M | 43.5 | 63.8 | 46.4 | 21.9 | 48.0 | 61.8 |
| DETR-DC5-R101 | 253/10 | 60M | 44.9 | 64.7 | 47.7 | 23.7 | 49.5 | 62.3 |

Ablations
- Encoder depth: 0 to 12 layers raises AP from 36.7 to 41.6; large-object AP gains most.
- Decoder depth: AP and AP50 improve at every layer; final-vs-first gain is +8.2/+9.5.
- NMS: helps early decoder layers, hurts final layers; duplicate suppression is learned.
- Loss terms: GIoU alone nearly matches baseline; alone is weak, but improves medium/large boxes with GIoU.
- Positional encodings: removing spatial encodings drops AP from 40.6 to 32.8.
Method Strengths and Weaknesses
Strengths
- Removes anchors, proposals, and NMS with one bipartite set loss.
- Matches Faster R-CNN AP with similar parameter count: 42.0 AP at 41M parameters.
- Strong large-object detection: for DETR-R50.
- Extends cleanly to panoptic segmentation, reaching 45.1 PQ with DETR-R101.
Weaknesses
- Small-object performance trails tuned Faster R-CNN baselines: 20.5 APS for DETR-R50.
- Training is long: 300 epochs baseline, 500 for strongest comparisons.
- DC5 improves accuracy but roughly doubles overall compute.
- Final AP depends on auxiliary decoder losses and long optimization.
Suggestions from the authors
- Improve small-object performance, analogous to FPN gains in two-stage detectors.
- Explore stronger unified models for panoptic segmentation.
- Study better ways to combine box loss terms and match costs.
- Extend the end-to-end set-prediction design to more complex structured vision tasks.
Links
Prior Papers
- @renFasterRCNN2015 — DETR is positioned directly against Faster R-CNN and removes its proposal and NMS machinery.
- @vaswaniAttentionAllNeed2017 — DETR imports the transformer encoder-decoder and adapts it to parallel object-set prediction.
- @heMaskRCNN2017 — the panoptic extension mirrors Mask R-CNN’s task expansion while avoiding proposal-centric design.
Further Papers
- @kirillovSAM2023 — both pursue promptable or set-based segmentation from transformer-style image representations.
- @dosovitskiyViT2020 — later vision transformers strengthen the architectural shift DETR initiated for recognition pipelines.
- @caronDINO2021 — self-supervised transformer backbones become natural descendants for DETR-style detection systems.