(배경)
NLP tasks의 sequence-to-sequence modeling은 big leap forward를 이끌었다.
The greate success of transformers 덕분에
vision community에서도 dominant CNN based architectures such as ResNet and EfficientNet에 비해
transformers가 strong competitor가 될 수 있는지에 대한 부분적인 관심이 sparked되었다.
Vision Transformer (ViT)는 첫 convolution-free transformers로,
a sequence of embedded image patches를 input으로 하여 standard transformer에 입력되었다.
하지만, ViT는 ImageNet21K and JFT300M과 같이 very large datasets을 필요로 한다.
다음으로, DeiT는 data augmentation과 model regularization이 high-performance ViT models을 fewer data로 학습가능하게 했다.
그 이후로, ViT는 다른 측면으로 [ReFs...] its efficiency and effectiveness를 발전시키기 위한 several attempts가 시작되었다.
(동기 & 제안)
본 연구는 stronger vision transformers를 만드는 연구의 동일 선상으로,
우리는 how to learn multi-scale feature representations in transformer models for image recognition을 연구한다.
Multi-scale feature representations은 many vision tasks에서 유익하다고 증명되어 왔다.
하지만 vision transformers에서의 potential benefit은 아직 증명되지는 않았다.
Big-LittleNet and Octave convolutions과 같은 multi-branch CNN architectures의 effectiveness에 motivated되어,
우리는 image classification을 위해 stronger visual features를 만들어내는 서로 다른 sizes의 image patches를 결합하는 a dual branch transformer를 제안한다.
Our approach는 small and large patch tokens을 갖고 있어, 서로 다른 computational complexities를 갖는 two separate branches를 만들고,
이 tokens들은 서로 보완하기 위해 multiple times (몇 번) fusion된다.
Our main focus of this work는 vision transformers에 적합한 feature fusion methods를 개발하는 것으로, 이는 우리가 아는 한 아직 다뤄진 바가 없다.
이를 위해 우리는 efficient cross-attention module을 제안한다.
이 module에서는 각 transformer branch가 non-patch token을 agent로 생성하여, attention을 통해 다른 branch와 information을 exchange한다.
이러한 방식은 일반적으로 quadratic time이 소요되는 attention map 생성을 linear time으로 할 수 있게 한다.
또한 각 branch의 computational loads를 적절히 조절한 결과, our proposed approach는 DeiT 보다 FLOPs와 model parameters의 소폭 증가에도 불구하고 성능이 2% 이상 향상되었다.
The main contributinos of our work are as follows:
이 연구에서 하고자 하는 것:
vision transformer에서 더 나은 image recognition을 위해, multi-scale feature representation을 사용한다.
그래서 서로 다른 scale의 두 feature(branch) 사이의 token fusion scheme based on efficient cross-attention을 도입하였다.
몇 연구에서는 its complexity로 인해 attention scope를 local region으로 제한함.
LambdaNet [2]은 최근에 both content and position-based interactions에 대한 an efficient global attention을 제공했다.
이 연구는 앞선 mix convolution with self-attention과 반대로,
built on top of pure self-attention network like vision Transformer로 만들어졌다.
(왜 굳이? mix convolution with self-attention가 pure self-attention network보다 더 좋으면, pure self-attention network를 고집해서 만드는게 불필요하지 않나?
기존 연구에 대한 문제를 해결하기 위한 제안은 아닌듯함.)
ViT는 먼저 an image를 a certain patch size로 잘라서 a sequence of patch tokens을 만들어낸다.
그 다음 each patch에 linearly projecting해서 tokens으로 만든다.
original BERT에서 했던 것처럼, the sequence에 additional classification token (CLS)를 추가한다.
또한, transformer encoder의 self-attention은 position-agnostic하고 vision applications은 position information이 매우 필요로 하기 때문에 each token에 position embedding을 추가한다.
이후, 모든 tokens들은 stacked transformer encoders를 통과하고, 최종적으로 classification을 위해서 CLS token이 사용된다.
A transformer encoder는 feed-forward network (FFN)를 포함한 multiheaded self-attention (MSA)로 구성된 each block의 sequence로 구성되어 있다.
FFN은 two-layer multilayer perceptron with expanding ratio at the hidden layer를 포함하고,
one GELU non-linearity가 the first linear layer 이후에 적용된다.
Layer normalization (LN)과 residual shortcuts은 every block 이후에 적용된다.
The input of ViT, 는 -th block의 processing에서 다음과 같이 표현된다 :
ViT와 CNN의 one very different deisgn은 CLS token이라는 점을 주목해야 한다.
CNN에서는 일반적으로 모든 spatial locations의 features들을 averaging함으로써 finaly embedding을 얻는 반면,
ViT는 각 transformer encoder에서 patch tokens들과 interacts하는 CLS token을 final emedding으로 사용한다.
따라서 우리는 CLS를 모든 patch tokens을 summarize하는 agent로 간주하며,
이에 따라 the proposed module은 a dual-path multi-scale ViT를 만들기 위해 CLS를 기반으로 설계되었다.
Figure 2는 our proposed Cross-Attention Multi-Scale Vision Transformer (CrossViT)의 network architecture를 설명한다.
Our model은 two branches(1. L-Branch, 2. S-Branch)로 구성된 개의 multi-scale transformer encoders로 구성된다.
(1) L-Branch는 a large (primary) branch로, more transformer encoders와 wider embedding dimensions을 사용하며, coarse-graind patch size ()을 활용한다.
(2) S-Branch는 a small (complementary) branch로, fewer transformer encoders and smaller embedding dimensions을 사용하며,
fine-grained patch size ()을 활용한다.
이 두 branch는 총 번에 걸쳐 fusion되며, 마지막에는 두 branch의 CLS token이 prediction에 사용된다.
또한 ViT와 마찬가지로, 각 branch의 모든 token에는 multi-scale transformer encoder에 입력되기 전에 position information을 학습하기 위해 learnable position embedding이 추가된다.
Effective feature fusion은 multi-scale feature representations 학습의 key이다.
우리는 four different fusion strategies에 대해서 탐구하였다:
three simple heuristic approaches and the proposed cross-attention module as shown in Figure 3.
(구체적인 ours 설명)
내가 이해한 핵심 :
아래 Figure 4는 Large branch에 대해서 적용한 그림이고, 마찬가지로 Small branch에서도 동일한 연산이 진행됨.
각 branch들의 CLS token은 상대 branch로 가서 정보를 취득해 오는 agent 역할이고,
가서 상대 branch에 대한 정보를 학습한 것을 원래 자신의 branch로 복귀하여 자신의 patch tokens들에게 배운 것을 전파함.