跳转到内容

Deformable DETR: Deformable Transformers for End-to-End Object Detection

Deformable DETR: Deformable Transformers for End-to-End Object Detection

Section titled “Deformable DETR: Deformable Transformers for End-to-End Object Detection”

学习档位 精读

类型 文献 · 更新 2026-07-20

所属 Query-based 检测与集合预测

中文学习笔记(自动生成,需核验)

Section titled “中文学习笔记(自动生成,需核验)”

Topic: foundations · Tier: foundational · Year: 2020 · Venue:
Evidence level: partial · 本地全文: 是 · 建议阅读: ~45 分钟
Paper: https://arxiv.org/abs/2010.04159
Code:
Generator: grok

解决了DETR收敛极慢(需数百epochs)与小目标检测弱、高分辨率特征图复杂度不可接受的核心痛点;通过可变形注意力将稀疏空间采样与Transformer关系建模结合,实现更快收敛、更高效率的端到端检测,是理解高效注意力与检测Transformer改进的关键论文。

Deformable DETR用只关注参考点周围少量采样点的可变形(多尺度)注意力替换标准Transformer注意力,使DETR在COCO上以约10倍更少训练epochs取得更好性能(尤其小目标)。

DETR虽消除手设计组件实现端到端检测,但存在两大问题:(1)收敛极慢(COCO上需500 epochs,比Faster R-CNN慢10-20倍);(2)小目标性能相对较低。原因在于Transformer注意力处理图像特征图时,初始化几乎均匀关注所有像素,需长时间学习聚焦稀疏有意义位置;同时编码器自注意力对像素数呈二次复杂度,无法高效处理高分辨率特征图以检测小目标。

DETR架构与Hungarian匹配损失;标准Transformer多头注意力机制;可变形卷积(deformable convolution);目标检测基础(多尺度特征、COCO基准、ResNet backbone、边界框表示);FPN等多尺度融合概念。

  • 提出可变形注意力模块(Deformable Attention),每个query只关注参考点周围固定少量采样关键点(作为pre-filter),结合稀疏采样与关系建模,缓解收敛与复杂度问题。
  • 自然扩展为多尺度可变形注意力(Multi-scale Deformable Attention),直接聚合多尺度特征图而无需FPN top-down结构。
  • 用(多尺度)可变形注意力替换DETR中处理特征图的Transformer注意力模块,构建Deformable DETR,显著加速收敛并提升性能(尤其小目标)。
  • 探索迭代边界框精炼机制与两阶段Deformable DETR变体(由变体生成区域提案再送入decoder精炼),进一步提升检测性能。
  • 在COCO上验证有效性,并开源代码。

输入图像经CNN backbone(如ResNet)提取多尺度特征图(C3-C5 + 由C5经3x3 stride2得到的C6,通道C=256,无FPN top-down);Encoder用多尺度可变形自注意力处理多尺度特征图(query/key均为像素,参考点为自身,加scale-level embedding);Decoder中object queries(可学习位置嵌入)经自注意力交互,并用多尺度可变形交叉注意力从encoder特征中提取信息;检测头(FFN回归归一化框坐标 + 线性分类)输出预测;可选迭代边界框精炼,或两阶段(先生成提案再精炼)。整体仍为set-based端到端,用Hungarian损失。

核心为Deformable Attention:给定query特征zq与2D参考点pq,从输入特征图采样K个点(每头),采样偏移Δpmqk与注意力权重Amqk均由zq经线性投影得到(3MK通道:2MK为偏移,MK经softmax得权重),用双线性插值取值后加权聚合;复杂度在K较小且encoder时约为O(HW C²)线性。多尺度版:对L层特征图采样LK点,参考点用归一化坐标p̂q,经φl重缩放到各层,权重在所有l,k上归一化;当L=1,K=1且投影固定时可退化为可变形卷积。设计取舍:固定少量采样点预过滤显著降复杂度并加速聚焦学习,同时保留注意力关系建模;多尺度直接交换信息无需FPN;encoder输出保持多尺度分辨率。

主要在COCO基准(Lin et al., 2014)上进行广泛实验。具体训练设置、评价指标(如AP、APs等)及超参数细节在摘录中未完整给出,待来源核验。

与DETR相比,Deformable DETR可取得更好性能(尤其在小目标上),且训练epochs减少约10倍。两阶段变体可进一步提升性能。具体AP数值、消融对比等详细实验结果待来源核验(摘录仅有摘要与引言定性描述)。

摘录主要聚焦解决DETR的收敛与分辨率问题,未详细展开本方法自身局限、失败场景或适用边界;例如采样点数K的敏感性、极端尺度/密集场景表现、与其他高效注意力对比细节等均待来源核验。适用边界大致为端到端目标检测,尤其需高效处理多尺度图像特征时。

与前序 / 同期 / 后续方法的关系

Section titled “与前序 / 同期 / 后续方法的关系”

高效注意力机制三类:预定义稀疏模式(局部窗口、固定间隔、特殊token等)、数据依赖稀疏(LSH、k-means、块置换等)、低秩近似;图像域多仍限第一类且实现可能慢于卷积。可变形卷积可视为自注意力变体,高效但缺元素关系建模。多尺度特征表示:FPN、PANet、BiFPN、NAS-FPN等。本工作可变形注意力受可变形卷积启发,属数据依赖稀疏注意力第二类,多尺度版可自然聚合多尺度而无需这些FPN结构;在图像域实现效率接近传统卷积。

官方代码已释放:https://github.com/fundamentalvision/Deformable-DETR。复现建议:基于摘录,使用ResNet提取C3-C6多尺度特征(C=256)、多尺度可变形注意力(M heads, K sampling points)、object queries与标准检测头;训练epochs显著少于DETR;具体配置、依赖、训练脚本与完整超参待查阅官方仓库与完整论文,待来源核验。

  1. Abstract与Introduction(理解动机与问题);2. Section 3 Revisiting Transformers and DETR(复习标准注意力与DETR瓶颈);3. Section 4 Method(重点读4.1可变形与多尺度注意力公式、encoder/decoder替换、复杂度分析);4. Related Work(定位与高效注意力/多尺度工作的关系);5. 实验与附录(完整论文中验证结果、实现细节,本摘录未全覆盖)。配合Figure 1-2理解流程与模块。
  1. Q: 标准Transformer注意力在图像特征图上导致DETR收敛慢的主要原因是什么? A: 初始化时Um zq与Vm xk近似均值0方差1,使注意力权重几乎均匀(≈1/Nk),Nk为大像素数时梯度模糊,需长时间训练才能聚焦稀疏有意义位置。
  2. Q: Deformable Attention如何计算?采样偏移与权重如何得到? A: DeformAttn(zq, pq, x) = sum_m Wm sum_k Amqk · W’m x(pq + Δpmqk),其中Δpmqk与Amqk均由zq线性投影得到(2MK偏移 + MK经softmax权重),分数坐标用双线性插值,Amqk在k上归一化。
  3. Q: 多尺度可变形注意力与单尺度的主要区别?是否需要FPN? A: 对L层特征图采样LK个点,参考点用归一化坐标p̂q经φl重缩放,权重在所有l,k归一化;本身可在多尺度间交换信息,因此无需FPN top-down结构。
  4. Q: Deformable DETR在encoder中应用可变形注意力时复杂度有何变化? A: 当Nq=HW且MK相对小时,复杂度变为O(HW C²),对空间尺寸线性,从而可处理高分辨率特征图。
  5. Q: 论文探索的两个性能提升变体是什么? A: 简单有效的迭代边界框精炼机制;两阶段Deformable DETR(由变体生成区域提案,再送入decoder进行迭代精炼)。
  • Abstract (page 1): Deformable DETR can achieve better performance than DETR (especially on small objects) with 10× less training epochs. Extensive experiments on the COCO benchmark demonstrate the effectiveness of our approach. Code is released at https://github.com/fundamentalvision/Deformable-DETR.
  • Introduction (page 1-2): DETR needs 500 epochs to converge, which is around 10 to 20 times slower than Faster R-CNN. … DETR delivers relatively low performance at detecting small objects. … the attention weights computation in Transformer encoder is of quadratic computation w.r.t. pixel numbers.
  • Section 4.1 Deformable Attention Module (page 5): the deformable attention module only attends to a small set of key sampling points around a reference point, regardless of the spatial size of the feature maps … DeformAttn(zq , pq , x) = sum_m Wm sum_k Amqk · W’m x(pq + Δpmqk)
  • Multi-scale Deformable Attention (page 6): the multi-scale deformable attention module is applied as MSDeformAttn(…) = sum_m Wm sum_l sum_k Amlqk · W’m xl (φl(p̂q) + Δpmlqk) … Note that the top-down structure in FPN is not used, because our proposed multi-scale deformable attention in itself can exchange information among multi-scale feature maps.
  • Introduction / Method overview (page 2): We explore a simple and effective iterative bounding box refinement mechanism to improve the detection performance. We also try a two-stage Deformable DETR, where the region proposals are also generated by a variant of Deformable DETR…
  • topic: foundations
  • sources: asta, arxiv, openalex
  • retrieved_at: 2026-07-20
  • query: Find foundational and recent research papers for the topic «基础» (foundations). Prefer peer-reviewed or widely cited work with clear method contributions. Include open-source code when available. Exclude pure survey spam unless highly cited. Core concepts: DETR, set prediction, transformer detection, Hungarian matching, object queries. Search facets: End-to-End Object Detection with Transformers DETR; Deformable DETR deformable transformers object detection; set prediction bipartite matching obje
  • corpus_id: 222208633
  • arxiv: 2010.04159
  • doi: 10.48550/arxiv.2010.04159
  • relevance_score: 0.8250853876382118
  • score_total: 85
  • suggested_tier: foundational

(no prose relevance explanation — numeric score only or HTTP source)

(no snippet evidence in candidate pool)

flowchart LR
A["输入 / 观测"] --> B["表示 / 编码"]
B --> C["推理 / 解码"]
C --> D["输出 / 动作或检测"]
%% method sketch for: Deformable DETR: Deformable Transformers for End-to-End Object Detection

方法结构示意(重绘;细节以原论文为准,待 PDF 核验)。

Deformable DETR: Deformable Transformers for End-to-End Object Detection arch p.2

来源:原论文约 p.2(arch);学习用途摘录。

Deformable DETR: Deformable Transformers for End-to-End Object Detection table p.7

来源:原论文约 p.7(table);学习用途摘录。

如何用多尺度 deformable attention 修复 DETR 的慢收敛与高分辨率特征浪费,使 set prediction 检测器可实用。

  • 只需在参考点附近稀疏采样即可逼近全局注意力;
  • 多尺度特征对小目标必要。

Deformable DETR 是 BEVFormer / 大量 3D 检测器自定义 CUDA op 的上游。复现 AD 感知时遇到的 attention 兼容问题,谱系上多半回到这里。

  • 自定义 CUDA / 采样点坐标与数据增强不同步会导致 silent bug;
  • 参考点初始化差时稀疏采样会「采空」。
  1. deformable attention 相对全局 self-attention 省在哪里?
  2. 多尺度如何接到 decoder?
  3. 与后续 BEV cross-attention 的概念对应是什么?
展开英文 Paper Card / AI deep analysis
Field Content
Year 2020
Authors Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, Jifeng Dai
arXiv 2010.04159
DOI 10.48550/arxiv.2010.04159
Topics foundations, end-to-end-learning
Paper https://arxiv.org/abs/2010.04159
展开 Extract / Selections / Local assets
  • foundations: tier=foundational rank=1 score=85 — Deformable DETR — deformable attention foundation used across BEV detectors
  • end-to-end-learning: tier=watch rank=2 score=57 — cross-topic assign from registry title match=2 keywords; 2026-07-19
Published as a conference paper at ICLR 2021
D EFORMABLE DETR: D EFORMABLE T RANSFORMERS
FOR E ND - TO -E ND O BJECT D ETECTION
Xizhou Zhu1∗ , Weijie Su2∗ ‡ , Lewei Lu1 , Bin Li2 , Xiaogang Wang1,3 , Jifeng Dai1†
1
SenseTime Research
2
University of Science and Technology of China
3
The Chinese University of Hong Kong
{zhuwalter,luotto,daijifeng}@sensetime.com
jackroos@mail.ustc.edu.cn, binli@ustc.edu.cn
xgwang@ee.cuhk.edu.hk
arXiv:2010.04159v4 [cs.CV] 18 Mar 2021
A BSTRACT
DETR has been recently proposed to eliminate the need for many hand-designed
components in object detection while demonstrating good performance. However,
it suffers from slow convergence and limited feature spatial resolution, due to the
limitation of Transformer attention modules in processing image feature maps. To
mitigate these issues, we proposed Deformable DETR, whose attention modules
only attend to a small set of key sampling points around a reference. Deformable
DETR can achieve better performance than DETR (especially on small objects)
with 10× less training epochs. Extensive experiments on the COCO benchmark
demonstrate the effectiveness of our approach. Code is released at https://
github.com/fundamentalvision/Deformable-DETR.
1 I NTRODUCTION