[論文レビュー] Not All Images are Worth 16x16 Words: Dynamic Transformers for Efficient Image Recognition
本論文は Dynamic Vision Transformer (DVT) を導入し、入力ごとにトークン数を適応的に選択するため、カスケード型のトランスフォーマーと早期終了を組み合わせ、さらに特徴と自己注意の関係性の再利用により、精度を犠牲にすることなく効率を改善する。
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.
研究の動機と目的
- 容易な画像で固定トークンの ViT が計算を浪費することを示し、効率的な画像認識を動機付ける。
- 入力ごとに適応して精度と効率のバランスを取る動的トークン構成フレームワークを提案する。
- 冗長な計算を削減するための特徴と自己注意の関係性の再利用メカニズムを開発する。
- 標準的なベンチマークとバックボーン全体で実証的な効率と精度の向上を示す。
提案手法
- トークン数を増やす形でカスケード型に複数の Transformer を適用する(例: 7x7, 10x10, 14x14)。
- 早期終了: 予測の信頼度が学習済み閾値を超えたときに推論を停止する。
- すべての出口からの交差エントロピー損失を合計する共通の目的で学習する。
- 特徴の再利用: 上流の最終特徴からの文脈埋め込みを下流の MLP に注入する。
- 関係性の再利用: 上流の自己注意ロジットを転送・適応させて下流の注意マップを精緻化する (A_l + r_l(A_up))。
- ボトルネックの前方伝播を適応させ、精度を維持しつつオンラインで調整可能な FLOPs を実現する。
実験結果
リサーチクエスチョン
- RQ1標準ベンチマークで、入力ごとのトークン予算化は精度を犠牲にすることなく ViT の効率を改善できるか?
- RQ2カスケード型トランスフォーマー間で特徴と注意機構を再利用して冗長な計算を回避するにはどうすればよいか?
- RQ3適応的なトークン数と早期終了が実世界の推論速度と FLOPs に与える影響は?
- RQ4異なるバックボーン(例: T2T-ViT, DeiT)とデータセット(ImageNet, CIFAR-10/100)に対して DVT のバリアントはどう機能するか?
主な発見
- DVT は ImageNet でバックボーンの計算コストを一貫して削減し、精度を維持または向上させる。
- ImageNet では、DVT は従来のバックボーンと比較して同等の精度に対してはるかに少ない FLOPs でより高い精度を達成する(例えば、同等の精度に対して最大で 3.6x 少ない FLOPs)。
- 2 つの再利用機構(特徴再利用と関係性再利用)は、わずかな追加計算で出口の精度を大幅に向上させる。
- DVT は GPU で実用的なスピードアップをもたらし(例: スループットの向上と実際の推論速度)、類似 FLOPs でいくつかの最先端の効率化手法を上回る。
- アブレーションにより、両方の再利用機構が性能に寄与し、併用すると累積的な向上が得られる。
より良い研究を、今すぐ始めましょう
論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。