CoAtNet
19 memberslucid.models.vision.coatnetCoAtNet family — backbone + image classification (Dai et al., 2021).
Dai, Zihang, et al. "CoAtNet: Marrying Convolution and Attention for All Data Sizes." Advances in Neural Information Processing Systems, vol. 34, 2021.
CoAtNet hybridises depthwise convolution and relative self-attention in a single backbone, motivated by the observation that convolutions excel at generalization (strong local inductive bias) while attention excels at capacity (data-dependent global mixing). The network is a four-stage pyramid preceded by a two-layer convolutional stem; the early stages use MBConv blocks (squeeze-and-excitation, expansion ratio 4) and the later stages use relative-attention transformer blocks operating on -length token sequences.
The key building block of the transformer stages is relative self-attention:
where is a learned bias indexed by the relative spatial offset between tokens. This recovers the translation equivariance that convolutions provide for free while still permitting global, data-dependent mixing. CoAtNet stacks two MBConv stages (C-stages) followed by two transformer stages (T-stages) so that strong local features are extracted first and long-range dependencies are modelled at lower resolutions where attention is cheap. The CoAtNet-0 through CoAtNet-7 variants simply scale stage depths and channel widths along this skeleton.
Classes
Functions
coatnet_0→ CoAtNetCoAtNet-0 backbone (Dai et al., 2021).
coatnet_0_cls→ CoAtNetForImageClassificationCoAtNet-0 image classifier (Dai et al., 2021).
coatnet_1→ CoAtNet42MCoAtNet-1 backbone (Dai et al., 2021).
coatnet_1_cls→ CoAtNetForImageClassification42MCoAtNet-1 image classifier (Dai et al., 2021).
coatnet_2→ CoAtNet75MCoAtNet-2 backbone (Dai et al., 2021).
coatnet_2_cls→ CoAtNetForImageClassification75MCoAtNet-2 image classifier (Dai et al., 2021).
coatnet_3→ CoAtNet168MCoAtNet-3 backbone (Dai et al., 2021).
coatnet_3_cls→ CoAtNetForImageClassification168MCoAtNet-3 image classifier (Dai et al., 2021).
coatnet_4→ CoAtNet275MCoAtNet-4 backbone (Dai et al., 2021).
coatnet_4_cls→ CoAtNetForImageClassification275MCoAtNet-4 image classifier (Dai et al., 2021).
coatnet_5→ CoAtNet688MCoAtNet-5 backbone (Dai et al., 2021).
coatnet_5_cls→ CoAtNetForImageClassification688MCoAtNet-5 image classifier (Dai et al., 2021).
coatnet_6→ CoAtNet1.5BCoAtNet-6 backbone (Dai et al., 2021).
coatnet_6_cls→ CoAtNetForImageClassification1.5BCoAtNet-6 image classifier (Dai et al., 2021).
coatnet_7→ CoAtNet2.4BCoAtNet-7 backbone (Dai et al., 2021).
coatnet_7_cls→ CoAtNetForImageClassification2.4BCoAtNet-7 image classifier (Dai et al., 2021).