DINO

DINO (DETR with Improved deNoising anchOr boxes) is an end-to-end object detector in the DETR line.

  • Paper: Zhang, Li, Liu, Zhang, Su, Zhu, Ni and Shum (HKUST / Tsinghua / IDEA), DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection, ICLR 2023, arXiv:2203.03605.
  • Not the other DINO: this is not the self-supervised-learning DINO from Meta (Emerging Properties in Self-Supervised Vision Transformers, arXiv:2104.14294) — the acronym is badly overloaded; this one is a detector and has nothing to do with self-distillation or ViT feature learning.
  • Built from: the Deformable DETR backbone plus DAB-DETR’s anchor-box queries and DN-DETR’s denoising training.
  • New ingredients: contrastive denoising training, mixed query selection for anchor initialization, and look forward twice for box refinement.
  • ResNet-50 result: 49.4 AP in 12 epochs and 51.3 AP in 24 epochs on COCO val2017 with multi-scale features ( / AP over the previous best DETR-like model).
  • Headline result: with a SwinL backbone pre-trained on ImageNet-22K and detection pre-training on Objects365, 63.2 AP on val2017 and 63.3 AP on test-dev, the first time an end-to-end Transformer detector topped the COCO leaderboard, using the parameters of SwinV2-G.

DINO framework: multi-scale features, encoder, query selection, decoder with a CDN branch

Motivation

The paper’s framing is that DETR-like models had, by 2022, two credibility problems relative to heavily-engineered classical detectors (HTC++, DyHead):

  1. They were simply worse. The best DETR-like models were still under 50 AP on COCO, while the leaderboard was owned by convolution-based two-stage pipelines with hand-designed anchors and NMS.
  2. Their scalability was untested. Nobody had reported what happens when a DETR-like model is given a very large backbone and a large-scale detection pre-training set — the recipe that produced every SOTA number at the time.

DINO attacks both. The technical contributions target three separate places where the DAB-DETR + DN-DETR baseline still wastes capacity: the one-to-one matching (anchors near a GT box are ambiguous and produce duplicates), the query initialization (encoder-selected content queries are unrefined and can mislead the decoder), and the box refinement (Deformable DETR’s gradient detachment means an early layer’s initial box never receives a corrective signal from later layers).

Preliminaries: what DINO inherits

  • From DAB-DETR (DAB-DETR): decoder positional queries are explicit 4D dynamic anchor boxes , refined layer by layer in the decoder, rather than opaque learned embeddings. This makes “what a query is” concrete, and makes anchor-space reasoning (noise scales, IoU, refinement) possible at all.
  • From DN-DETR (DN-DETR): an auxiliary denoising branch. Noised GT labels and boxes are fed to the decoder alongside the ordinary queries, and the model is trained to reconstruct the originals. The added noise is bounded by , , , . A noised GT box is just an anchor with a GT box nearby, so this trains the decoder’s “refine a nearby anchor” skill directly, bypassing the instability of bipartite matching in early training.
  • From Deformable DETR: multi-scale deformable attention for efficiency, query selection (the paper deliberately renames Deformable DETR’s “two-stage” to avoid confusion with classical two-stage detectors), and iterative box refinement with gradient detachment — which DINO renames look forward once.

Model overview

Standard DETR-like skeleton: backbone (ResNet-50 or SwinL) → multi-scale features → 6-layer deformable Transformer encoder → 6-layer deformable Transformer decoder → prediction heads. The decoder’s positional queries are dynamic anchor boxes; its content queries are learnable parameters. Two query streams run through the decoder in parallel: the ordinary matching queries and the CDN (contrastive denoising) queries.

Contrastive denoising training

CDN groups: positive and negative queries, and the concentric-square view of the two noise scales

DN-DETR teaches the model to reconstruct a GT box from a nearby anchor. What it never teaches is to say “no object” for an anchor that has no object nearby — every DN query has a GT target by construction. The consequence is duplicate predictions: several anchors sit close to one object, the model cannot decide which to use, and self-attention’s duplicate-suppression is only partially effective.

CDN fixes this by generating, per GT box, two noised queries with two noise scales :

  • Positive queries — noise scale smaller than ; inside the inner square in the concentric-square picture. Target: reconstruct the corresponding GT box.
  • Negative queries — noise scale between and ; in the ring between the inner and outer square. Target: “no object”.

is kept small deliberately — hard negatives, close to the GT box, are the informative ones. An image with GT boxes yields a CDN group of queries, and (as in DN-DETR) multiple CDN groups are used per image. Losses: + GIoU for box reconstruction and focal loss for classification, with the negatives’ background classification also using focal loss.

The mechanism is anchor selection rather than anchor regression: the model learns to reject useless anchors instead of merely pulling every anchor toward the nearest GT. That removes duplicates (Fig. 8 in the paper shows a person with 3 duplicate boxes under DN queries and one box under CDN queries) and stops unwanted far-away anchors from winning the matching.

Measuring it: Average-To-Nearest anchor distance

To show CDN actually improves the anchors rather than just the loss curve, the paper defines ATD(k). For each GT box in the validation set, let be the initial decoder anchor whose final refined box was matched to . Then

i.e. the mean anchor–GT distance over the worst pairs. The top- restriction is the point: confusion happens precisely when a GT box gets matched to a far anchor, so the tail is what matters. DN alone already gives a good average anchor; CDN specifically improves the tail and does so most for small objects, worth AP over DN queries at 12 epochs with ResNet-50 and multi-scale features.

Mixed query selection

Three query initialization schemes: static, pure query selection, mixed query selection

Three ways to initialize decoder queries, given that a query has a positional part (anchor) and a content part:

  • (a) Static queries — DETR, DN-DETR, DAB-DETR. Both parts are learned parameters, identical for every image. No encoder information enters the initialization.
  • (b) Pure query selection — Deformable DETR’s “two-stage”, and Efficient DETR. Top- encoder features (by objectness score) initialize both the anchors and the content queries, and are additionally fed to an auxiliary detection head to produce the initial reference boxes.
  • (c) Mixed query selection — DINO. Only the positional queries are initialized from the top- selected features’ position information; content queries stay learnable and static.

The argument against (b): the selected encoder features are preliminary, unrefined content. A selected feature may straddle multiple objects or cover only part of one, so using it as a content query actively misleads the decoder. Its position, on the other hand, is a reliable prior. Keeping the content queries learnable lets the first decoder layer focus on the spatial prior and pool its own, more comprehensive content features from the encoder via cross-attention.

Look forward twice

Look forward once (Deformable DETR) vs look forward twice (DINO) box update

Deformable DETR’s iterative box refinement blocks gradient back-propagation through the box passed between layers, to stabilize training — DINO calls this look forward once, since layer ‘s parameters are updated only by the auxiliary loss on its own box .

The precision of a predicted box depends on two things: the quality of the initial box coming in, and the quality of the predicted offset . Look forward once optimizes only the second, because the gradient path through is severed. DINO’s look forward twice supervises layer ‘s box with the next layer’s output too, so each predicted offset is used twice — once for and once for . Given an input box :

where is the undetached version of and is Deformable DETR’s box update — sum in inverse-sigmoid space, then sigmoid, exactly the construction described in Deformable DETR. So the prediction of layer is formed from the undetached box of layer , which lets the loss on layer ‘s prediction reach back and improve layer ‘s parameters as well.

Hyperparameters

Reported in Section 4.1 and Appendix D (Table 8).

SettingValue
DatasetCOCO 2017 (train2017 / val2017 / test-dev)
BackbonesResNet-50 (ImageNet-1k) and SwinL (ImageNet-22k)
Encoder / decoder layers6 / 6
Hidden dim256; FFN dim 2048; 8 heads; dropout 0.0
Deformable sampling points4 in the encoder, 4 in the decoder
Decoder queries900 ( patterns’ worth of compute, vs DN-DETR’s 300 queries with 3 patterns)
Feature scales4-scale (backbone stages 2–4 + a down-sampled stage-4 map) or 5-scale (+ stage 1)
CDN, ; 100 CDN pairs = 100 positive + 100 negative queries
DN noisedn_box_noise_scale 0.4, dn_label_noise_ratio 0.5
OptimizerAdamW, LR , backbone LR , weight decay
Grad clippingclip_max_norm 0.1
LR schedule at epoch 11 / 20 / 30 for the 12 / 24 / 36-epoch settings
Batch size16, on Nvidia A100 GPUs (8 GPUs, batch 2 per GPU)
Matching costclass 2.0, bbox 5.0, GIoU 2.0
Loss coefficientsclassification 1.0, 5.0, GIoU 2.0; focal loss ,
Aux lossesafter every decoder layer, plus intermediate losses after the query selection module
Prediction headsshared across decoder layers (DN-DETR uses unshared heads) — better AP and ~1M fewer parameters
Positional encodingpe_temperature 20; batch norm frozen (FrozenBatchNorm2d)
AugmentationDETR’s random crop + scale: shorter side , longer side

Objects365 pre-training (Appendix D.2): 26 epochs on 64 A100 GPUs (local batch size 1 per GPU, first 5000 val images held out as validation, the rest added to training), then 18 epochs of fine-tuning on train2017 on 16 A100s at image size (shorter side 720–1200, longer side , worth ~0.5 AP), with gradient checkpointing, mixed precision, and 1000 DN queries.

DINO also drops DAB-DETR’s conditional queries (see Conditional DETR) — they did not suit the model — and replaces DN-DETR’s fixed number of DN groups with dynamic DN groups: a fixed number of DN queries per image, with the number of groups adjusted to the image’s object count, since padding to the batch’s largest object count (COCO images have 1–80 objects) is wasteful.

Results

12-epoch () setting, ResNet-50, COCO val2017 (Table 1)

ModelEpochsAPAPAPAPGFLOPsParamsFPS
Faster R-CNN (5scale)1237.922.441.149.120740M21
DETR-DC51215.54.315.126.722541M20
Deformable DETR (4scale)1241.1———19640M24
DAB-DETR-DC51238.019.240.955.425644M17
Dynamic Head (5scale)1243.024.746.453.9———
DN-Deformable-DETR (4scale)1243.424.846.859.426548M23
DINO-4scale1249.0 ()32.0 ()52.363.027947M24
DINO-5scale1249.4 ()32.3 ()52.563.986047M10

The small-object gain ( / AP) is disproportionately large, consistent with the CDN/ATD analysis. The 4-scale model adds negligible compute and parameters over DN-Deformable-DETR while running slightly faster.

Longer schedules (Table 2)

ModelEpochsAPAPAPAP
Faster R-CNN10842.026.645.453.4
DETR-DC550043.322.547.361.1
Deformable DETR5046.228.849.261.7
DAB-Deformable-DETR5046.930.150.462.5
DN-Deformable-DETR5048.631.052.063.7
DINO-4scale2450.4 ()33.353.764.8
DINO-5scale2451.3 ()34.554.265.3
DINO-4scale3650.9 ()34.654.164.6
DINO-5scale3651.2 ()35.054.365.3

Because DINO converges fast, the paper uses the / (24/36-epoch) settings rather than the usual 50 — the extra epochs buy very little (51.3 at 24 vs 51.2 at 36 for 5-scale).

SOTA comparison (Table 3, SwinL + Objects365)

MethodParamsBackbone pre-trainDetection pre-trainUses maskEnd-to-endval2017 AP (no TTA)test-dev AP (no TTA)
SwinL284MIN-22K-14MO365✓57.157.7
Soft Teacher + SwinL284MIN-22K-14MO365✓60.161.3
Florence-CoSwin-H> 637MFLD-900MFLD-9M—62.4
SwinV2-G3.0BIN-22K-ext-70MO365✓61.963.1
DINO-SwinL218MIN-22K-14MO365✓63.263.3

Relative to SwinV2-G: the parameters. Relative to Florence: the backbone pre-training images and the detection pre-training data. None of the previous SOTA models use Transformer decoder-based heads, and none are end-to-end (HTC++/DyHead retain RPN and NMS). The 63.2/63.3 numbers are without test-time augmentation; the TTA experiment (Appendix A, using a one-to-one IoU-based weighted-average ensembling scheme instead of NMS/box voting, since DETR-like models are not prone to duplicates and standard ensembling hurts them) gave no inspiring gain.

Component ablation (Table 4, ResNet-50, 12 epochs)

#ModelQSCDNLFTAPAPAPAP
1DN-DETRno43.424.846.859.4
2Optimized DN-DETRno44.926.948.260.0
3Strong baseline (row 2 + pure query selection)pure46.529.649.861.0
4+ mixed query selectionmixed47.031.150.161.5
5+ look forward twicemixed✓47.429.950.861.9
6DINO (+ contrastive DN)mixed✓✓47.931.250.961.9

Engineering and pipeline optimization account for AP (43.4 → 44.9), pure query selection for , and the three novel components for , and respectively — roughly AP in total on an already strong baseline.

Other ablations

Encoder/decoder depth (Table 6, 12 epochs, 100 DN queries without negatives): 6/6 → 47.4; 4/6 → 46.2; 3/6 → 45.8; 2/6 → 45.4; 6/4 → 46.0; 6/2 → 44.4; 2/4 → 44.1; 2/2 → 41.2. Cutting decoder layers hurts more than cutting encoder layers, since the boxes are refined through each decoder layer — but DINO degrades far more gracefully than Dynamic DETR (3.0 AP drop going 6→2 decoder layers vs 13.8 AP, 29.1 vs 42.9), which the paper credits to mixed query selection giving well-initialized decoder queries that are not deeply coupled to refinement depth.

Number of denoising queries (Table 7): 100 CDN (= 200 queries: 100 positive + 100 negative) → 47.9; 1000 DN → 47.6; 200 DN → 47.4; 100 DN → 47.4; 50 DN → 46.7; 10 DN → 46.0; no DN → 45.1. Denoising is worth ~2.8 AP, saturates around 100 queries, and past that more DN queries do nothing or slightly hurt.

Training efficiency (Table 5, 8× A100, ResNet-50): ~55 min/epoch, 16 GB GPU memory, 12 epochs to 47.9 AP — versus Deformable DETR at ~55 min/epoch × 50 epochs to 45.4, DETR at ~16 min/epoch × 300 epochs (26 GB) to 41.2, and Faster R-CNN at ~60 min/epoch × 108 epochs to 42.0.

Limitations

  • The three contributions are individually small (, , AP in the ablation); most of the headline gap over DN-Deformable-DETR comes from the engineering-optimized baseline and query selection. The paper is as much a strong-recipe paper as a new-mechanism paper.
  • The 5-scale model costs 860 GFLOPs and runs at 10 FPS (vs 279 GFLOPs / 24 FPS for 4-scale) for AP at 12 epochs — the high-resolution level is expensive for what it buys.
  • CDN adds hyperparameters (, , group count, DN query budget) with no principled way to pick them; the paper only reports that should be small and 100 CDN pairs is a good point on the saturation curve.
  • The SOTA result depends on Objects365 pre-training on 64 A100s for 26 epochs — the leaderboard number is not reproducible on a modest budget, and the ResNet-50 results are the honest comparison point.
  • Test-time augmentation, which reliably helps classical detectors, gives no meaningful gain here; DETR-like models resist the usual ensembling machinery because their set-based loss already suppresses duplicates.
  • Inference still inherits Deformable DETR’s custom CUDA kernel for multi-scale deformable attention and its unordered memory access.

See also

  • DETR — the set-prediction formulation DINO is built on
  • Deformable DETR — supplies the multi-scale deformable attention, query selection, and the “look forward once” refinement DINO improves
  • DAB-DETR — dynamic anchor-box queries, the formulation that makes CDN’s noise scales meaningful
  • DN-DETR — denoising training, which CDN extends with negative samples
  • Conditional DETR — the conditional spatial query, which DINO evaluated and dropped
  • RT-DETR — the real-time descendant of this line
  • Implementing Research Papers