Skip to main content
QUICK REVIEW

[논문 리뷰] Not All Images are Worth 16x16 Words: Dynamic Transformers for Efficient Image Recognition

Yulin Wang, Rui Huang|arXiv (Cornell University)|2021. 05. 31.
Advanced Neural Network Applications인용 수 70
한 줄 요약

본 논문은 Dynamic Vision Transformer(DVT)를 소개한다. DVT는 계단식 트랜스포머와 조기 종료를 활용해 입력당 토큰 수를 적응적으로 선택하고, 특징 재활용 및 관계 재사용을 통해 정확도를 해치지 않으면서 효율성을 향상시킨다.

ABSTRACT

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가 계산을 낭비한다는 사실을 보여 효율적인 이미지 인식을 고무한다.
  • 입력마다 적응하여 정확도와 효율성의 균형을 맞추는 동적 토큰 구성 프레임워크를 제안한다.
  • 중복 계산을 줄이기 위해 특징 재사용 및 자기 주의 관계 재사용 메커니즘을 개발한다.
  • 표준 벤치마크와 백본 전반에서 실증적 효율성 및 정확도 향상을 입증한다.

제안 방법

  • 토큰 수가 증가하는 다중 트랜스포머를 계단식으로 연결한다(예: 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는 일반(backbone) 대비 유의하게 더 적은 FLOPs로 더 높은 정확도를 달성한다(유사 정확도에 대해 최대 약 3.6배의 FLOPs 감소 등).
  • 두 가지 재사용 메커니즘(특징 재사용 및 관계 재사용)은 약간의 추가 계산으로 종료 정확도를 크게 향상시킨다.
  • DVT는 GPU에서 실용적인 속도 향상을 제공(처리량 증가 및 실제 추론 속도)하고 비슷한 FLOPs에서 여려 최첨단 효율 방법들을 능가한다.
  • 제거 연구는 두 재사용 메커니즘 모두 성능에 기여하며 함께 사용할 때 누적 이점을 보인다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.