arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.18425cs.CVcs.AI
收藏

ViG:基于门控线性注意力的线性复杂度视觉序列学习

ViG: Linear-complexity Visual Sequence Learning with Gated Linear Attention

Institute of Artificial Intelligence, Huazhong University of Science & Technology(华中科技大学人工智能研究院);School of EIC, Huazhong University of Science & Technology(华中科技大学电子信息与通信学院);Horizon Robotics(地平线机器人公司)

Bencheng Liao, Xinggang Wang, Lianghui Zhu, Qian Zhang, Chang Huang

AI总结:

本文提出 ViG 模型,通过引入门控线性注意力(GLA)并结合方向级门控和 2D 局部性注入,在保持高精度的同时显著提升了视觉序列建模的运行速度与内存效率。

摘要:

最近,线性复杂度序列建模网络在各种计算机视觉任务上取得了与 Vision Transformers 相似的建模能力,同时使用了更少的 FLOPs 和内存。然而,它们在实际运行速度上的优势并不显著。为了解决这个问题,我们引入了用于视觉的 Gated Linear Attention (GLA),利用其卓越的硬件感知能力和效率。我们提出了方向级门控,通过双向建模捕获 1D 全局上下文,并提出了 2D 门控局部性注入,以自适应地将 2D 局部细节注入 1D 全局上下文。我们的硬件感知实现进一步将前向和后向扫描合并到单个 kernel 中,增强了并行性并降低了内存开销和延迟。所提出的模型 ViG 在 ImageNet 和下游任务上在准确率、参数量和 FLOPs 方面取得了良好的权衡,优于流行的 Transformer 和基于 CNN 的模型。值得注意的是,ViG-S 匹配了 DeiT-B 的准确率,同时仅使用 27% 的参数和 20% 的 FLOPs,在 $224\ imes224$ 图像上运行速度快 2$\ imes$。在 $1024\ imes1024$ 分辨率下,ViG-T 使用的 FLOPs 减少了 5.2$\ imes$,节省了 90% 的 GPU 内存,运行速度快 4.8$\ imes$,并且比 DeiT-T 实现了 20.7% 更高的 top-1 准确率。这些结果使 ViG 成为视觉表示学习的高效且可扩展的解决方案。代码可在 \url{https://github.com/hustvl/ViG} 获取。

英文摘要:

Recently, linear complexity sequence modeling networks have achieved modeling capabilities similar to Vision Transformers on a variety of computer vision tasks, while using fewer FLOPs and less memory. However, their advantage in terms of actual runtime speed is not significant. To address this issue, we introduce Gated Linear Attention (GLA) for vision, leveraging its superior hardware-awareness and efficiency. We propose direction-wise gating to capture 1D global context through bidirectional modeling and a 2D gating locality injection to adaptively inject 2D local details into 1D global context. Our hardware-aware implementation further merges forward and backward scanning into a single kernel, enhancing parallelism and reducing memory cost and latency. The proposed model, ViG, offers a favorable trade-off in accuracy, parameters, and FLOPs on ImageNet and downstream tasks, outperforming popular Transformer and CNN-based models. Notably, ViG-S matches DeiT-B's accuracy while using only 27% of the parameters and 20% of the FLOPs, running 2$\times$ faster on $224\times224$ images. At $1024\times1024$ resolution, ViG-T uses 5.2$\times$ fewer FLOPs, saves 90% GPU memory, runs 4.8$\times$ faster, and achieves 20.7% higher top-1 accuracy than DeiT-T. These results position ViG as an efficient and scalable solution for visual representation learning. Code is available at \url{https://github.com/hustvl/ViG}.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑