timm documentation
SwiftFormer
快速入门
教程
模型页面
模型系列结果
卷积网络
视觉 Transformer
混合卷积 / 注意力网络
高效与移动网络
CPUBoneEdgeNeXtEfficientFormerEfficientFormer-V2EfficientNetEfficientViMEfficientViT(MIT)EfficientViT(MSRA)FasterNetFastViTGhostNetHardCoRe-NASiFormerLowFormerMobileNet-V3MobileViTPP-LCNetV2RepGhostRepViTReXNetSHViTStarNetSwiftFormer
MLP 及其他 token 混合器
多模态模型的视觉编码器
参考
SwiftFormer
类别: Efficient/Mobile · 代码: timm/models/swiftformer.py · 架构: 4 · 预训练权重: 4(4 个具有 ImageNet-1k 结果)
SwiftFormer 将自注意力中的二次矩阵乘法替换为高效的加法注意力,适用于实时移动视觉应用。
论文
用法
请参阅快速入门了解如何加载预训练权重、进行图像预处理和微调,以及查阅特征提取了解如何将模型用作骨干网络。
>>> import timm
>>> model = timm.create_model('swiftformer_l3.dist_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)模型 API 支持
✓ 支持,✓ (square) 仅支持方形尺寸,✗ 不支持,– 无需支持(该模型本身已接受任意输入尺寸)。通过在每个功能上运行随机初始化的模型(SwiftFormer 使用 swiftformer_xs,尺寸为 224)进行验证,预期同一类的其他架构表现相同。有关详细信息,请参阅 Model API 页面。
架构
| 架构 | 参数(M) | GMAC | 输入大小 | 预训练权重 |
|---|---|---|---|---|
swiftformer_l1 | 12.06 | 1.60 | 224 | 1 |
swiftformer_l3 | 28.49 | 4.01 | 224 | 1 |
swiftformer_s | 6.09 | 0.99 | 224 | 1 |
swiftformer_xs | 3.48 | 0.61 | 224 | 1 |
GMACs 和参数量对应于每种架构的默认输入大小和分类器,数据来自基准测试结果。
预训练权重
Top-1 是 results-imagenet.csv 中在所列评估规模下的 ImageNet-1k 验证准确率,- 表示该权重没有 ImageNet-1k 结果(例如预训练权重或图文权重)。Classes 是预训练分类器的大小,对于没有分类器的权重则为 none。
| 权重 | 输入大小 | Top-1(%) | 评估大小 | 类 | 许可证 | Hub |
|---|---|---|---|---|---|---|
swiftformer_l1.dist_in1k | 224 | 80.906 | 224 | 1000 | apache-2.0 | timm |
swiftformer_l3.dist_in1k | 224 | 82.994 | 224 | 1000 | apache-2.0 | timm |
swiftformer_s.dist_in1k | 224 | 78.462 | 224 | 1000 | apache-2.0 | timm |
swiftformer_xs.dist_in1k | 224 | 75.600 | 224 | 1000 | apache-2.0 | timm |
引用
@InProceedings{Shaker_2023_ICCV,
author = {Shaker, Abdelrahman and Maaz, Muhammad and Rasheed, Hanoona and Khan, Salman and Yang, Ming-Hsuan and Khan, Fahad Shahbaz},
title = {SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications},
booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
year = {2023},
}