Skip to content
class

InceptionNeXtForImageClassification

extendsImageClassificationModelClassificationHeadMixin
InceptionNeXtForImageClassification(config: InceptionNeXtConfig)

InceptionNeXt with an MLP classification head (Yu et al., 2024).

Wraps the same trunk as InceptionNeXt (patchify stem + four stages of MetaNeXt blocks) and adds the reference-recipe MLP classifier head: global average pool → Linear(dim, 3*dim) → GELU → LayerNorm → Linear(3*dim, num_classes):

logits=W2 LN ⁣(GELU(W1 GAP(zL)))+b2.\text{logits} = W_2\, \mathrm{LN}\!\bigl(\mathrm{GELU}(W_1\, \mathrm{GAP}(z^{L}))\bigr) + b_2.

Pass labels to forward to compute the cross-entropy loss in the same pass.

Parameters

Architecture specification. Must set num_classes to the desired number of output categories. See InceptionNeXtConfig.

Attributes

Patchify stem: 4×44 \times 4 stride-4 Conv2d + BN.
Four MetaNeXt stages.
head_MlpClassifierHead
MLP head: fc1 → GELU → LayerNorm → fc2.

Notes

Reference: Weihao Yu et al., "InceptionNeXt: When Inception Meets ConvNeXt", CVPR 2024. InceptionNeXt-T matches or exceeds ConvNeXt-T accuracy at noticeably lower wall-clock latency.

Examples

End-to-end inference with the default InceptionNeXt-T classifier:
>>> import lucid
>>> from lucid.models.vision.inception_next import (
...     InceptionNeXtConfig, InceptionNeXtForImageClassification,
... )
>>> model = InceptionNeXtForImageClassification(InceptionNeXtConfig())
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(1, 1000)

Used by 2

Constructors

1
dunder

__init__

→None
__init__(config: InceptionNeXtConfig)

Instance methods

1