class
InceptionNeXtForImageClassification
extends
PretrainedModelInceptionNeXtForImageClassification(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):
Pass labels to forward to compute the cross-entropy
loss in the same pass.
Parameters
configInceptionNeXtConfigArchitecture specification. Must set
num_classes to the
desired number of output categories. See
InceptionNeXtConfig.Attributes
stemnn.SequentialPatchify stem: stride-4 Conv2d + BN.
stagesnn.ModuleListFour MetaNeXt stages.
head_MlpClassifierHeadMLP 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
1Instance methods
1forward(x: Tensor, labels: Tensor | None = None)