Transformer is a new kind of neural architecture which encodes the input data as powerful features via the attention mechanism. Basically, the visual transformers first divide the input images into several local patches and then calculate both representations and their relationship. Since natural images are of high complexity with abundant detail and color information, the granularity of the patch dividing is not fine enough for excavating features of objects in different scales and locations. In this paper, we point out that the attention inside these local patches are also essential for building visual transformers with high performance and we explore a new architecture, namely, Transformer iN Transformer (TNT). Specifically, we regard the local patches (e.g., 16×16) as "visual sentences" and present to further divide them into smaller patches (e.g., 4×4) as "visual words". The attention of each word will be calculated with other words in the given visual sentence with negligible computational costs. Features of both words and sentences will be aggregated to enhance the representation ability. Experiments on several benchmarks demonstrate the effectiveness of the proposed TNT architecture, e.g., we achieve an 81.5% top-1 accuracy on the ImageNet, which is about 1.7% higher than that of the state-of-the-art visual transformer with similar computational cost.
translated by 谷歌翻译
视觉变压器由于能够捕获图像中的长期依赖性的能力而成功地应用于图像识别任务。但是,变压器与现有卷积神经网络(CNN)之间的性能和计算成本仍然存在差距。在本文中,我们旨在解决此问题,并开发一个网络,该网络不仅可以超越规范变压器,而且可以超越高性能卷积模型。我们通过利用变压器来捕获长期依赖性和CNN来建模本地特征,从而提出了一个新的基于变压器的混合网络。此外,我们将其扩展为获得一个称为CMT的模型家族,比以前的基于卷积和基于变压器的模型获得了更好的准确性和效率。特别是,我们的CMT-S在ImageNet上获得了83.5%的TOP-1精度,而在拖鞋上的拖曳率分别比现有的DEIT和EficitiveNet小14倍和2倍。拟议的CMT-S还可以很好地概括CIFAR10(99.2%),CIFAR100(91.7%),花(98.7%)以及其他具有挑战性的视觉数据集,例如可可(44.3%地图),计算成本较小。
translated by 谷歌翻译
ous vision tasks without convolutions, where it can be used as a direct replacement for CNN backbones. (3) We validate PVT through extensive experiments, showing that it boosts the performance of many downstream tasks, including object detection, instance and semantic segmentation. For example, with a comparable number of parameters, PVT+RetinaNet achieves 40.4 AP on the COCO dataset, surpassing ResNet50+RetinNet (36.3 AP) by 4.1 absolute AP (see Figure 2). We hope that PVT could serve as an alternative and useful backbone for pixel-level predictions and facilitate future research.
translated by 谷歌翻译
We present in this paper a new architecture, named Convolutional vision Transformer (CvT), that improves Vision Transformer (ViT) in performance and efficiency by introducing convolutions into ViT to yield the best of both designs. This is accomplished through two primary modifications: a hierarchy of Transformers containing a new convolutional token embedding, and a convolutional Transformer block leveraging a convolutional projection. These changes introduce desirable properties of convolutional neural networks (CNNs) to the ViT architecture (i.e. shift, scale, and distortion invariance) while maintaining the merits of Transformers (i.e. dynamic attention, global context, and better generalization). We validate CvT by conducting extensive experiments, showing that this approach achieves state-of-the-art performance over other Vision Transformers and ResNets on ImageNet-1k, with fewer parameters and lower FLOPs. In addition, performance gains are maintained when pretrained on larger datasets (e.g. ImageNet-22k) and fine-tuned to downstream tasks. Pretrained on ImageNet-22k, our CvT-W24 obtains a top-1 accuracy of 87.7% on the ImageNet-1k val set. Finally, our results show that the positional encoding, a crucial component in existing Vision Transformers, can be safely removed in our model, simplifying the design for higher resolution vision tasks. Code will be released at https: //github.com/leoxiaobin/CvT.
translated by 谷歌翻译
人类视力能够从整个场景中捕获部分整个分层信息。本文介绍了Visual解析器(VIP),它明确地构造了与变压器的等层次结构。 VIP将视觉表示分为两个级别,零件级别和整个级别。每个部分的信息代表整个内部的几个独立向量的组合。为了模拟两个级别的表示,我们首先通过注意机制将整体信息从整体编码为部分向量,然后将零件向量内的全局信息解码回到整个表示中。通过使用所提出的编码器 - 解码器交互迭代地解析两个级别,模型可以逐渐改进两个级别上的特征。实验结果表明,VIP可以在三个主要任务中实现非常竞争的性能。分类,检测和实例分割。特别是,它可以通过对象检测的大边缘超越先前的最先进的CNN主干。 VIP系列的小型型号为7.2美元,参数为$ 7.2 \ times $ 10.9 \ times $更少的拖鞋可以与最大的resnext-101-64 $ \ times $ 4d的resne(x)t家族相对表现。可视化结果还表明,学习部分对预测类具有高度信息,使VIP比以前的基本架构更可说明。代码可在https://github.com/kevin-ssy/vip上获得。
translated by 谷歌翻译
本文解决了由多头自我注意力(MHSA)中高计算/空间复杂性引起的视觉变压器的低效率缺陷。为此,我们提出了层次MHSA(H-MHSA),其表示以层次方式计算。具体而言,我们首先将输入图像分为通常完成的补丁,每个补丁都被视为令牌。然后,拟议的H-MHSA学习本地贴片中的令牌关系,作为局部关系建模。然后,将小贴片合并为较大的贴片,H-MHSA对少量合并令牌的全局依赖性建模。最后,汇总了本地和全球专注的功能,以获得具有强大表示能力的功能。由于我们仅在每个步骤中计算有限数量的令牌的注意力,因此大大减少了计算负载。因此,H-MHSA可以在不牺牲细粒度信息的情况下有效地模拟令牌之间的全局关系。使用H-MHSA模块合并,我们建立了一个基于层次的变压器网络的家族,即HAT-NET。为了证明在场景理解中HAT-NET的优越性,我们就基本视觉任务进行了广泛的实验,包括图像分类,语义分割,对象检测和实例细分。因此,HAT-NET为视觉变压器提供了新的视角。可以在https://github.com/yun-liu/hat-net上获得代码和预估计的模型。
translated by 谷歌翻译
视觉表示学习是解决各种视力问题的关键。依靠开创性的网格结构先验,卷积神经网络(CNN)已成为大多数深视觉模型的事实上的标准架构。例如,经典的语义分割方法通常采用带有编码器编码器体系结构的完全横向卷积网络(FCN)。编码器逐渐减少了空间分辨率,并通过更大的接受场来学习更多抽象的视觉概念。由于上下文建模对于分割至关重要,因此最新的努力一直集中在通过扩张(即极度)卷积或插入注意力模块来增加接受场。但是,基于FCN的体系结构保持不变。在本文中,我们旨在通过将视觉表示学习作为序列到序列预测任务来提供替代观点。具体而言,我们部署纯变压器以将图像编码为一系列贴片,而无需局部卷积和分辨率减少。通过在变压器的每一层中建立的全球环境,可以学习更强大的视觉表示形式,以更好地解决视力任务。特别是,我们的细分模型(称为分割变压器(SETR))在ADE20K上擅长(50.28%MIOU,这是提交当天测试排行榜中的第一个位置),Pascal环境(55.83%MIOU),并在CityScapes上达到竞争成果。此外,我们制定了一个分层局部全球(HLG)变压器的家族,其特征是窗户内的本地关注和跨窗户的全球性专注于层次结构和金字塔架构。广泛的实验表明,我们的方法在各种视觉识别任务(例如,图像分类,对象检测和实例分割和语义分割)上实现了吸引力的性能。
translated by 谷歌翻译
变压器已成为深度学习中的主导架构之一,特别是计算机视觉中的卷积神经网络(CNNS)的强大替代品。然而,由于长期表示的自我关注的二次复杂性,以前作品中的变压器培训和推理可能是非常昂贵的,特别是对于高分辨率密集预测任务。为此,我们提出了一种更少的关注视觉变压器(点亮),建立在变形金刚的早期自我注意层仍然专注于当地模式并在最近的等级视觉变压器中带来轻微的益处。具体而言,我们提出了一种分层变压器,在那里我们使用纯多层的感知(MLP)来在早期阶段编码丰富的本地模式,同时应用自我注意模块来捕获更深层中的较长依赖性。此外,我们进一步提出了一种学习的可变形的令牌合并模块,以以非均匀方式自适应地熔化信息贴片。建议的点亮在图像识别任务中实现了有希望的性能,包括图像分类,对象检测和实例分段,作为许多愿景任务的强骨干。代码可用:https://github.com/zhuang-group/lit
translated by 谷歌翻译
This paper presents a new vision Transformer, called Swin Transformer, that capably serves as a general-purpose backbone for computer vision. Challenges in adapting Transformer from language to vision arise from differences between the two domains, such as large variations in the scale of visual entities and the high resolution of pixels in images compared to words in text. To address these differences, we propose a hierarchical Transformer whose representation is computed with Shifted windows. The shifted windowing scheme brings greater efficiency by limiting self-attention computation to non-overlapping local windows while also allowing for cross-window connection. This hierarchical architecture has the flexibility to model at various scales and has linear computational complexity with respect to image size. These qualities of Swin Transformer make it compatible with a broad range of vision tasks, including image classification (87.3 top-1 accuracy on ImageNet-1K) and dense prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO testdev) and semantic segmentation (53.5 mIoU on ADE20K val). Its performance surpasses the previous state-of-theart by a large margin of +2.7 box AP and +2.6 mask AP on COCO, and +3.2 mIoU on ADE20K, demonstrating the potential of Transformer-based models as vision backbones. The hierarchical design and the shifted window approach also prove beneficial for all-MLP architectures. The code and models are publicly available at https://github. com/microsoft/Swin-Transformer.
translated by 谷歌翻译
The recently developed vision transformer (ViT) has achieved promising results on image classification compared to convolutional neural networks. Inspired by this, in this paper, we study how to learn multi-scale feature representations in transformer models for image classification. To this end, we propose a dual-branch transformer to combine image patches (i.e., tokens in a transformer) of different sizes to produce stronger image features. Our approach processes small-patch and large-patch tokens with two separate branches of different computational complexity and these tokens are then fused purely by attention multiple times to complement each other. Furthermore, to reduce computation, we develop a simple yet effective token fusion module based on cross attention, which uses a single token for each branch as a query to exchange information with other branches. Our proposed cross-attention only requires linear time for both computational and memory complexity instead of quadratic time otherwise. Extensive experiments demonstrate that our approach performs better than or on par with several concurrent works on vision transformer, in addition to efficient CNN models. For example, on the ImageNet1K dataset, with some architectural changes, our approach outperforms the recent DeiT by a large margin of 2% with a small to moderate increase in FLOPs and model parameters. Our source codes and models are available at https://github.com/IBM/CrossViT.
translated by 谷歌翻译
变压器网络对计算机视觉任务取得了很大的进步。变压器 - 变压器(TNT)架构利用内部变压器和外部变压器提取本地和全局表示。在这项工作中,我们通过引入两个先进的设计:1)金字塔架构和2)卷积阀。通过建立分层表示,新的“金字塔”显着改善了原始TNT。Pyramidtnt比以前的最先进的视觉变压器(如Swin Transformer)实现更好的表演。我们希望这一新基线能够有助于视觉变压器的进一步研究和应用。代码将在https://github.com/huawei-noah/cv-backbones/tree/master/tnt_pytorch获得。
translated by 谷歌翻译
变压器是一种基于关注的编码器解码器架构,彻底改变了自然语言处理领域。灵感来自这一重大成就,最近在将变形式架构调整到计算机视觉(CV)领域的一些开创性作品,这已经证明了他们对各种简历任务的有效性。依靠竞争力的建模能力,与现代卷积神经网络相比在本文中,我们已经为三百不同的视觉变压器进行了全面的审查,用于三个基本的CV任务(分类,检测和分割),提出了根据其动机,结构和使用情况组织这些方法的分类。 。由于培训设置和面向任务的差异,我们还在不同的配置上进行了评估了这些方法,以便于易于和直观的比较而不是各种基准。此外,我们已经揭示了一系列必不可少的,但可能使变压器能够从众多架构中脱颖而出,例如松弛的高级语义嵌入,以弥合视觉和顺序变压器之间的差距。最后,提出了三个未来的未来研究方向进行进一步投资。
translated by 谷歌翻译
先前的视觉MLP,如MLP-MILER和RESMLP接受线性扁平的图像贴片作为输入,使其对不同的输入大小和难以捕获空间信息。这种方法隐瞒了MLP与基于变压器的对应物相比,并防止它们成为计算机视觉的一般骨干。本文介绍了Hire-MLP,通过\ TextBF {Hi} reachical \ TextBF {Re}排列,这是一个简单而竞争的愿景MLP架构,其中包含两个重排级别。具体地,提出内部区域重新排列以捕获空间区域内的局部信息,并且提出横区域重新排列以使不同区域之间的信息通信能够通过沿空间方向循环地转换所有令牌来实现不同区域之间的信息通信。广泛的实验证明了Hire-MLP作为各种视觉任务的多功能骨干的有效性。特别是,Hire-MLP在图像分类,对象检测和语义分割任务上实现竞争结果,例如,在Imagenet上的83.8%的前1个精度,51.7%盒AP和Coco Val2017上的44.8%掩模AP和Ade20k上的49.9%Miou ,超越以前的基于变压器和基于MLP的型号,具有更好的折衷以获得准确性和吞吐量。代码可在https://github.com/ggjy/hire-wave-mlp.pytorch获得。
translated by 谷歌翻译
过去一年目睹了将变压器模块应用于视力问题的快速发展。虽然一些研究人员已经证明,基于变压器的模型享有有利的拟合数据能力,但仍然越来越多的证据,表明这些模型尤其在训练数据受到限制时遭受过度拟合。本文通过执行逐步操作来提供实证研究,逐步运输基于变压器的模型到基于卷积的模型。我们在过渡过程中获得的结果为改善视觉识别提供了有用的消息。基于这些观察,我们提出了一个名为VIRFormer的新架构,该体系结构从“视觉友好的变压器”中缩写。具有相同的计算复杂度,在想象集分类精度方面,VISFormer占据了基于变压器的基于卷积的模型,并且当模型复杂性较低或训练集较小时,优势变得更加重要。代码可在https://github.com/danczs/visformer中找到。
translated by 谷歌翻译
我们介绍克斯内变压器,一种高效且有效的变压器的骨干,用于通用视觉任务。变压器设计的具有挑战性的问题是,全球自我关注来计算成本昂贵,而局部自我关注经常限制每个令牌的相互作用。为了解决这个问题,我们开发了以平行的横向和垂直条纹在水平和垂直条纹中计算自我关注的交叉形窗口自我关注机制,通过将输入特征分成相等的条纹而获得的每个条纹宽度。我们提供了条纹宽度效果的数学分析,并改变变压器网络的不同层的条纹宽度,这在限制计算成本时实现了强大的建模能力。我们还介绍了本地增强的位置编码(LEPE),比现有的编码方案更好地处理本地位置信息。 LEPE自然支持任意输入分辨率,因此对下游任务特别有效和友好。 CSWIN变压器并入其具有这些设计和分层结构,展示了普通愿景任务的竞争性能。具体来说,它在ImageNet-1K上实现了85.4 \%Top-1精度,而无需任何额外的培训数据或标签,53.9盒AP和46.4掩模AP,ADE20K语义分割任务上的52.2 Miou,超过以前的状态 - 在类似的拖鞋设置下,艺术品+1.2,+2.0,+1.4和+2.0分别为+1.2,+2.0,+1.4和+2.0。通过在较大的数据集Imagenet-21k上进行前预先预订,我们在Ave20K上实现了87.5%的成像-1K和高分性能,55.7 miou。代码和模型可在https://github.com/microsoft/cswin-transformer中找到。
translated by 谷歌翻译
Since the recent success of Vision Transformers (ViTs), explorations toward transformer-style architectures have triggered the resurgence of modern ConvNets. In this work, we explore the representation ability of DNNs through the lens of interaction complexities. We empirically show that interaction complexity is an overlooked but essential indicator for visual recognition. Accordingly, a new family of efficient ConvNets, named MogaNet, is presented to pursue informative context mining in pure ConvNet-based models, with preferable complexity-performance trade-offs. In MogaNet, interactions across multiple complexities are facilitated and contextualized by leveraging two specially designed aggregation blocks in both spatial and channel interaction spaces. Extensive studies are conducted on ImageNet classification, COCO object detection, and ADE20K semantic segmentation tasks. The results demonstrate that our MogaNet establishes new state-of-the-art over other popular methods in mainstream scenarios and all model scales. Typically, the lightweight MogaNet-T achieves 80.0\% top-1 accuracy with only 1.44G FLOPs using a refined training setup on ImageNet-1K, surpassing ParC-Net-S by 1.4\% accuracy but saving 59\% (2.04G) FLOPs.
translated by 谷歌翻译
视觉变压器(VIT)触发了计算机视觉的最新和重大突破。它们的有效设计主要由计算复杂性的间接度量(即拖船)指导,但是,该指标与直接度量(例如吞吐量)具有明显的差距。因此,我们建议将目标平台上的直接速度评估作为有效VIT的设计原理。特别是,我们介绍了LITV2,这是一种简单有效的VIT,可与以更快的速度更快的不同模型大小相对现有的最新方法。 LITV2的核心是一种新型的自我发项机制,我们将其配音。希洛的灵感来自于洞察力的启发:图像中的高频捕获本地细节和低频集中在全球结构上,而多头自发项层则忽略了不同频率的特征。因此,我们建议通过将头部分为两组来解散注意力层中的高/低频模式,其中一组在每个本地窗口内通过自我关注来编码高频,而另一组则执行注意力以模拟全局关系。在每个窗口的平均低频键与输入功能图中的每个查询位置之间。从两组的有效设计中受益,我们表明希洛通过对GPU上的速度,速度和记忆消耗进行了全面测试,优于现有的注意机制。 LITV2由Hilo提供支持,是主流视觉任务的强大主链,包括图像分类,密集检测和分割。代码可从https://github.com/ziplab/litv2获得。
translated by 谷歌翻译
在过去的十年中,CNN在电脑愿景世界中统治了至高无上,但最近,变压器一直在崛起。然而,自我关注的二次计算成本已成为实践应用中的严重问题。在没有CNN的情况下,在这种情况下已经有很多研究了,并且在这种情况下自我关注。特别地,MLP混合器是使用MLP设计的简单架构,并击中与视觉变压器相当的精度。然而,这种体系结构中唯一的归纳偏见是嵌入令牌。这叶打开了将非卷积(或非本地)电感偏差结合到架构中的可能性,因此我们使用了两个简单的想法,以便利用其捕获全局相关能力的同时将电感偏差纳入MLP混合器。一种方法是将令牌混合块垂直和水平分割。另一种方法是在一些令牌混合通道中进行空间相关性密集。通过这种方法,我们能够提高MLP混合器的准确性,同时降低其参数和计算复杂性。 RAFTMLP-S的小型模型与每个计算的参数和效率方面的基于最先进的全球MLP的模型相当。此外,我们通过利用双向插值来解决基于MLP的模型的固定输入图像分辨率的问题。我们证明这些模型可以应用于诸如物体检测的下游任务的架构的骨干。但是,它没有显着的性能,并提到了对基于全球MLP的模型的下游任务的特定MLP特定架构的需求。 pytorch版本中的源代码可用于\ url {https:/github.com/okojoalg/raft-mlp}。
translated by 谷歌翻译
视觉变压器(VIT)的最新进展在视觉识别任务中取得了出色的表现。卷积神经网络(CNNS)利用空间电感偏见来学习视觉表示,但是这些网络在空间上是局部的。 VIT可以通过其自我注意力机制学习全球表示形式,但它们通常是重量重量,不适合移动设备。在本文中,我们提出了交叉功能关注(XFA),以降低变压器的计算成本,并结合有效的移动CNN,形成一种新型有效的轻质CNN-CNN-VIT混合模型Xformer,可以用作通用的骨干链。学习全球和本地代表。实验结果表明,Xformer在不同的任务和数据集上的表现优于大量CNN和基于VIT的模型。在ImagEnet1k数据集上,XFormer以550万参数的优先级达到78.5%的TOP-1精度,比EdgitionNet-B0(基于CNN)(基于CNN)和DEIT(基于VIT)(基于VIT)的参数高2.2%和6.3%。当转移到对象检测和语义分割任务时,我们的模型也表现良好。在MS Coco数据集上,Xformer在Yolov3框架中仅超过10.5 AP(22.7-> 33.2 AP),只有630万参数和3.8克Flops。在CityScapes数据集上,只有一个简单的全MLP解码器,Xformer可实现78.5的MIOU,而FPS为15.3,超过了最先进的轻量级分割网络。
translated by 谷歌翻译
Vision Transformers have shown great promise recently for many vision tasks due to the insightful architecture design and attention mechanism. By revisiting the self-attention responses in Transformers, we empirically observe two interesting issues. First, Vision Transformers present a queryirrelevant behavior at deep layers, where the attention maps exhibit nearly consistent contexts in global scope, regardless of the query patch position (also head-irrelevant). Second, the attention maps are intrinsically sparse, few tokens dominate the attention weights; introducing the knowledge from ConvNets would largely smooth the attention and enhance the performance. Motivated by above observations, we generalize self-attention formulation to abstract a queryirrelevant global context directly and further integrate the global context into convolutions. The resulting model, a Fully Convolutional Vision Transformer (i.e., FCViT), purely consists of convolutional layers and firmly inherits the merits of both attention mechanism and convolutions, including dynamic property, weight sharing, and short- and long-range feature modeling, etc. Experimental results demonstrate the effectiveness of FCViT. With less than 14M parameters, our FCViT-S12 outperforms related work ResT-Lite by 3.7% top1 accuracy on ImageNet-1K. When scaling FCViT to larger models, we still perform better than previous state-of-the-art ConvNeXt with even fewer parameters. FCViT-based models also demonstrate promising transferability to downstream tasks, like object detection, instance segmentation, and semantic segmentation. Codes and models are made available at: https://github.com/ma-xu/FCViT.
translated by 谷歌翻译