arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2107.02239cs.CVcs.AIcs.CCcs.LG
收藏

Vision Xformers:用于图像分类的高效注意力算法

Vision Xformers: Efficient Attention for Image Classification

Indian Institute of Technology Bombay(印度理工学院孟买分校)

Pranav Jeevan, Amit Sethi

摘要:

尽管Transformers已经成为自然语言处理的首选神经架构,但它们需要更多数量级的训练数据、GPU内存和计算,才能与卷积神经网络竞争计算机视觉。Transformers的注意力机制与输入序列的长度成二次关系,并且展开的图像具有长的序列长度。此外,Transformers缺乏适合图像的电感偏置。我们测试了三个修改视觉Transformer(ViT)架构,解决这些缺点。首先,我们通过使用线性注意力机制来缓解二次瓶颈,称为X-formers(例如,{Performer,Linformer,Nyströmformer}中的X),从而创建Vision X-formers(ViXs)。这导致GPU内存需求减少了7倍。我们还将它们的性能与FNet和多层感知器混合器进行了比较,这进一步降低了GPU内存需求。其次,我们通过在ViX中用卷积层取代初始线性嵌入层,为图像引入了一个归纳偏差,这在不增加模型大小的情况下显著提高了分类准确性。第三,我们用旋转位置嵌入(RoPE)替换了ViT中的可学习1D位置嵌入,这提高了相同模型大小的分类精度。我们相信,通过让那些数据和计算资源有限的人能够使用这些变化,可以使Transformers民主化。

英文摘要:

Although transformers have become the neural architectures of choice for natural language processing, they require orders of magnitude more training data, GPU memory, and computations in order to compete with convolutional neural networks for computer vision. The attention mechanism of transformers scales quadratically with the length of the input sequence, and unrolled images have long sequence lengths. Plus, transformers lack an inductive bias that is appropriate for images. We tested three modifications to vision transformer (ViT) architectures that address these shortcomings. Firstly, we alleviate the quadratic bottleneck by using linear attention mechanisms, called X-formers (such that, X in {Performer, Linformer, Nyströmformer}), thereby creating Vision X-formers (ViXs). This resulted in up to a seven times reduction in the GPU memory requirement. We also compared their performance with FNet and multi-layer perceptron mixers, which further reduced the GPU memory requirement. Secondly, we introduced an inductive bias for images by replacing the initial linear embedding layer by convolutional layers in ViX, which significantly increased classification accuracy without increasing the model size. Thirdly, we replaced the learnable 1D position embeddings in ViT with Rotary Position Embedding (RoPE), which increases the classification accuracy for the same model size. We believe that incorporating such changes can democratize transformers by making them accessible to those with limited data and computing resources.

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

↑