AnchorFormer:用于高效视觉Transformer的可微锚点注意力
AnchorFormer: Differentiable Anchor Attention for Efficient Vision Transformer
AI总结:
提出AnchorFormer,利用可微锚点注意力将ViT复杂度从O(n²)降至O(mn),在分类、检测、分割任务上显著提升效率与精度。
摘要:
近年来,视觉Transformer(ViTs)通过衡量图像补丁之间的全局自注意力,在视觉任务上取得了优异的性能。给定$n$个补丁,其复杂度为二次方,如$\mathcal{O}(n^2)$,当以较小粒度分割输入图像时,时间成本较高。同时,关键信息往往随机集中在输入图像的少数区域,一些令牌可能对下游任务无益。为解决此问题,我们提出了一种基于锚点的高效视觉Transformer(AnchorFormer),其利用锚点令牌学习关键信息并加速推理。首先,通过估计锚点与令牌之间的二部注意力,复杂度从$\mathcal{O}(n^2)$降至$\mathcal{O}(mn)$,其中$m$为锚点数量且$m<n$。值得注意的是,通过将锚点表示为神经层中的神经元,我们可以可微地学习这些锚点,并通过马尔可夫过程近似全局自注意力。这避免了不可微操作带来的负担,并进一步加速了近似注意力。此外,我们将所提模型扩展到三个下游任务,包括分类、检测和分割。大量实验证明了AnchorFormer的有效性,例如,与当前基线相比,在ImageNet分类上实现了高达9.0%的准确率提升或46.7%的FLOPs减少,在COCO检测上在相当FLOPs下实现了81.3%的mAP提升。
英文摘要:
Recently, vision transformers (ViTs) have achieved excellent performance on vision tasks by measuring the global self-attention among the image patches. Given $n$ patches, they will have quadratic complexity such as $\mathcal{O}(n^2)$ and the time cost is high when splitting the input image with a small granularity. Meanwhile, the pivotal information is often randomly gathered in a few regions of an input image, some tokens may not be helpful for the downstream tasks. To handle this problem, we introduce an anchor-based efficient vision transformer (AnchorFormer), which employs the anchor tokens to learn the pivotal information and accelerate the inference. Firstly, by estimating the bipartite attention between the anchors and tokens, the complexity will be reduced from $\mathcal{O}(n^2)$ to $\mathcal{O}(mn)$, where $m$ is an anchor number and $m < n$. Notably, by representing the anchors with the neurons in a neural layer, we can differentiably learn these anchors and approximate global self-attention through the Markov process. It avoids the burden caused by non-differentiable operations and further speeds up the approximate attention. Moreover, we extend the proposed model to three downstream tasks including classification, detection, and segmentation. Extensive experiments show the effectiveness of our AnchorFormer, e.g., achieving up to a 9.0% higher accuracy or 46.7% FLOPs reduction on ImageNet classification, 81.3% higher mAP on COCO detection under comparable FLOPs, as compared to the current baselines.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。