Following their success in natural language processing, transformers have recently shown much promise for computer vision. The self-attention operation underlying transformers yields global interactions between all tokens ,i.e. words or image patches, and enables flexible modelling of image data beyond the local interactions of convolutions. This flexibility, however, comes with a quadratic complexity in time and memory, hindering application to long sequences and high-resolution images. We propose a "transposed" version of self-attention that operates across feature channels rather than tokens, where the interactions are based on the cross-covariance matrix between keys and queries. The resulting cross-covariance attention (XCA) has linear complexity in the number of tokens, and allows efficient processing of high-resolution images. Our cross-covariance image transformer (XCiT) is built upon XCA. It combines the accuracy of conventional transformers with the scalability of convolutional architectures. We validate the effectiveness and generality of XCiT by reporting excellent results on multiple vision benchmarks, including image classification and self-supervised feature learning on ImageNet-1k, object detection and instance segmentation on COCO, and semantic segmentation on ADE20k.

PDF Abstract NeurIPS 2021 PDF NeurIPS 2021 Abstract
Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Semantic Segmentation ADE20K XCiT-M24/8 (Semantic-FPN) Validation mIoU 46.9 # 161
Semantic Segmentation ADE20K XCiT-S24/8 (UperNet) Validation mIoU 48.1 # 142
Semantic Segmentation ADE20K XCiT-S24/8 (Semantic-FPN) Validation mIoU 47.1 # 159
Semantic Segmentation ADE20K XCiT-S12/8 (UperNet) Validation mIoU 46.6 # 166
Semantic Segmentation ADE20K XCiT-S12/8 (Semantic-FPN) Validation mIoU 44.2 # 196
Semantic Segmentation ADE20K XCiT-M24/8 (UperNet) Validation mIoU 48.4 # 137
Instance Segmentation COCO minival XCiT-S24/8 mask AP 43.0 # 59
Object Detection COCO minival XCiT-S24/8 box AP 48.1 # 86
Instance Segmentation COCO minival XCiT-M24/8 mask AP 43.7 # 55
Object Detection COCO minival XCiT-M24/8 box AP 48.5 # 83
Image Classification ImageNet XCiT-M24 Top 1 Accuracy 85.8% # 187
Number of params 84M # 813
GFLOPs 188 # 467
Image Classification ImageNet XCiT-S24 Top 1 Accuracy 85.6% # 209
Number of params 48M # 713
GFLOPs 106 # 453
Image Classification ImageNet XCiT-S12 Top 1 Accuracy 85.1% # 245
Number of params 26M # 607
GFLOPs 55.6 # 430
Image Classification ImageNet XCiT-L24 Top 1 Accuracy 86% # 176
Number of params 189M # 889
GFLOPs 417.9 # 482

Methods