ConvNeXtConfig
ModelConfigConvNeXtConfig(num_classes: int = 1000, in_channels: int = 3, depths: tuple[int, ...] = (3, 3, 9, 3), dims: tuple[int, ...] = (96, 192, 384, 768), layer_scale_init: float = 1e-06, layer_norm_eps: float = 1e-06, dropout: float = 0.0)Configuration dataclass for every ConvNeXt variant.
ConvNeXtConfig is an immutable container that fully specifies
the architecture of a ConvNeXt. It is consumed by both
ConvNeXt (backbone) and
ConvNeXtForImageClassification (classifier). All five
canonical variants described in Liu et al. (2022) — Tiny / Small /
Base / Large / XLarge — can be expressed by choosing different
depths and dims.
Each ConvNeXt block applies a depthwise convolution followed by a LayerNorm and an inverted-bottleneck MLP, with a learnable per-channel layer scale on the residual branch:
Parameters
num_classesint= 10001000 (ImageNet-1k).in_channelsint= 33 (RGB).depthstuple of int= (3, 3, 9, 3)(3, 3, 9, 3) (ConvNeXt-T).dimstuple of int= (96, 192, 384, 768)(96, 192, 384, 768) (ConvNeXt-T).layer_scale_initfloat= 1e-061e-6 (Touvron et al., 2021).dropoutfloat= 0.00.0.Attributes
model_typeClassVar[str]"convnext" used by the model registry.Notes
The canonical variants registered as factory functions in
lucid.models.vision.convnext are:
================ ============= =================================== Variant depths dims ================ ============= =================================== ConvNeXt-T (3, 3, 9, 3) (96, 192, 384, 768) ConvNeXt-S (3, 3, 27, 3) (96, 192, 384, 768) ConvNeXt-B (3, 3, 27, 3) (128, 256, 512, 1024) ConvNeXt-L (3, 3, 27, 3) (192, 384, 768, 1536) ConvNeXt-XL (3, 3, 27, 3) (256, 512, 1024, 2048) ================ ============= ===================================
Reference: Zhuang Liu et al., "A ConvNet for the 2020s", CVPR 2022, arXiv:2201.03545.
Examples
Build a ConvNeXt-T configuration for CIFAR-10 (10 classes):
>>> from lucid.models.vision.convnext import ConvNeXtConfig
>>> cfg = ConvNeXtConfig(num_classes=10)
>>> cfg.depths, cfg.dims, cfg.num_classes
((3, 3, 9, 3), (96, 192, 384, 768), 10)