Skip to content
fn

coatnet_0_cls

→CoAtNetForImageClassification25M
coatnet_0_cls(pretrained: bool = False, overrides: object = {})

CoAtNet-0 image classifier (Dai et al., 2021).

Combines the coatnet_0 backbone with the standard CoAtNet head: global average pool → LayerNorm → Linear(768) + Tanh → final linear classifier. Default output is num_classes=1000 (ImageNet-1k). Approximately 25.6M parameters.

Model Size

Parameters

pretrainedbool= False
No checkpoint is published for coatnet_0_cls, so True raises NotImplementedError rather than return randomly initialised weights.
**overridesobject= {}
Keyword overrides on top of the canonical CoAtNet-0 config. Commonly used: num_classes to switch label space, image_size to fine-tune at a different resolution.

Returns

CoAtNetForImageClassification

Classifier returning ImageClassificationOutput whose logits has shape (B, num_classes).

Notes

CoAtNet-0 reaches 81.6% top-1 on ImageNet-1k at 224x224 (Dai et al., 2021, Table 5). Larger variants (CoAtNet-3 / -4) reach 84.5% / 85.8% at 384x384 after JFT-3B pretraining (Table 1, headline result).

Examples

>>> import lucid
>>> from lucid.models.vision.coatnet import coatnet_0_cls
>>> model = coatnet_0_cls(num_classes=1000)
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(1, 1000)

Used by 1