
摘要
近年来,将Transformer与卷积神经网络设计相结合的架构取得了持续的精度与效率提升。在本工作中,我们提出FastViT——一种新型混合视觉Transformer架构,能够在延迟与精度之间实现当前最优的权衡。为此,我们引入了一种新颖的令牌混合操作算子RepMixer,作为FastViT的核心构建模块。该算子通过结构重参数化(structural reparameterization)技术,移除了网络中的跳跃连接(skip-connections),从而显著降低了内存访问开销。此外,我们采用训练阶段的过参数化(train-time overparametrization)以及大核卷积(large kernel convolutions)策略以进一步提升模型精度,并通过实验证明这些设计对推理延迟的影响微乎其微。实验结果表明:在相同ImageNet精度下,我们的模型在移动设备上的推理速度分别比近期先进的混合Transformer架构CMT快3.5倍,比EfficientNet快4.9倍,比ConvNeXt快1.9倍;在相近延迟水平下,其在ImageNet上的Top-1准确率比MobileOne高出4.2%。我们的模型在多个任务上均显著优于现有架构,包括图像分类、目标检测、语义分割以及3D网格回归任务,在移动设备和桌面GPU上均展现出显著的延迟优势。此外,该模型对分布外样本(out-of-distribution samples)和数据扰动(corruptions)表现出极强的鲁棒性,优于现有各类鲁棒性模型。相关代码与预训练模型已开源,详见:https://github.com/apple/ml-fastvit。
代码仓库
apple/ml-fastvit
官方
pytorch
GitHub 中提及
rwightman/pytorch-image-models
官方
pytorch
GitHub 中提及
balala8/FastViT_pytorch
pytorch
GitHub 中提及
基准测试
| 基准 | 方法 | 指标 |
|---|---|---|
| 3d-hand-pose-estimation-on-freihand | FastViT-MA36 | PA-F@15mm: 0.981 PA-F@5mm: 0.722 PA-MPJPE: 6.6 PA-MPVPE: 6.7 |
| image-classification-on-imagenet | FastViT-SA24 | Top 1 Accuracy: 82.6% |
| image-classification-on-imagenet | FastViT-MA36 | Top 1 Accuracy: 84.9% |
| image-classification-on-imagenet | FastViT-SA12 | Top 1 Accuracy: 80.6% |
| image-classification-on-imagenet | FastViT-S12 | Top 1 Accuracy: 79.8% |
| image-classification-on-imagenet | FastViT-SA36 | Top 1 Accuracy: 84.5% |
| image-classification-on-imagenet | FastViT-T12 | Top 1 Accuracy: 79.1% |
| image-classification-on-imagenet | FastViT-T8 | Top 1 Accuracy: 75.6% |
| semantic-segmentation-on-ade20k | FastViT-SA36 | Mean IoU (class): 42.9 |
| semantic-segmentation-on-ade20k | FastViT-SA12 | Mean IoU (class): 38 |
| semantic-segmentation-on-ade20k | FastViT-SA24 | Mean IoU (class): 41 |
| semantic-segmentation-on-ade20k | FastViT-MA36 | Mean IoU (class): 44.6 |