CoAtNet: Marrying Convolution and Attention for All Data Sizes

Zihang Dai, Hanxiao Liu, Quoc V. Le, Mingxing Tan
6/9/2021
1,838 citations
cs.CVcs.LG
transformer-attention

No official code found. Best implementation: chinhsuanwu/coatnet-pytorch (403 stars). 1 more below.

Abstract

Transformers have attracted increasing interests in computer vision, but they still fall behind state-of-the-art convolutional networks. In this work, we show that while Transformers tend to have larger model capacity, their generalization can be worse than convolutional networks due to the lack of the right inductive bias.

Show full abstract

To effectively combine the strengths from both architectures, we present CoAtNets(pronounced "coat" nets), a family of hybrid models built from two key insights: (1) depthwise Convolution and self-Attention can be naturally unified via simple relative attention; (2) vertically stacking convolution layers and attention layers in a principled way is surprisingly effective in improving generalization, capacity and efficiency. Experiments show that our CoAtNets achieve state-of-the-art performance under different resource constraints across various datasets: Without extra data, CoAtNet achieves 86.0% ImageNet top-1 accuracy; When pre-trained with 13M images from ImageNet-21K, our CoAtNet achieves 88.56% top-1 accuracy, matching ViT-huge pre-trained with 300M images from JFT-300M while using 23x less data; Notably, when we further scale up CoAtNet with JFT-3B, it achieves 90.88% top-1 accuracy on ImageNet, establishing a new state-of-the-art result.

View on arXivView PDF

Code Implementations(2)

Code implementations of this paper
RepositoryTypeStarsLanguageLicenseLast commit
chinhsuanwu/coatnet-pytorchCommunity403–––
dqshuai/MetaFormerCommunity245PythonMIT2022-04-24

A PyTorch implementation of "CoAtNet: Marrying Convolution and Attention for All Data Sizes"

40365
dqshuai/MetaFormerCommunity25%
PyTorchMIT

A PyTorch implementation of "MetaFormer: A Unified Meta Framework for Fine-Grained Recognition". A reference PyTorch implementation of “CoAtNet: Marrying Convolution and Attention for All Data Sizes”

24539PythonMar 5, 20224 years agoMIT
fine-grained-classificationpytorch

Similar Papers

Cite this paper

@article{dai2021coatnet,
  title  = {CoAtNet: Marrying Convolution and Attention for All Data Sizes},
  author = {Zihang Dai and Hanxiao Liu and Quoc V. Le and Mingxing Tan},
  year   = {2021},
  eprint = {2106.04803},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.04803}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2106.04803.svg)](https://codeofpaper.com/paper/2106.04803)

Discussion