paper-with-me

Papers

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

2022-02-16 · Youwei Liang, Chongjian Ge, Zhan Tong, Yibing Song, Jue Wang, Pengtao Xie

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

📄 PDF Abstract BibTeX arXiv:2202.07800

Code (2)

youweiliang/evit 공식 구현 pytorch
shiming-chen/zslvit pytorch

Tasks

AllEfficient ViTs

Methods 이 논문이 사용한 방법론

SPEED The monocular depth estimation (MDE) is the task of estimating depth from a single frame. This information is an essential knowledge in many computer vision tasks such as scene…

Similar Papers 제목 키워드 기반

AdaViT: Adaptive Vision Transformers for Efficient Image Recognition

2021-11-30 · CVPR 2022 1 · Lingchen Meng, Hengduo Li, Bor-Chun Chen, Shiyi Lan 외

Built on top of self-attention mechanisms, vision transformers have demonstrated remarkable performance on a variety of vision tasks recently. While achieving excellent performance, they still require relatively intensiv…

Are Vision Transformers Robust to Patch-wise Perturbations?

2021-09-29 · Jindong Gu, Volker Tresp, Yao Qin

The recent advances in Vision Transformer (ViT) have demonstrated its impressive performance in image classification, which makes it a promising alternative to Convolutional Neural Network (CNN). Unlike CNNs, ViT represe…

image-classificationImage Classification

How Does Attention Work in Vision Transformers? A Visual Analytics Attempt

2023-03-24 · Yiran Li, Junpeng Wang, Xin Dai, Liang Wang 외

Vision transformer (ViT) expands the success of transformer models from sequential data to images. The model decomposes an image into many smaller patches and arranges them into a sequence. Multi-head self-attentions are…

BOAT: Bilateral Local Attention Vision Transformer

2022-01-31 · Tan Yu, Gangming Zhao, Ping Li, Yizhou Yu

Vision Transformers achieved outstanding performance in many computer vision tasks. Early Vision Transformers such as ViT and DeiT adopt global self-attention, which is computationally expensive when the number of patche…

Random Position Adversarial Patch for Vision Transformers

2023-07-09 · Mingzhen Shao

Previous studies have shown the vulnerability of vision transformers to adversarial patches, but these studies all rely on a critical assumption: the attack patches must be perfectly aligned with the patches used for lin…

Position