Not All Images are Worth 16x16 Words: Dynamic Transformers for Efficient Image Recognition
Yulin Wang, Rui Huang, Shiji Song, Zeyi Huang, Gao Huang
摘要
Vision Transformers (ViT) have achieved remarkable success in large-scale image recognition. They split every 2D image into a fixed number of patches, each of which is treated as a token. Generally, representing an image with more tokens would lead to higher prediction accuracy, while it also results in drastically increased computational cost. To achieve a decent trade-off between accuracy and speed, the number of tokens is empirically set to 16x16 or 14x14. In this paper, we argue that every image has its own characteristics, and ideally the token number should be conditioned on each individual input. In fact, we have observed that there exist a considerable number of "easy" images which can be accurately predicted with a mere number of 4x4 tokens, while only a small fraction of "hard" ones need a finer representation. Inspired by this phenomenon, we propose a Dynamic Transformer to automatically configure a proper number of tokens for each input image. This is achieved by cascading multiple Transformers with increasing numbers of tokens, which are sequentially activated in an adaptive fashion at test time, i.e., the inference is terminated once a sufficiently confident prediction is produced. We further design efficient feature reuse and relationship reuse mechanisms across different components of the Dynamic Transformer to reduce redundant computations. Extensive empirical results on ImageNet, CIFAR-10, and CIFAR-100 demonstrate that our method significantly outperforms the competitive baselines in terms of both theoretical computational efficiency and practical inference speed. Code and pre-trained models (based on PyTorch and MindSpore) are available at https://github.com/ blackfeather-wang/Dynamic-Vision-Transformer and https://github. com/blackfeather-wang/Dynamic-Vision-Transformer-MindSpore .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 60 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Rank-DETR for High Quality Object Detection 引用了 Adaptive Rotated Convolution for Rotated Object Detection
- FLatten Transformer: Vision Transformer using Focused Linear Attention 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- FLatten Transformer: Vision Transformer using Focused Linear Attention 引用了 Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- FLatten Transformer: Vision Transformer using Focused Linear Attention 引用了 Training data-efficient image transformers & distillation through attention
- FLatten Transformer: Vision Transformer using Focused Linear Attention 引用了 Adaptive Rotated Convolution for Rotated Object Detection
- FLatten Transformer: Vision Transformer using Focused Linear Attention 引用了 Vision Transformer with Deformable Attention
- DeeR-VLA: Dynamic Inference of Multimodal Large Language Models for Efficient Robot Execution 引用了 FLatten Transformer: Vision Transformer using Focused Linear Attention
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale 引用了 Language Models are Few-Shot Learners
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 引用了 Training data-efficient image transformers & distillation through attention
- Training data-efficient image transformers & distillation through attention 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Adaptive Rotated Convolution for Rotated Object Detection 引用了 Vision Transformer with Deformable Attention
- Vision Transformer with Deformable Attention 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Vision Transformer with Deformable Attention 引用了 Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Vision Transformer with Deformable Attention 引用了 Training data-efficient image transformers & distillation through attention
引用它的顶会 Paper60
- Vision Transformer with Deformable AttentionZhuofan Xia, Xuran Pan, Shiji Song, Li Erran Li 等CVPR 2022 · 835 次引用
- FLatten Transformer: Vision Transformer using Focused Linear AttentionDongchen Han, Xuran Pan, Yizeng Han, Shiji Song 等ICCV 2023 · 358 次引用
- Adaptive Rotated Convolution for Rotated Object DetectionYifan Pu, Yiru Wang, Zhuofan Xia, Yizeng Han 等ICCV 2023 · 154 次引用
- DeeR-VLA: Dynamic Inference of Multimodal Large Language Models for Efficient Robot ExecutionYang Yue, Yulin Wang, Bingyi Kang, Yizeng Han 等NeurIPS 2024 · 153 次引用
- Rank-DETR for High Quality Object DetectionYifan Pu, Weicong Liang, Yiduo Hao, Yuhui Yuan 等NeurIPS 2023 · 138 次引用
它引用的 Paper28
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu 等ICCV 2021 · 31,683 次引用
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
- Searching for MobileNetV3Andrew Howard, Ruoming Pang, Hartwig Adam, Quoc V. Le 等ICCV 2019 · 9,163 次引用
- Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa 等ICML 2021 · 8,974 次引用
相关 Paper
- EViT: Expediting Vision Transformers via Token ReorganizationsYouwei Liang, Chongjian Ge, Zhan Tong, Yibing Song 等ICLR 2022 · 137 次引用
- DynamicViT: Efficient Vision Transformers with Dynamic Token SparsificationYongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu 等NeurIPS 2021 · 1,343 次引用
- CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image ClassificationChun-Fu (Richard) Chen, Quanfu Fan, Rameswar PandaICCV 2021 · 2,072 次引用
- A-ViT: Adaptive Tokens for Efficient Vision TransformerHongxu Yin, Arash Vahdat, José M. Álvarez, Arun Mallya 等CVPR 2022 · 288 次引用
- ImagePiece: Content-aware Re-tokenization for Efficient Image RecognitionSeungdong Yoa, Seungjun Lee, Hye-Seung Cho, Bumsoo Kim 等AAAI 2025 · 1 次引用
