HyperAIHyperAI

Command Palette

Search for a command to run...

3 months ago

CoAtNet: Marrying Convolution and Attention for All Data Sizes

Zihang Dai Hanxiao Liu Quoc V. Le Mingxing Tan

CoAtNet: Marrying Convolution and Attention for All Data Sizes

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. 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.

Benchmarks

BenchmarkMethodologyMetrics
image-classification-on-gashissdbCoAtNet-1
Accuracy: 98.74
F1-Score: 99.38
Precision: 99.97
image-classification-on-imagenetCoAtNet-1
GFLOPs: 8.4
Number of params: 42M
Top 1 Accuracy: 83.3%
image-classification-on-imagenetCoAtNet-2
GFLOPs: 15.7
Number of params: 75M
Top 1 Accuracy: 84.1%
image-classification-on-imagenetCoAtNet-3 (21k)
Top 1 Accuracy: 87.6%
image-classification-on-imagenetCoAtNet-3 @384
GFLOPs: 114
Top 1 Accuracy: 88.52%
image-classification-on-imagenetCoAtNet-3
GFLOPs: 34.7
Number of params: 168M
Top 1 Accuracy: 84.5%
image-classification-on-imagenetCoAtNet-0
GFLOPs: 4.2
Number of params: 25M
Top 1 Accuracy: 81.6%
image-classification-on-imagenetCoAtNet-2 (21k)
Top 1 Accuracy: 87.1%

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp