[论文解读] YOLOv12: Attention-Centric Real-Time Object Detectors
YOLOv12 引入区域注意力和残差高效层聚合,创建一个以注意力为中心的实时检测器,速度相当于CNN,同时在 COCO 上实现最先进的精度,超越 YOLOv10/YOLOv11 和 RT-DETR 变体。
Enhancing the network architecture of the YOLO framework has been crucial for a long time, but has focused on CNN-based improvements despite the proven superiority of attention mechanisms in modeling capabilities. This is because attention-based models cannot match the speed of CNN-based models. This paper proposes an attention-centric YOLO framework, namely YOLOv12, that matches the speed of previous CNN-based ones while harnessing the performance benefits of attention mechanisms. YOLOv12 surpasses all popular real-time object detectors in accuracy with competitive speed. For example, YOLOv12-N achieves 40.6% mAP with an inference latency of 1.64 ms on a T4 GPU, outperforming advanced YOLOv10-N / YOLOv11-N by 2.1%/1.2% mAP with a comparable speed. This advantage extends to other model scales. YOLOv12 also surpasses end-to-end real-time detectors that improve DETR, such as RT-DETR / RT-DETRv2: YOLOv12-S beats RT-DETR-R18 / RT-DETRv2-R18 while running 42% faster, using only 36% of the computation and 45% of the parameters. More comparisons are shown in Figure 1.
研究动机与目标
- 在不牺牲速度的前提下,将注意力机制引入实时 YOLO 检测器。
- 提出一个高效的区域注意力模块(A2),在减小计算量的同时保持较大的感受野。
- 引入残差高效层聚合网络(R-ELAN),以改善对基于注意力的骨干网络的优化。
- 应用架构调整以适应 YOLO 工作流,包括 FlashAttention 的使用和移除位置编码。
- 在 COCO 的多尺度模型上展示最先进的延迟-精度权衡。
提出的方法
- 提出区域注意力(A2),将特征图划分为 l 个区域,以将注意力成本从 O(n^2) 降至大约一半,同时保持较大的感受野。
- 采用 FlashAttention 以解决注意力计算中的内存访问瓶颈。
- 开发残差高效层聚合网络(R-ELAN),具有残差输入输出路径和类似瓶颈的特征聚合,以稳定较大模型的训练。
- 为 YOLO 调整架构选择,例如将 MLP 比例降至 1.2、使用 conv+BN 代替线性层+LN、移除位置编码,并引入一个大的 7x7 位置感知器。
- 保留前代 YOLO 版本的分层骨干设计,简化块堆叠,并在五个尺度(N、S、M、L、X)将注意力模块整合到 YOLO 框架中。
- 在 MSCOCO-2017 上以 SGD 进行 600 轮训练并评估,线性学习率衰减,以及在 T4 GPU 上使用 TensorRT FP16 延迟测量。
实验结果
研究问题
- RQ1一个以注意力为中心的 YOLO(YOLOv12)是否能够在不牺牲精度的前提下实现与基于 CNN 的检测器相当的实时速度?
- RQ2区域注意力和 R-ELAN 是否能够在多模型尺度上实现稳定的优化并提供优越的实时目标检测性能?
- RQ3在标准基准测试中,YOLOv12 与最先进的实时检测器(YOLOv10/YOLOv11、RT-DETR)在 mAP、FLOPs、参数量和延迟方面有何比较?
- RQ4在实时检测器中,平衡注意力与前馈组件计算量的关键架构与方法调整有哪些?
主要发现
- YOLOv12-N 在 T4 GPU 上实现 40.6% mAP,延迟 1.64 ms,较 YOLOv10-N 提升 2.1% mAP,较 YOLOv11-N 提升 1.2% mAP。
- YOLOv12-S 实现 48.0% mAP,延迟 2.61 ms,展现出具有竞争力的性能(FLOPs 约 21.4G,参数约 9.3M)。
- YOLOv12-L 和 YOLOv12-X 在可扩展的 FLOPs 与参数下获得更高的 mAP(分别为 53.7% 和 55.2%),同时保持相对于 RT-DETR 变体的快速推理。
- 区域注意力在 CUDA 和 CPU 基准测试中带来显著的加速,减少推理时间,同时精度损失不显著。
- 消融研究表明 R-ELAN 对更大模型的稳定性有益,并且移除位置嵌入可以在不损害精度的情况下提高速度。
- 热力图可视化显示,与 YOLOv10/YOLOv11 相比,YOLOv12 的对象感知更清晰,归因于区域注意力更大的感受野。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。