Skip to content
fn

coatnet_0

→CoAtNet23.7M
coatnet_0(pretrained: bool = False, overrides: object = {})

CoAtNet-0 backbone (Dai et al., 2021).

Builds the canonical CoAtNet-0 configuration: blocks_per_stage=(2, 3, 5, 2), dims=(96, 192, 384, 768), stem_width=64, attn_heads=(12, 24), head_hidden_size=768. The first two stages are MBConv with expansion ratio 4 and the last two stages are relative-attention transformers with head dim 32. Approximately 25.6M parameters.

Model Size

Parameters

pretrainedbool= False
No checkpoint is published for coatnet_0, so True raises NotImplementedError rather than return randomly initialised weights.
**overridesobject= {}
Keyword overrides applied on top of the canonical CoAtNet-0 config. Common examples: image_size=384, in_channels=1, head_hidden_size=None. Each override must match a field of CoAtNetConfig.

Returns

CoAtNet

A CoAtNet backbone returning a (B,768,H/32,W/32)(B, 768, H/32, W/32) spatial feature map.

Notes

CoAtNet-0 reaches 81.6% top-1 on ImageNet-1k at 224x224 (Dai et al., 2021, Table 5). See arXiv:2106.04803.

Examples

>>> import lucid
>>> from lucid.models.vision.coatnet import coatnet_0
>>> model = coatnet_0()
>>> x = lucid.randn(1, 3, 224, 224)
>>> feat = model.forward_features(x)
>>> feat.shape
(1, 768, 7, 7)

Used by 1