4 个月前

训练数据高效的图像变换器及通过注意力机制进行蒸馏

训练数据高效的图像变换器及通过注意力机制进行蒸馏

摘要

最近,纯基于注意力机制的神经网络在图像理解任务(如图像分类)中展现出了良好的效果。然而,这些视觉变压器通常需要使用昂贵的基础设施进行数亿张图像的预训练,这限制了它们的应用范围。在这项工作中,我们仅通过在ImageNet上训练,生成了一个具有竞争力且无卷积操作的变压器模型。我们使用单台计算机在不到3天的时间内完成了训练。我们的基准视觉变压器(8600万个参数)在ImageNet上实现了83.1%的单裁剪评估准确率,而未使用任何外部数据。更重要的是,我们引入了一种专为变压器设计的教师-学生策略。该策略依赖于一个蒸馏令牌(distillation token),确保学生模型通过注意力机制从教师模型中学习。我们展示了这种基于令牌的蒸馏方法的优势,特别是在使用卷积神经网络作为教师模型时。这使得我们在ImageNet上获得了与卷积神经网络相当的结果(最高达到85.2%的准确率),并且在迁移到其他任务时也表现出色。我们已共享了代码和模型。

代码仓库

omihub777/vit-cifar
pytorch
GitHub 中提及
gatech-eic/vitcod
pytorch
GitHub 中提及
liuxingwt/CLS
pytorch
GitHub 中提及
rwightman/pytorch-image-models
pytorch
GitHub 中提及
zhuhanqing/lightening-transformer
pytorch
GitHub 中提及
smu-ivpl/DeepfakeDetection
pytorch
GitHub 中提及
ttt496/vit-pytorch
pytorch
GitHub 中提及
aiot-mlsys-lab/famba-v
pytorch
GitHub 中提及
TACJu/TransFG
pytorch
GitHub 中提及
skchen1993/TrangFG
pytorch
GitHub 中提及
facebookresearch/deit
官方
pytorch
GitHub 中提及
IMvision12/keras-vision-models
pytorch
GitHub 中提及
asrafulashiq/deit-custom
pytorch
GitHub 中提及
huggingface/transformers
pytorch
GitHub 中提及
jacobgil/vit-explain
pytorch
GitHub 中提及
nus-hpc-ai-lab/dyvm
pytorch
GitHub 中提及
holdfire/CLS
pytorch
GitHub 中提及
s-chh/patchrot
pytorch
GitHub 中提及
alessiomora/unlearning_fl
tf
GitHub 中提及
moein-shariatnia/Pix2Seq
pytorch
GitHub 中提及
open-edge-platform/geti
pytorch
GitHub 中提及
affjljoo3581/deit3-jax
jax
GitHub 中提及
ahmedelmahy/myownvit
pytorch
GitHub 中提及
holdfire/FAS
pytorch
GitHub 中提及
tianhai123/vit-pytorch
pytorch
GitHub 中提及
hustvl/vim
pytorch
GitHub 中提及

基准测试

基准方法指标
document-image-classification-on-rvl-cdipDeiT-B
Accuracy: 90.32%
Parameters: 87M
document-layout-analysis-on-publaynet-valDeiT-B
Figure: 0.957
List: 0.921
Overall: 0.932
Table: 0.972
Text: 0.934
Title: 0.874
efficient-vits-on-imagenet-1k-with-deit-sBase (DeiT-S)
GFLOPs: 4.6
Top 1 Accuracy: 79.8
efficient-vits-on-imagenet-1k-with-deit-tBase (DeiT-T)
GFLOPs: 1.2
Top 1 Accuracy: 72.2
fine-grained-image-classification-on-oxfordDeiT-B
Accuracy: 98.8%
PARAMS: 86M
fine-grained-image-classification-on-stanfordDeiT-B
Accuracy: 93.3%
PARAMS: 86M
image-classification-on-cifar-10DeiT-B
Percentage correct: 99.1
image-classification-on-cifar-100DeiT-B
PARAMS: 86M
Percentage correct: 90.8
image-classification-on-flowers-102DeiT-B
Accuracy: 98.8%
PARAMS: 86M
image-classification-on-imagenetDeiT-B
Number of params: 86M
Top 1 Accuracy: 84.2%
image-classification-on-imagenetDeiT-B 384
Hardware Burden:
Number of params: 87M
Operations per network pass:
Top 1 Accuracy: 85.2%
image-classification-on-imagenetDeiT-B
Number of params: 5M
Top 1 Accuracy: 76.6%
image-classification-on-imagenetDeiT-B
Number of params: 22M
Top 1 Accuracy: 82.6%
image-classification-on-imagenet-realDeiT-Ti
Accuracy: 82.1%
Params: 5M
image-classification-on-imagenet-realDeiT-B
Accuracy: 88.7%
Params: 86M
image-classification-on-imagenet-realDeiT-S
Accuracy: 86.8%
Params: 22M
image-classification-on-imagenet-realDeiT-B-384
Accuracy: 89.3%
Params: 86M
image-classification-on-inaturalist-2018DeiT-B
Top-1 Accuracy: 79.5%

用 AI 构建 AI

从想法到上线——通过免费 AI 协同编程、开箱即用的环境和市场最优价格的 GPU 加速您的 AI 开发

AI 协同编程
即用型 GPU
最优价格
立即开始

Hyper Newsletters

订阅我们的最新资讯
我们会在北京时间 每周一的上午九点 向您的邮箱投递本周内的最新更新
邮件发送服务由 MailChimp 提供
训练数据高效的图像变换器及通过注意力机制进行蒸馏 | 论文 | HyperAI超神经