Skip to content
fn

crossvit_tiny_cls

→CrossViTForImageClassification7M
crossvit_tiny_cls(pretrained: bool | str = False, weights: CrossViTTinyWeights | None = None, overrides: object = {})

CrossViT-Ti image classifier (Chen et al., ICCV 2021).

Two-branch ViT with embedding dims (96, 192), per-stage depths ((1, 4, 0)) x 3, and 3 attention heads per branch. ~7M parameters; paper Table 2 reports 73.4% ImageNet-1k top-1 at 240x240.

Model Size

Parameters

pretrainedbool or str= False
False returns randomly-initialised weights; True loads the default entry of CrossViTTinyWeights; a string selects a named entry from that enum.
weightsCrossViTTinyWeights= None
Explicit weight-enum member. Mutually exclusive with a string pretrained; raises if both resolve to different entries.
**overridesobject= {}
Per-field overrides forwarded to CrossViTConfig (e.g. num_classes=10 to retarget the head).

Returns

CrossViTForImageClassification

The configured classifier, ready for model(x) inference or fine-tuning.

Notes

Reference: Chen, Fan, and Panda, "CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification", ICCV 2021 (arXiv:2103.14899).

Examples

>>> import lucid
>>> from lucid.models.vision.crossvit import crossvit_tiny_cls
>>> model = crossvit_tiny_cls()
>>> out = model(lucid.randn(1, 3, 240, 240))
>>> out.logits.shape
(1, 1000)

Used by 1