Large deep learning models have achieved remarkable success in many scenarios. However, training large models is usually challenging, e.g., due to the high computational cost, the unstable and painfully slow optimization procedure, and the vulnerability to overfitting. To alleviate these problems, this work studies a divide-and-conquer strategy, i.e., dividing a large model into smaller modules, training them independently, and reassembling the trained modules to obtain the target model. This approach is promising since it avoids directly training large models from scratch. Nevertheless, implementing this idea is non-trivial, as it is difficult to ensure the compatibility of the independently trained modules. In this paper, we present an elegant solution to address this issue, i.e., we introduce a global, shared meta model to implicitly link all the modules together. This enables us to train highly compatible modules that collaborate effectively when they are assembled together. We further propose a module incubation mechanism that enables the meta model to be designed as an extremely shallow network. As a result, the additional overhead introduced by the meta model is minimalized. Though conceptually simple, our method significantly outperforms end-to-end (E2E) training in terms of both final accuracy and training efficiency. For example, on top of ViT-Huge, it improves the accuracy by 2.7% compared to the E2E baseline on ImageNet-1K, while saving the training cost by 43% in the meantime. Code is available at https://github.com/LeapLabTHU/Model-Assembling.
translated by 谷歌翻译
We introduce submodel co-training, a regularization method related to co-training, self-distillation and stochastic depth. Given a neural network to be trained, for each sample we implicitly instantiate two altered networks, ``submodels'', with stochastic depth: we activate only a subset of the layers. Each network serves as a soft teacher to the other, by providing a loss that complements the regular loss provided by the one-hot label. Our approach, dubbed cosub, uses a single set of weights, and does not involve a pre-trained external model or temporal averaging. Experimentally, we show that submodel co-training is effective to train backbones for recognition tasks such as image classification and semantic segmentation. Our approach is compatible with multiple architectures, including RegNet, ViT, PiT, XCiT, Swin and ConvNext. Our training strategy improves their results in comparable settings. For instance, a ViT-B pretrained with cosub on ImageNet-21k obtains 87.4% top-1 acc. @448 on ImageNet-val.
translated by 谷歌翻译
本文研究了从预先训练的模型,尤其是蒙面自动编码器中提取知识的潜力。我们的方法很简单:除了优化掩盖输入的像素重建损失外,我们还将教师模型的中间特征图与学生模型的中间特征图之间的距离最小化。此设计导致一个计算高效的知识蒸馏框架,给定1)仅使用一个少量可见的补丁子集,2)(笨拙的)教师模型仅需要部分执行,\ ie,\ ie,在前几个中,向前传播输入层,用于获得中间特征图。与直接蒸馏微型模型相比,提炼预训练的模型显着改善了下游性能。例如,通过将知识从MAE预先训练的VIT-L提炼为VIT-B,我们的方法可实现84.0%的Imagenet Top-1精度,表现优于直接将微型VIT-L蒸馏的基线,降低1.2%。更有趣的是,我们的方法即使具有极高的掩盖率也可以从教师模型中进行鲁棒性蒸馏:例如,在蒸馏过程中仅可见十个斑块,我们的VIT-B具有竞争力的前1个Imagenet精度为83.6%,在95%的掩盖率中,只有十个斑块。 ;令人惊讶的是,它仍然可以通过仅四个可见斑(98%的掩盖率)积极训练来确保82.4%的Top-1 Imagenet精度。代码和模型可在https://github.com/ucsc-vlaa/dmae上公开获得。
translated by 谷歌翻译
Recently, neural networks purely based on attention were shown to address image understanding tasks such as image classification. These highperforming vision transformers are pre-trained with hundreds of millions of images using a large infrastructure, thereby limiting their adoption.In this work, we produce competitive convolution-free transformers by training on Imagenet only. We train them on a single computer in less than 3 days. Our reference vision transformer (86M parameters) achieves top-1 accuracy of 83.1% (single-crop) on ImageNet with no external data.More importantly, we introduce a teacher-student strategy specific to transformers. It relies on a distillation token ensuring that the student learns from the teacher through attention. We show the interest of this token-based distillation, especially when using a convnet as a teacher. This leads us to report results competitive with convnets for both Imagenet (where we obtain up to 85.2% accuracy) and when transferring to other tasks. We share our code and models.
translated by 谷歌翻译
Recently, neural networks purely based on attention were shown to address image understanding tasks such as image classification. These highperforming vision transformers are pre-trained with hundreds of millions of images using a large infrastructure, thereby limiting their adoption.In this work, we produce competitive convolutionfree transformers trained on ImageNet only using a single computer in less than 3 days. Our reference vision transformer (86M parameters) achieves top-1 accuracy of 83.1% (single-crop) on ImageNet with no external data.We also introduce a teacher-student strategy specific to transformers. It relies on a distillation token ensuring that the student learns from the teacher through attention, typically from a convnet teacher. The learned transformers are competitive (85.2% top-1 acc.) with the state of the art on ImageNet, and similarly when transferred to other tasks. We will share our code and models.
translated by 谷歌翻译
Transformers have been recently adapted for large scale image classification, achieving high scores shaking up the long supremacy of convolutional neural networks. However the optimization of image transformers has been little studied so far. In this work, we build and optimize deeper transformer networks for image classification. In particular, we investigate the interplay of architecture and optimization of such dedicated transformers. We make two transformers architecture changes that significantly improve the accuracy of deep transformers. This leads us to produce models whose performance does not saturate early with more depth, for instance we obtain 86.5% top-1 accuracy on Imagenet when training with no external data, we thus attain the current SOTA with less FLOPs and parameters. Moreover, our best model establishes the new state of the art on Imagenet with Reassessed labels and Imagenet-V2 / match frequency, in the setting with no additional training data. We share our code and models 1 .
translated by 谷歌翻译
在本文中,我们通过利用视觉数据中的空间稀疏性提出了一种新的模型加速方法。我们观察到,视觉变压器中的最终预测仅基于最有用的令牌的子集,这足以使图像识别。基于此观察,我们提出了一个动态的令牌稀疏框架,以根据加速视觉变压器的输入逐渐和动态地修剪冗余令牌。具体而言,我们设计了一个轻量级预测模块,以估计给定当前功能的每个令牌的重要性得分。该模块被添加到不同的层中以层次修剪冗余令牌。尽管该框架的启发是我们观察到视觉变压器中稀疏注意力的启发,但我们发现自适应和不对称计算的想法可能是加速各种体系结构的一般解决方案。我们将我们的方法扩展到包括CNN和分层视觉变压器在内的层次模型,以及更复杂的密集预测任务,这些任务需要通过制定更通用的动态空间稀疏框架,并具有渐进性的稀疏性和非对称性计算,用于不同空间位置。通过将轻质快速路径应用于少量的特征,并使用更具表现力的慢速路径到更重要的位置,我们可以维护特征地图的结构,同时大大减少整体计算。广泛的实验证明了我们框架对各种现代体系结构和不同视觉识别任务的有效性。我们的结果清楚地表明,动态空间稀疏为模型加速提供了一个新的,更有效的维度。代码可从https://github.com/raoyongming/dynamicvit获得
translated by 谷歌翻译
虽然视觉变压器(VT)体系结构在计算机视觉中越来越流行,但纯VT模型在微小的数据集上的性能较差。为了解决这个问题,本文提出了改善小型数据集VT性能的地方指南。我们首先分析,由于VTS中自我注意的机制的高灵活性和内在的全球性,因此很难用有限的数据来学习局部信息,这对于理解图像非常重要。为了促进本地信息,我们通过模仿已经训练有素的卷积神经网络(CNN)的特征来实现VT的当地指南,灵感来自CNN的内置本地到全球层次结构。在我们的双任务学习范式下,由低分辨率图像训练的轻型CNN提供的局部指导足以加速收敛并在很大程度上提高VT的性能。因此,我们的本地指导方法非常简单有效,可以作为小型数据集中VT的基本性能增强方法。广泛的实验表明,我们的方法在小型数据集中从头开始训练时可以显着改善VT,并且与不同种类的VT和数据集兼容。例如,我们提出的方法可以将各种VT在微型数据集上的性能提高(例如,DEIT 13.07%,T2T为8.98%,PVT为7.85%),并使更强大的基线PVTV2提高了1.86%至79.30%,显示出来小型数据集上的VT潜力。该代码可从https://github.com/lkhl/tiny-transformers获得。
translated by 谷歌翻译
Vision transformer (ViT) models exhibit substandard optimizability. In particular, they are sensitive to the choice of optimizer (AdamW vs. SGD), optimizer hyperparameters, and training schedule length. In comparison, modern convolutional neural networks are easier to optimize. Why is this the case? In this work, we conjecture that the issue lies with the patchify stem of ViT models, which is implemented by a stride-p p×p convolution (p = 16 by default) applied to the input image. This large-kernel plus large-stride convolution runs counter to typical design choices of convolutional layers in neural networks. To test whether this atypical design choice causes an issue, we analyze the optimization behavior of ViT models with their original patchify stem versus a simple counterpart where we replace the ViT stem by a small number of stacked stride-two 3×3 convolutions. While the vast majority of computation in the two ViT designs is identical, we find that this small change in early visual processing results in markedly different training behavior in terms of the sensitivity to optimization settings as well as the final model accuracy. Using a convolutional stem in ViT dramatically increases optimization stability and also improves peak performance (by ∼1-2% top-1 accuracy on ImageNet-1k), while maintaining flops and runtime. The improvement can be observed across the wide spectrum of model complexities (from 1G to 36G flops) and dataset scales (from ImageNet-1k to ImageNet-21k). These findings lead us to recommend using a standard, lightweight convolutional stem for ViT models in this regime as a more robust architectural choice compared to the original ViT model design.
translated by 谷歌翻译
随着变压器作为语言处理的标准及其在计算机视觉方面的进步,参数大小和培训数据的数量相应地增长。许多人开始相信,因此,变形金刚不适合少量数据。这种趋势引起了人们的关注,例如:某些科学领域中数据的可用性有限,并且排除了该领域研究资源有限的人。在本文中,我们旨在通过引入紧凑型变压器来提出一种小规模学习的方法。我们首次表明,具有正确的尺寸,卷积令牌化,变压器可以避免在小数据集上过度拟合和优于最先进的CNN。我们的模型在模型大小方面具有灵活性,并且在获得竞争成果的同时,参数可能仅为0.28亿。当在CIFAR-10上训练Cifar-10,只有370万参数训练时,我们的最佳模型可以达到98%的准确性,这是与以前的基于变形金刚的模型相比,数据效率的显着提高,比其他变压器小于10倍,并且是15%的大小。在实现类似性能的同时,重新NET50。 CCT还表现优于许多基于CNN的现代方法,甚至超过一些基于NAS的方法。此外,我们在Flowers-102上获得了新的SOTA,具有99.76%的TOP-1准确性,并改善了Imagenet上现有基线(82.71%精度,具有29%的VIT参数)以及NLP任务。我们针对变压器的简单而紧凑的设计使它们更可行,可以为那些计算资源和/或处理小型数据集的人学习,同时扩展了在数据高效变压器中的现有研究工作。我们的代码和预培训模型可在https://github.com/shi-labs/compact-transformers上公开获得。
translated by 谷歌翻译
本文探讨了从视觉变压器查找最佳子模型的可行性,并引入了纯Vision变压器减肥(VIT-SLIM)框架,可以在跨多个维度从原始模型的端到端搜索这样的子结构,包括输入令牌,MHSA和MLP模块,具有最先进的性能。我们的方法基于学习和统一的L1稀疏限制,具有预定的因素,以反映不同维度的连续搜索空间中的全局重要性。通过单次训练方案,搜索过程非常有效。例如,在DeIT-S中,VIT-SLIM仅需要〜43 GPU小时进行搜索过程,并且搜索结构具有灵活的不同模块中的多维尺寸。然后,根据运行设备上的精度折叠折衷的要求采用预算阈值,并执行重新训练过程以获得最终模型。广泛的实验表明,我们的耐比可以压缩高达40%的参数和40%的视觉变压器上的40%拖鞋,同时在Imagenet上提高了〜0.6%的精度。我们还展示了我们搜索模型在几个下游数据集中的优势。我们的源代码将公开提供。
translated by 谷歌翻译
变压器出现为可视识别的强大工具。除了在广泛的视觉基准上展示竞争性能外,最近的作品还争辩说,变形金刚比卷曲神经网络(CNNS)更强大。令人惊讶的是,我们发现这些结论是从不公平的实验设置中得出的,其中变压器和CNN在不同的尺度上比较,并用不同的训练框架应用。在本文中,我们的目标是在变压器和CNN之间提供第一个公平和深入的比较,重点是鲁棒性评估。通过我们的统一培训设置,我们首先挑战以前的信念,使得在衡量对抗性鲁棒性时越来越多的CNN。更令人惊讶的是,如果他们合理地采用变形金刚的培训食谱,我们发现CNNS可以很容易地作为捍卫对抗性攻击的变形金刚。在关于推广样本的泛化的同时,我们显示了对(外部)大规模数据集的预训练不是对实现变压器来实现比CNN更好的性能的根本请求。此外,我们的消融表明,这种更强大的概括主要受到变压器的自我关注架构本身的影响,而不是通过其他培训设置。我们希望这项工作可以帮助社区更好地理解和基准变压器和CNN的鲁棒性。代码和模型在https://github.com/ytongbai/vits-vs-cnns上公开使用。
translated by 谷歌翻译
我们在视觉变压器上呈现整洁但有效的递归操作,可以提高参数利用而不涉及额外参数。这是通过在变压器网络的深度分享权重来实现的。所提出的方法可以只使用NA \“IVE递归操作来获得大量增益(〜2%),不需要对设计网络原理的特殊或复杂的知识,并引入训练程序的最小计算开销。减少额外的计算通过递归操作,同时保持卓越的准确性,我们通过递归层的多个切片组自行引入近似方法,这可以通过最小的性能损失将成本消耗降低10〜30%。我们称我们的模型切片递归变压器(SRET) ,这与高效视觉变压器的广泛的其他设计兼容。我们最好的模型在含有较少参数的同时,在最先进的方法中对Imagenet建立了重大改进。建议的切片递归操作使我们能够建立一个变压器超过100甚至1000层,仍然仍然小尺寸(13〜15米),以避免困难当模型尺寸太大时,IES在优化中。灵活的可扩展性显示出缩放和构建极深和大维视觉变压器的巨大潜力。我们的代码和模型可在https://github.com/szq0214/sret中找到。
translated by 谷歌翻译
Masked image modeling (MIM) performs strongly in pre-training large vision Transformers (ViTs). However, small models that are critical for real-world applications cannot or only marginally benefit from this pre-training approach. In this paper, we explore distillation techniques to transfer the success of large MIM-based pre-trained models to smaller ones. We systematically study different options in the distillation framework, including distilling targets, losses, input, network regularization, sequential distillation, etc, revealing that: 1) Distilling token relations is more effective than CLS token- and feature-based distillation; 2) An intermediate layer of the teacher network as target perform better than that using the last layer when the depth of the student mismatches that of the teacher; 3) Weak regularization is preferred; etc. With these findings, we achieve significant fine-tuning accuracy improvements over the scratch MIM pre-training on ImageNet-1K classification, using all the ViT-Tiny, ViT-Small, and ViT-base models, with +4.2%/+2.4%/+1.4% gains, respectively. Our TinyMIM model of base size achieves 52.2 mIoU in AE20K semantic segmentation, which is +4.1 higher than the MAE baseline. Our TinyMIM model of tiny size achieves 79.6% top-1 accuracy on ImageNet-1K image classification, which sets a new record for small vision models of the same size and computation budget. This strong performance suggests an alternative way for developing small vision Transformer models, that is, by exploring better training methods rather than introducing inductive biases into architectures as in most previous works. Code is available at https://github.com/OliverRensu/TinyMIM.
translated by 谷歌翻译
我们介绍了贴片采样时间表(PSS)的概念,该概念在训练过程中每批次使用的视觉变压器(VIT)贴片的数量变化。由于对于大多数视觉目标(例如,分类),所有补丁都不同样重要,因此我们认为,不太重要的补丁可以用于较少的训练迭代中,从而导致较短的训练时间,对性能的影响最小。此外,我们观察到,使用PSS的训练可以使VIT在推理过程中对更宽的贴片采样范围更强。这允许在推理过程中进行吞吐量和准确性之间的细粒度,动态的权衡。我们使用PSSS在VIT上评估Imagenet的VIT,均通过从头开始训练并使用重建损耗函数进行了预训练。对于预训练的模型,与使用所有斑块相比,我们的分类准确性降低了0.26%(从25小时到17小时)降低了0.26%。代码,模型检查点和日志可在https://github.com/bradmcdanel/pss上找到。
translated by 谷歌翻译
视觉变压器(VITS)已成为各种视觉任务的流行结构和优于卷积神经网络(CNNS)。然而,这种强大的变形金机带来了巨大的计算负担。而这背后的基本障碍是排气的令牌到令牌比较。为了缓解这一点,我们深入研究Vit的模型属性,观察到VITS表现出稀疏关注,具有高令牌相似性。这直观地向我们介绍了可行的结构不可知的尺寸,令牌编号,以降低计算成本。基于这一探索,我们为香草vits提出了一种通用的自我切片学习方法,即坐下。具体而言,我们首先设计一种新颖的令牌减肥模块(TSM),可以通过动态令牌聚集来提高VIT的推理效率。不同于令牌硬滴,我们的TSM轻轻地集成了冗余令牌变成了更少的信息,可以在不切断图像中的鉴别性令牌关系的情况下动态缩放视觉注意。此外,我们介绍了一种简洁的密集知识蒸馏(DKD)框架,其密集地以柔性自动编码器方式传送无组织的令牌信息。由于教师和学生之间的结构类似,我们的框架可以有效地利用结构知识以获得更好的收敛性。最后,我们进行了广泛的实验来评估我们的坐姿。它展示了我们的方法可以通过1.7倍加速VITS,其精度下降可忽略不计,甚至在3.6倍上加速VITS,同时保持其性能的97%。令人惊讶的是,通过简单地武装LV-VIT与我们的坐线,我们在想象中实现了新的最先进的表现,超过了最近文学中的所有CNN和VITS。
translated by 谷歌翻译
视觉变换器将每个图像分成具有固定长度的令牌序列,并以与自然语言处理中的单词相同的方式处理令牌。更多令牌通​​常会导致更好的性能,但计算成本显着增加。通过谚语“一张图片胜过千言万语”,我们的目标是通过制造长图像短而加速VIT模型。为此,我们提出了一种新颖的方法在推论期间自适应地分配令牌长度。具体而言,我们首先培养一种含有可调整化 - vit(Revit)的Vit模型,可以处理任何具有不同令牌长度的给定输入。然后,我们从Revit检索“令牌长度标签”,并使用它培训轻量级令牌长度分配(TLA)。令牌长度标签是最小的令牌,以分割Revit可以使REVIT可以进行正确的预测,并且学习TLA以基于这些标签分配最佳令牌长度。 TLA使REVIT能够在推理期间使用最小足够数量的令牌处理图像。因此,通过减少VIT模型中的令牌数字来提高推广速度。我们的方法是一般的,与现代视觉变压器架构兼容,可以显着减少计算扩展。我们在两个任务中验证了我们对多个代表性VIT模型(DEIT,LV-VIT和TIMESFRER)的效果(图像分类和动作识别)。
translated by 谷歌翻译
差异隐私(DP)提供了正式的隐私保证,以防止对手可以访问机器学习模型,从而从提取有关单个培训点的信息。最受欢迎的DP训练方法是差异私有随机梯度下降(DP-SGD),它通过在训练过程中注入噪声来实现这种保护。然而,以前的工作发现,DP-SGD通常会导致标准图像分类基准的性能显着降解。此外,一些作者假设DP-SGD在大型模型上固有地表现不佳,因为保留隐私所需的噪声规范与模型维度成正比。相反,我们证明了过度参数化模型上的DP-SGD可以比以前想象的要好得多。将仔细的超参数调整与简单技术结合起来,以确保信号传播并提高收敛速率,我们获得了新的SOTA,而没有额外数据的CIFAR-10,在81.4%的81.4%下(8,10^{ - 5}) - 使用40 -layer wide-Resnet,比以前的SOTA提高了71.7%。当对预训练的NFNET-F3进行微调时,我们在ImageNet(0.5,8*10^{ - 7})下达到了83.8%的TOP-1精度。此外,我们还在(8,8 \ cdot 10^{ - 7})下达到了86.7%的TOP-1精度,DP仅比当前的非私人SOTA仅4.3%。我们认为,我们的结果是缩小私人图像分类和非私有图像分类之间准确性差距的重要一步。
translated by 谷歌翻译
近年来,计算机视觉社区中最受欢迎的技术之一就是深度学习技术。作为一种数据驱动的技术,深层模型需要大量准确标记的培训数据,这在许多现实世界中通常是无法访问的。数据空间解决方案是数据增强(DA),可以人为地从原始样本中生成新图像。图像增强策略可能因数据集而有所不同,因为不同的数据类型可能需要不同的增强以促进模型培训。但是,DA策略的设计主要由具有领域知识的人类专家决定,这被认为是高度主观和错误的。为了减轻此类问题,一个新颖的方向是使用自动数据增强(AUTODA)技术自动从给定数据集中学习图像增强策略。 Autoda模型的目的是找到可以最大化模型性能提高的最佳DA策略。这项调查从图像分类的角度讨论了Autoda技术出现的根本原因。我们确定标准自动赛车模型的三个关键组件:搜索空间,搜索算法和评估功能。根据他们的架构,我们提供了现有图像AUTODA方法的系统分类法。本文介绍了Autoda领域的主要作品,讨论了他们的利弊,并提出了一些潜在的方向以进行未来的改进。
translated by 谷歌翻译
视觉变压器(VIT)的几乎没有射击的学习能力很少进行,尽管有很大的需求。在这项工作中,我们从经验上发现,使用相同的少数学习框架,例如\〜元基线,用VIT模型代替了广泛使用的CNN特征提取器,通常严重损害了几乎没有弹药的分类性能。此外,我们的实证研究表明,在没有归纳偏见的情况下,VIT通常会在几乎没有射击的学习方面学习低资格的令牌依赖性,在这些方案下,只有几个标记的培训数据可获得,这在很大程度上会导致上述性能降级。为了减轻这个问题,我们首次提出了一个简单而有效的几杆培训框架,即自我推广的监督(Sun)。具体而言,除了对全球语义学习的常规监督外,太阳还进一步预处理了少量学习数据集的VIT,然后使用它来生成各个位置特定的监督,以指导每个补丁令牌。此特定于位置的监督告诉VIT哪个贴片令牌相似或不同,因此可以加速令牌依赖的依赖学习。此外,它将每个贴片令牌中的本地语义建模,以提高对象接地和识别能力,以帮助学习可概括的模式。为了提高特定于位置的监督的质量,我们进一步提出了两种技术:〜1)背景补丁过滤以滤掉背景补丁并将其分配为额外的背景类别; 2)空间一致的增强,以引入足够的多样性以增加数据,同时保持生成的本地监督的准确性。实验结果表明,使用VITS的太阳显着超过了其他VIT的少量学习框架,并且是第一个获得比CNN最先进的效果更高的性能。
translated by 谷歌翻译