[论文解读] End-to-End Object Detection with Adaptive Clustering Transformer
本文提出 Adaptive Clustering Transformer (ACT) 作为 DETR 编码器自注意力的即插即用替代,通过 E2LSH 的自适应聚类降低计算量,并通过 Multi-Task Knowledge Distillation (MTKD) 提高性能。
End-to-end Object Detection with Transformer (DETR)proposes to perform object detection with Transformer and achieve comparable performance with two-stage object detection like Faster-RCNN. However, DETR needs huge computational resources for training and inference due to the high-resolution spatial input. In this paper, a novel variant of transformer named Adaptive Clustering Transformer(ACT) has been proposed to reduce the computation cost for high-resolution input. ACT cluster the query features adaptively using Locality Sensitive Hashing (LSH) and ap-proximate the query-key interaction using the prototype-key interaction. ACT can reduce the quadratic O(N2) complexity inside self-attention into O(NK) where K is the number of prototypes in each layer. ACT can be a drop-in module replacing the original self-attention module without any training. ACT achieves a good balance between accuracy and computation cost (FLOPs). The code is available as supplementary for the ease of experiment replication and verification. Code is released at \url{https://github.com/gaopengcuhk/SMCA-DETR/}
研究动机与目标
- 降低 DETR 针对高分辨率输入的高计算成本,同时保持端到端集合预测。
- 提出 ACT 用自适应聚类替换编码器自注意力,使复杂度从平方级降低到接近线性。
- 演示 ACT 是与 DETR 兼容的即插即用模块,无需重新训练,并探讨 MTKD 以进一步提升准确性。
- 量化在 COCO 2017 上的 FLOPs 减少和 AP 权衡,并提供消融研究以指导实际使用。
提出的方法
- 使用局部敏感哈希(LSH),具体为 Exact Euclidean LSH (E2LSH),在每个编码器层中自适应将查询聚类为原型。
- 仅在原型和键之间计算注意力,然后将原型的更新广播给成员查询,将复杂度从 O(NMDk+NMDv) 降至 O(NLDK+CMDK+CMDV)。
- 通过多轮 LSH(轮次 L)基于特征分布动态确定每层的原型数量。
- 可选地应用 Multi-Task Knowledge Distillation (MTKD) 以对齐 ACT 与完整 DETR 的预测,实现无缝切换并提高准确性。
- 提供训练目标 L = L_pred + L_KD 来从 ACT 蒸馏框回归到 DETR,从而实现更好收敛。
- 在无需重新训练的情况下评估 ACT 作为 DETR 的替代,并通过 MTKD 量化改进。
实验结果
研究问题
- RQ1在不重新训练的情况下,ACT 是否能减少 DETR 编码器自注意力计算同时保持检测性能?
- RQ2通过 LSH 的自适应聚类对不同编码器层和对象尺寸的 AP 与 FLOPs 有何影响?
- RQ3MTKD 是否进一步缩小 ACT 与全 DETR 之间的性能差距?
- RQ4与 COCO 2017 上的 DETR 与 Faster R-CNN 相比,ACT 在实际 FLOPs、速度和内存方面的权衡如何?
主要发现
| 模型 | GFLOPs | AP | AP L | AP M | AP S |
|---|---|---|---|---|---|
| Backbone (ResNet50-DC5) | 110.7 | - | - | - | - |
| DETR-DC5 | +73.4 | 43.3 | 61.1 | 47.3 | 22.5 |
| Faster RCNN-DC5 | +209.3 | 41.1 | 55.0 | 45.9 | 22.9 |
| ACT (L=32) | +58.2 | 42.6 | 61.1 | 46.8 | 21.4 |
| ACT (L=24) | +53.1 | 41.3 | 60.6 | 45.9 | 19.2 |
| ACT (L=20) | +49.4 | 39.7 | 60.3 | 44.2 | 16.9 |
| ACT (L=16) | +45.0 | 37.1 | 58.8 | 41.3 | 13.9 |
| ACT+MTKD (L=32) | +58.2 | 43.1 | 61.4 | 47.1 | 22.2 |
| ACT+MTKD (L=24) | +53.1 | 42.3 | 61.0 | 46.4 | 21.3 |
| ACT+MTKD (L=20) | +49.5 | 41.8 | 60.7 | 45.6 | 20.6 |
| ACT+MTKD (L=16) | +45.1 | 40.6 | 59.7 | 44.3 | 18.5 |
- ACT 将 DETR 的 FLOPs(不含骨干网)从 73.4 Gflops 降至 58.2 Gflops,基线设置仅有 0.7% 的 AP 丢失。
- MTKD 进一步缩小 AP 差距,在与 ACT 结合时(L=32)相对于 DETR 仅有约 0.2% 的 AP 损失。
- ACT 的 L=32 在 AP 上达到与 DETR-DC5 相近的水平,在大/中等对象上优于 Faster RCNN-DC5,同等计算量下。
- ACT 在真实硬件上的推理时间和内存有显著节省(例如在 GTX TITAN X 上,单张图像时间更快,峰值内存更低)。
- 自适应聚类方法通过将语义相似的查询分组,显著减少冗余注意力,因特征冗余在更深的编码器层降低导致原型数量减少。
- 与 K-means 聚类相比,ACT 能更好地适应每张图像的特征分布和编码器层,提供在相似 FLOPs 下更好的准确性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。