[论文解读] BiFormer: Vision Transformer with Bi-Level Routing Attention
BiFormer 引入双层路由注意力(BRA),这是一种动态、对查询敏感的稀疏注意力机制,在执行 token 级注意力前对区域级相关性进行筛选,从而提升各视觉任务的准确性与效率。它在较低的 FLOPs 下实现了强劲的 ImageNet 表现,并且对检测与分割的迁移性良好。
As the core building block of vision transformers, attention is a powerful tool to capture long-range dependency. However, such power comes at a cost: it incurs a huge computation burden and heavy memory footprint as pairwise token interaction across all spatial locations is computed. A series of works attempt to alleviate this problem by introducing handcrafted and content-agnostic sparsity into attention, such as restricting the attention operation to be inside local windows, axial stripes, or dilated windows. In contrast to these approaches, we propose a novel dynamic sparse attention via bi-level routing to enable a more flexible allocation of computations with content awareness. Specifically, for a query, irrelevant key-value pairs are first filtered out at a coarse region level, and then fine-grained token-to-token attention is applied in the union of remaining candidate regions (\ie, routed regions). We provide a simple yet effective implementation of the proposed bi-level routing attention, which utilizes the sparsity to save both computation and memory while involving only GPU-friendly dense matrix multiplications. Built with the proposed bi-level routing attention, a new general vision transformer, named BiFormer, is then presented. As BiFormer attends to a small subset of relevant tokens in a extbf{query adaptive} manner without distraction from other irrelevant ones, it enjoys both good performance and high computational efficiency, especially in dense prediction tasks. Empirical results across several computer vision tasks such as image classification, object detection, and semantic segmentation verify the effectiveness of our design. Code is available at \url{https://github.com/rayleizhu/BiFormer}.
研究动机与目标
- 在不牺牲准确性的前提下,说明在视觉Transformer 中对高效、长距离建模的需求。
- 提出一种动态的、对查询敏感的稀疏性机制(BRA),以有选择地关注相关区域和标记。
- 开发以 BRA 构建的 BiFormer 作为图像分类、检测与分割的骨干网络。
- 提供复杂度分析,表明在恰当的区域划分下,BRA 的复杂度低于 vanilla 注意力。
- 在可比 FLOPs 条件下,展示 ImageNet-1K、COCO、ADE20K 的 state-of-the-art 或具竞争力的性能。
提出的方法
- 首先提出双层路由注意力(BRA),先构建区域级亲和图并对每个区域保留前 k 个连接。
- 通过对每个区域的标记表示取平均,计算区域级的查询/键。
- 从路由区域中获取相应的键/值标记,并在这个稀疏但已收集的集合上执行标记对标记的注意力。
- 通过深度卷积添加一个局部上下文增强项。
实验结果
研究问题
- RQ1区域级路由结合标记级注意力是否能够在少于 vanilla 或静态稀疏注意力的情况下实现可比或更高的准确性?
- RQ2BRA 如何随输入分辨率和区域划分扩展,并带来何种 FLOPs/准确度的权衡?
- RQ3在相似计算预算下,BiFormer 是否在分类、检测和分割任务上提升性能?
- RQ4有哪些定性证据表明 BRA 针对不同查询关注语义相关的区域?
主要发现
- 在合适的区域划分下,BRA 实现了 O((HW)^(4/3)) 的复杂度,相较于常规注意力减少了计算量。
- 搭载 BRA 的 BiFormer 在 ImageNet-1K 上达到 81.4% 的 Top-1,约 2.2 GFLOPs(BiFormer-T),以及 83.8%(BiFormer-S)在约 4.5 GFLOPs 下,超越同等预算下的若干基线。
- 在 COCO 数据集上,BiFormer-S/BIFormer-B 提供具有竞争力的 mAP,在 RetinaNet/Mask R-CNN 流程中对小目标的性能尤为突出。
- 在 ADE20K 上,BiFormer-S/B 在 Semantic FPN 与 UperNet 架构下超越若干稀疏注意力基线,获得 mIoU 增益。
- 消融实验确认 BRA 在分类和分割任务上均优于其他稀疏注意力机制。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。