
摘要
近年来,纯Transformer架构模型在图像分类、目标检测等视觉任务中展现出巨大潜力。然而,Transformer网络的设计仍面临诸多挑战。已有研究发现,模型深度、嵌入维度以及注意力头数等关键超参数对视觉Transformer的性能具有显著影响。以往的方法通常依赖人工经验来设定这些超参数。在本工作中,我们提出一种全新的单次架构搜索框架——AutoFormer,专门用于视觉Transformer的自动化搜索。AutoFormer在超网络(supernet)训练过程中,将同一层内不同模块的权重进行耦合(entangle),从而使得训练后的超网络能够高效支持数千个子网络的高质量训练。具体而言,这些子网络继承超网络权重后,其性能可与从头开始训练的模型相媲美。此外,所搜索得到的模型(即AutoFormer)在多项指标上超越了当前最先进的模型,如ViT和DeiT。其中,AutoFormer-tiny/small/base在ImageNet数据集上分别实现了74.7% / 81.7% / 82.4%的Top-1准确率,参数量分别为570万、2290万和5370万。最后,我们通过在下游任务基准测试和知识蒸馏实验中验证了AutoFormer的迁移能力。相关代码与模型已开源,详见:https://github.com/microsoft/AutoML。
代码仓库
microsoft/AutoML
官方
pytorch
GitHub 中提及
microsoft/cream
pytorch
GitHub 中提及
基准测试
| 基准 | 方法 | 指标 |
|---|---|---|
| fine-grained-image-classification-on-oxford | AutoFormer-S | 384 | Top 1 Accuracy: 98.8 |
| fine-grained-image-classification-on-oxford-1 | AutoFormer-S | 384 | Accuracy: 94.9% |
| fine-grained-image-classification-on-stanford | AutoFormer-S | 384 | Accuracy: 93.4% |
| image-classification-on-cifar-10 | AutoFormer-S | 384 | Percentage correct: 99.1 |
| image-classification-on-imagenet | AutoFormer-small | GFLOPs: 5.1 Number of params: 22.9M Top 1 Accuracy: 81.7% |
| image-classification-on-imagenet | AutoFormer-tiny | GFLOPs: 1.3 Number of params: 5.7M Top 1 Accuracy: 74.7% |
| image-classification-on-imagenet | AutoFormer-base | GFLOPs: 11 Number of params: 54M Top 1 Accuracy: 82.4% |