Not All Patches are What You Need: Expediting Vision Transformers via Token Reorganizations

安全性令牌 计算机科学 推论 变压器 计算 人工智能 图像(数学) 杠杆(统计) 模式识别(心理学) 机器学习 算法 计算机安全 量子力学 物理 电压
作者
Youwei Liang,Chongjian Ge,Zhan Tong,Yibing Song,Jue Wang,Pengtao Xie
出处
期刊:Cornell University - arXiv [Cornell University]
被引量:639
标识
DOI:10.48550/arxiv.2202.07800
摘要

Vision Transformers (ViTs) take all the image patches as tokens and construct multi-head self-attention (MHSA) among them. Complete leverage of these image tokens brings redundant computations since not all the tokens are attentive in MHSA. Examples include that tokens containing semantically meaningless or distractive image backgrounds do not positively contribute to the ViT predictions. In this work, we propose to reorganize image tokens during the feed-forward process of ViT models, which is integrated into ViT during training. For each forward inference, we identify the attentive image tokens between MHSA and FFN (i.e., feed-forward network) modules, which is guided by the corresponding class token attention. Then, we reorganize image tokens by preserving attentive image tokens and fusing inattentive ones to expedite subsequent MHSA and FFN computations. To this end, our method EViT improves ViTs from two perspectives. First, under the same amount of input image tokens, our method reduces MHSA and FFN computation for efficient inference. For instance, the inference speed of DeiT-S is increased by 50% while its recognition accuracy is decreased by only 0.3% for ImageNet classification. Second, by maintaining the same computational cost, our method empowers ViTs to take more image tokens as input for recognition accuracy improvement, where the image tokens are from higher resolution images. An example is that we improve the recognition accuracy of DeiT-S by 1% for ImageNet classification at the same computational cost of a vanilla DeiT-S. Meanwhile, our method does not introduce more parameters to ViTs. Experiments on the standard benchmarks show the effectiveness of our method. The code is available at https://github.com/youweiliang/evit
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
刚刚
TammKY完成签到,获得积分10
1秒前
tomatoGG发布了新的文献求助10
1秒前
星辰大海的应助被娃娃鱼采纳,获得10
2秒前
pinst7完成签到,获得积分10
2秒前
zwy109完成签到 ,获得积分10
3秒前
hachimeki完成签到,获得积分10
3秒前
4秒前
4秒前
5秒前
Ning完成签到,获得积分10
7秒前
66完成签到,获得积分10
7秒前
cc发布了新的文献求助10
7秒前
cc完成签到 ,获得积分10
7秒前
飞云戏楚水完成签到,获得积分10
8秒前
pluto的应助被zjl采纳,获得10
8秒前
ximixigua完成签到,获得积分10
8秒前
田様的应助被sh采纳,获得10
8秒前
学不会完成签到 ,获得积分10
9秒前
慕青的应助被天天快砳采纳,获得10
9秒前
充电宝的应助被致远采纳,获得10
10秒前
10秒前
李健的粉丝团团长的应助被zy采纳,获得50
10秒前
Yan完成签到 ,获得积分10
10秒前
无极微光的应助被迷茫的水母采纳,获得20
10秒前
10秒前
bkagyin的应助被一棵树莓采纳,获得10
11秒前
Eve完成签到,获得积分10
11秒前
小肥侠发布了新的文献求助10
11秒前
米亚宽完成签到,获得积分10
11秒前
粥粥完成签到,获得积分20
11秒前
13秒前
啊啊啊完成签到,获得积分10
13秒前
没名字完成签到 ,获得积分10
15秒前
15秒前
15秒前
香蕉觅云的应助被shiyue采纳,获得10
15秒前
Sakura完成签到,获得积分10
16秒前
lejunia发布了新的文献求助10
16秒前
Eve发布了新的文献求助10
17秒前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
拉伸高分子熔体中缠结行为的模拟和小角中子散射研究 2000
Handbook of Sport Coaching Research 1000
The Oxford Handbook of the Bible and Animals 510
Orthognathic Surgery - 2 Volume Set 500
高分子基功能界面水蒸发材料与应用研究 500
外场增强的水汽发电研究 500
热门求助领域 (近24小时)
化学 材料科学 医学 生物 纳米技术 计算机科学 工程类 有机化学 化学工程 生物化学 物理 复合材料 内科学 催化作用 光电子学 人工智能 细胞生物学 无机化学 物理化学 数学
热门帖子
关注 科研通微信公众号,转发送积分 8196650
求助须知:如何正确求助?哪些是违规求助? 9582379
关于积分的说明 21883002
捐赠科研通 7797706
什么是DOI,文献DOI怎么找? 3438390
关于科研通互助平台的介绍 2561691
邀请新用户注册赠送积分活动 2485311