Skip to content
class

InceptionNeXt

extendsPretrainedModelBackboneMixin
InceptionNeXt(config: InceptionNeXtConfig)

InceptionNeXt backbone (Yu et al., 2024).

A drop-in replacement for the ConvNeXt backbone that factorizes the single large 7×77 \times 7 depthwise conv into four parallel Inception-style branches operating on disjoint channel splits:

IDWConv(x)=Concat(x(1),  DW3×3(x(2)),  DW1×K(x(3)),  DWK×1(x(4))),\mathrm{IDWConv}(x) = \mathrm{Concat}\bigl( x^{(1)},\; \mathrm{DW}_{3 \times 3}(x^{(2)}),\; \mathrm{DW}_{1 \times K}(x^{(3)}),\; \mathrm{DW}_{K \times 1}(x^{(4)})\bigr),

with K=band_kernelK = \texttt{band\_kernel} (default 11). The four branches together preserve a large effective receptive field while cutting depthwise FLOPs and memory traffic relative to a single 7×77 \times 7 depthwise conv. Each MetaNeXtBlock further applies BatchNorm, a 1x1 Conv-MLP, and a layer-scale parameter on the residual branch.

forward_features returns the global-average-pooled (B,dims[-1])(B, \texttt{dims[-1]}) feature.

Parameters

Frozen dataclass specifying depths, dims, band_kernel, mlp_ratios, in_channels, and num_classes. See InceptionNeXtConfig.

Attributes

Patchify stem: 4×44 \times 4 stride-4 Conv2d + BatchNorm2d.
Four _Stage modules, each containing an optional downsampler and a sequence of MetaNeXt blocks.
feature_infolist[FeatureInfo]
Four-stage feature description with reductions (4,8,16,32)(4, 8, 16, 32).

Notes

Reference: Weihao Yu et al., "InceptionNeXt: When Inception Meets ConvNeXt", CVPR 2024, arXiv:2303.16900.

Examples

Build an InceptionNeXt-T backbone and run a forward pass:
>>> import lucid
>>> from lucid.models.vision.inception_next import (
...     InceptionNeXt, InceptionNeXtConfig,
... )
>>> model = InceptionNeXt(InceptionNeXtConfig())
>>> x = lucid.randn(1, 3, 224, 224)
>>> feat = model.forward_features(x)
>>> feat.shape                       # (B, dims[-1])
(1, 768)

Used by 2

Constructors

1
dunder

__init__

→None
__init__(config: InceptionNeXtConfig)

Instance methods

2
fn

forward_features

→Tensor
forward_features(x: Tensor)

Run the backbone's feature-extraction pass.

Parameters

Input image batch, shape (B, C, H, W).

Returns

Tensor

Feature map at the deepest stage. Concrete subclasses may additionally stash earlier stages on the instance so multi-stage consumers can fetch them.

Examples

The map returned is the one feature_info lists last, so a
neck can size itself from that entry without running the model.
>>> import lucid
>>> from lucid.models import create_model
>>> backbone = create_model("resnet_18").eval()
>>> last = backbone.feature_info[-1]
>>> last.num_channels, last.reduction
(512, 32)
>>> backbone.forward_features(lucid.randn((1, 3, 64, 96))).shape
(1, 512, 2, 3)
Each side is divided by the advertised reduction on its own, so
a non-square input keeps its aspect ratio.