# Vicinity Vision Transformer

근접 비전 트랜스포머

Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang 외 4명 · arXiv · 2022년 6월 21일

- **연구 문제** 비전 트랜스포머의 softmax 어텐션은 고해상도 이미지에서 계산량과 메모리가 커지며, 기존 선형 어텐션은 비전의 2D 지역성을 고려하지 않아 성능이 떨어집니다.
- **연구 방법** ReLU 커널과 2D Manhattan 거리 기반 코사인 재가중으로 2D 지역성을 선형 어텐션에 넣고, 특징 압축 어텐션과 FPC 스킵 연결로 특징 차원 병목을 줄입니다.
- **주요 결과** VVT는 ImageNet-1k 분류에서 VVT-L이 Top-1 84.1을 기록했고, ADE20K 분할에서 VVT-S가 mIoU 45.6을 기록했습니다. 지역성 절제에서는 2D 지역성이 CIFAR-100에서 가장 높은 정확도를 보였습니다.

## 선형 어텐션의 2D 지역성 문제

비전 트랜스포머의 softmax 어텐션은 시퀀스 길이 N에 대해 계산량과 메모리가 이차적으로 증가합니다. 이 때문에 고해상도 이미지를 처리하기 어렵습니다. 선형 어텐션은 softmax를 분해 가능한 유사도 함수로 바꾸어 계산 순서를 재배열함으로써 복잡도를 선형으로 줄이는 방법입니다. 그러나 기존 선형 어텐션은 주로 NLP에서 검증되었고, 비전에서는 성능 저하가 보고되었습니다. 저자들은 기존 선형 어텐션이 비전의 귀납적 편향인 2D 지역성을 고려하지 않는다고 지적합니다. 이 논문은 이 공백을 선형 복잡도 안에서 메우는 것을 목표로 합니다.

## Vicinity Attention의 계산 구조

Vicinity Attention은 softmax 대신 ReLU를 커널 함수로 사용하고 행 단위 정규화를 적용합니다. 이렇게 하면 어텐션을 ReLU(Q)와 ReLU(K)의 곱으로 재배열할 수 있어 계산이 선형으로 줄어듭니다. 2D 지역성은 패치의 행 방향과 열 방향 위치 차이의 절댓값 합인 2D Manhattan 거리로 정의합니다. 절댓값은 분해가 어렵기 때문에 코사인 함수를 사용하여 절댓값 연산을 없애고, 위치 항을 i와 j에 대해 분리되는 cos 및 sin 항으로 바꿉니다. 이 분해를 통해 Q′와 K′를 만들고 선형 순서로 계산합니다. 이 방식은 이웃 패치를 더 강하게 연결하면서도 전체 공간에 대한 전역 수용영역을 유지합니다.

![Figure 3: Visualization of the locality re-weighting patterns. The red cross symbol denotes the query position and the mask denotes the locality weights to it.…](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-b973c2e9725d2d7bf5fc22158de8e212.png?thumb=512)

**Fig. 3** : Visualization of the locality re-weighting patterns. The red cross symbol denotes the query position and the mask denotes the locality weights to it. We use a lighter color to indicate a larger weight. (a) If we directly adopt 1D distance re-weighting \[12\] in self-attention, the query token will be assigned lower weights on vertical tokens as they are far away when processed in 1D. (b), (c), (d) In our method, although self-attention is calculated in 1D, our re-weighting mechanism ensures that a token is encouraged to have higher relation weights with its neighbours in two dimensions.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

## Vicinity Attention Block과 FPC

선형 어텐션의 복잡도는 시퀀스 길이에 선형이지만 특징 차원에 대해서는 이차적으로 증가합니다. 이를 줄이기 위해 저자들은 Vicinity Attention Block을 제안합니다. 이 블록의 FRA는 입력 특징을 절반 차원으로 줄인 공간에서 어텐션을 계산하며, 이로써 이론적 복잡도를 줄입니다. 압축으로 잃을 수 있는 정보를 보완하기 위해 FPC를 스킵 연결로 추가합니다. FPC는 평균 풀링과 두 개의 선형 층으로 이루어지며, FRA와 FPC의 출력을 잔차 방식으로 합칩니다.

![Figure 5: Overall architecture of our VVT. VVT adopts a pyramid structure and is divided into four stages. The illustrated sample is VVT-Small. The output reso…](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-112cf5e39eb261730795784ad2b43d02.png?thumb=512)

**Fig. 5** : Overall architecture of our VVT. VVT adopts a pyramid structure and is divided into four stages. The illustrated sample is VVT-Small. The output resolution progressively shrinks to generate multi-scale feature maps.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 6쪽에서 그림 영역을 추출했습니다.

![Table 9: Results of VVT on CIFAR100 using different feature reduction ratio (FR). We empirically find that the FR = 2leads to the best performance](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-ca01485f324a0c22788f79629c7297a9.png?thumb=512)

**TABLE 9** .Results of VVT on CIFAR100 using different feature reduction ratio (FR). We empirically find that the FR = 2leads to the best performance.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 11쪽에서 그림 영역을 추출했습니다.

![Table 10: Results of VVT-tiny with and without feature preserving connection(FPC) on ImageNet-1k](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-183bfb7f5613bb75c5131052ac3cb2a3.png?thumb=512)

**TABLE 10** . Results of VVT-tiny with and without feature preserving connection(FPC) on ImageNet-1k.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 11쪽에서 그림 영역을 추출했습니다.

## 분류와 분할에서의 검증

ImageNet-1k 분류에서 VVT-L은 Top-1 정확도 84.1을 기록했고, 원문은 이를 PVTv2-B5보다 적은 파라미터로 달성했다고 보고합니다. ADE20K 의미 분할에서는 Semantic FPN 설정으로 VVT-S가 mIoU 45.6을 기록했습니다. 이 결과들은 각각 해당 데이터셋과 설정에서 얻은 것이며, 다른 과제나 하드웨어로 일반화하지 않습니다.

![Figure 1: Top-1 accuracy of our Vicinity Vision Transformer (VVT) with respect to parameters on the ImageNet-1k \[16\] dataset, and the GFLOPs corresponding to v…](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-c88f89aeec4c7ba898f6874b3b1c17ec.png?thumb=512)

**Fig. 1** : Top-1 accuracy of our Vicinity Vision Transformer (VVT) with respect to parameters on the ImageNet-1k \[16\] dataset, and the GFLOPs corresponding to various input image sizes. Our VVT outperforms all competitors with 50% fewer parameters, and it enjoys the lowest GFLOPs growth rate.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 2쪽에서 그림 영역을 추출했습니다.

![Table 2: Comparison of different backbones on ImageNet1k \[54\]. For a fair comparison, we compare VVT with competing models under similar parameter sizes. All m…](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-c589ffdde6f86439b3c0bf2828dff262.png?thumb=512)

**TABLE 2** . Comparison of different backbones on ImageNet1k \[54\]. For a fair comparison, we compare VVT with competing models under similar parameter sizes. All models are trained and tested on 224 × 224 resolution. GFLOPs are also calculated under the input scale of 224 × 224. “MS out” represents multi-scale outputs.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

![Table 5: Semantic segmentation results on ADE20K \[60\] validation set. Competing results come from PVTv2 \[51\] and Twins \[33\]. All backbone networks are pre-trai…](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-4f6c928d1d7fa5c3b7c924ff31737d43.png?thumb=512)

**TABLE 5** .Semantic segmentation results on ADE20K \[60\] validation set. Competing results come from PVTv2 \[51\] and Twins \[33\]. All backbone networks are pre-trained on ImageNet-1k \[54\].

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

## 지역성 제거와 1D 지역성 비교

CIFAR-100 실험에서 2D 지역성을 적용한 VVT는 82.92의 정확도를 보였고, 지역성을 제거한 경우는 82.13이었으며 1D 지역성을 적용한 경우는 76.78이었습니다. ImageNet-1k에서는 1D 지역성을 적용한 모델이 수렴하지 않았다고 보고되며, 저자들은 이를 1D cosFormer가 2D 비전 데이터에 그대로 이식될 수 없음을 보여 주는 것으로 해석합니다. 이 비교는 같은 설정에서 지역성 방식만 바꾼 결과입니다.

![Table 6: Analysis of locality constraint on CIFAR-100 \[59\] and ImageNet-1k \[54\]](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-dd18737a02831a4a37e91d427bf95a9a.png?thumb=512)

**TABLE 6** . Analysis of locality constraint on CIFAR-100 \[59\] and ImageNet-1k \[54\].

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

![Table 7: Ablation of different attention choices. We fix the architecture to VVT-T and test different attention modules on CIFAR-100 and ImageNet-1k. cosFormer…](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-86a319d63ac7ea9448a3ece393fcea32.png?thumb=512)

**TABLE 7** . Ablation of different attention choices. We fix the architecture to VVT-T and test different attention modules on CIFAR-100 and ImageNet-1k. cosFormer fails to converge under the same setting on ImageNet1K.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 10쪽에서 그림 영역을 추출했습니다.

## 메모리와 처리 시간의 한계

메모리 측정에서 Vicinity Attention은 Performer와 Linformer보다 더 많은 메모리를 사용합니다. 저자들은 이를 두 방법이 1D 시퀀스용으로 설계되어 비전에서 성능이 낮다는 점과 연결해 설명합니다. 처리 시간은 한 대의 2080 Ti GPU에서 측정되었고, 저해상도에서는 VVT가 PVTv2 및 Swin보다 느리며 고해상도에서 더 나은 추론 속도를 보입니다.

![Table 8: Quantitative memory footprints of networks in table 7. All models have the same network structure except the attention module. All results are obtaine…](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2/figures/figure-2f24c2812bbcfe704495db360e683445.png?thumb=512)

**TABLE 8** . Quantitative memory footprints of networks in table 7. All models have the same network structure except the attention module. All results are obtained with a batch size of 16 on a GPU with 32GB VRAM.

[원문](https://arxiv.org/abs/2206.10552v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong · Vicinity Vision Transformer · 원문 그림 인용 · 원본 PDF 10쪽에서 그림 영역을 추출했습니다.

## 논문 정보

- **저자**: Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2022년 6월 21일
- **등록일**: 2026년 11월 6일
- **수정일**: 2023년 7월 20일
- **버전**: v2
- **arXiv**: 2206.10552
- **분류**: cs.CV
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2206.10552v2) · [원문 PDF ↗](https://arxiv.org/pdf/2206.10552v2)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

Vision transformers have shown great success on numerous computer vision tasks. However, its central component, softmax attention, prohibits vision transformers from scaling up to high-resolution images, due to both the computational complexity and memory footprint being quadratic. Although linear attention was introduced in natural language processing (NLP) tasks to mitigate a similar issue, directly applying existing linear attention to vision transformers may not lead to satisfactory results. We investigate this problem and find that computer vision tasks focus more on local information compared with NLP tasks. Based on this observation, we present a Vicinity Attention that introduces a locality bias to vision transformers with linear complexity. Specifically, for each image patch, we adjust its attention weight based on its 2D Manhattan distance measured by its neighbouring patches. In this case, the neighbouring patches will receive stronger attention than far-away patches. Moreover, since our Vicinity Attention requires the token length to be much larger than the feature dimension to show its efficiency advantages, we further propose a new Vicinity Vision Transformer (VVT) structure to reduce the feature dimension without degenerating the accuracy. We perform extensive experiments on the CIFAR100, ImageNet1K, and ADE20K datasets to validate the effectiveness of our method. Our method has a slower growth rate of GFlops than previous transformer-based and convolution-based networks when the input resolution increases. In particular, our approach achieves state-of-the-art image classification accuracy with 50% fewer parameters than previous methods.

## 원문 인용

Weixuan Sun, Zhen Qin, Hui Deng, Jianyuan Wang, Yi Zhang, Kaihao Zhang, Nick Barnes, Stan Birchfield, Lingpeng Kong, Yiran Zhong (2022). Vicinity Vision Transformer. arXiv:2206.10552v2. https://arxiv.org/abs/2206.10552v2

**BibTeX**

```
@misc{sun2022vicinity,
  title = {{Vicinity Vision Transformer}},
  author = {Weixuan Sun and Zhen Qin and Hui Deng and Jianyuan Wang and Yi Zhang and Kaihao Zhang and Nick Barnes and Stan Birchfield and Lingpeng Kong and Yiran Zhong},
  year = {2022},
  eprint = {2206.10552},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.10552v2}
}
```

## 이 논문의 용어

- [CIFAR-100](https://refivu.com/terms/5afa3b877d18-cifar-100)
- [mIoU](https://refivu.com/terms/901dcc5384c2-miou)
- [ImageNet-1K](https://refivu.com/terms/d8d6444bd460-imagenet-1k)
- [ADE20K](https://refivu.com/terms/5adea765479c-ade20k)
- [linear attention](https://refivu.com/terms/102ebaed8489-linear-attention)
- [kernel function](https://refivu.com/terms/5f0f4e6ffdb7-kernel-function)
- [GFLOPs](https://refivu.com/terms/6ad611ed6283-gflops)
- [Softmax attention](https://refivu.com/terms/140344948263-softmax-attention)

## 다른 논문 해설

- [Personal Privacy Protection via Irrelevant Faces Tracking and Pixelation in Video Live Streaming](https://refivu.com/papers/a305a9bb-874f-4e9c-82d7-0982d443dc1a-personal-privacy-protection-via-irrelevant-faces-tracking.md)
- [FedMix: Mixed Supervised Federated Learning for Medical Image Segmentation](https://refivu.com/papers/3a45da24-f4a5-40fb-bbaf-3eac2013b2b8-fedmix-mixed-supervised-federated-learning-for-medical-image.md)
- [GraphMamba: An Efficient Graph Structure Learning Vision Mamba for Hyperspectral Image Classification](https://refivu.com/papers/07bc27b8-112a-4c37-a2a6-1f8b8af9f0b5-graphmamba-an-efficient-graph-structure-learning-vision.md)
- [Cross-aware Early Fusion with Stage-divided Vision and Language Transformer Encoders for Referring Image Segmentation](https://refivu.com/papers/8a0d2f66-27b5-43a8-85cb-525496d2b434-cross-aware-early-fusion-with-stage-divided-vision.md)
- [Classification of Shoulder X-Ray Images with Deep Learning Ensemble Models](https://refivu.com/papers/8a08d6bc-7fca-4507-8e73-873f94dea956-classification-of-shoulder-x-ray-images-with-deep.md)
- [Contrastive Semi-supervised Learning for Domain Adaptive Segmentation Across Similar Anatomical Structures](https://refivu.com/papers/c873c612-0a68-4ecb-97aa-10fba6f07077-contrastive-semi-supervised-learning-for-domain-adaptive.md)
- [Reinforcement Learning Assisted Recursive QAOA](https://refivu.com/papers/b8017e9c-acae-49e8-8382-c786b6796b2b-reinforcement-learning-assisted-recursive-qaoa.md)
- [Using large language models to estimate features of multi-word expressions: Concreteness, valence, arousal](https://refivu.com/papers/76fd510f-cd7e-4a68-b362-5c8cca20383a-using-large-language-models-to-estimate-features-of.md)
- [Finetuning Deep Reinforcement Learning Policies with Evolutionary Strategies for Control of Underactuated Robots](https://refivu.com/papers/b76cc453-3fbc-43df-aec8-d24afd8b97c6-finetuning-deep-reinforcement-learning-policies-with.md)
- [Enhancing Digital Health Services: A Machine Learning Approach to Personalized Exercise Goal Setting](https://refivu.com/papers/41745f78-b16a-4acc-9bb0-de7c58a2ea78-enhancing-digital-health-services-a-machine-learning.md)
- [Strong and weak alignment of large language models with human values](https://refivu.com/papers/be542b1a-1c29-4f81-beba-ffa28ae6b9f7-strong-and-weak-alignment-of-large-language-models.md)
- [Continual Learning for Multimodal Data Fusion of a Soft Gripper](https://refivu.com/papers/cbf9ffd5-651e-4801-8664-a13741eb9ff0-continual-learning-for-multimodal-data-fusion-of-a.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/277a96d1-6b97-4de4-be02-fddaa35ed0e2-vicinity-vision-transformer)
