Skip to content
fn

resnext_101_32x4d_cls

→ResNeXtForImageClassification
resnext_101_32x4d_cls(pretrained: bool | str = False, weights: ResNeXt101_32x4dWeights | None = None, overrides: object = {})

ResNeXt-101 (32x4d) image classifier (backbone + GAP + linear head).

Builds a ResNeXtForImageClassification with the paper-cited ResNeXt-101 (32x4d) topology and a lucid.nn.Linear classifier projecting 2048 → config.num_classes. Approximately 44.2 M parameters; the distributed Gluon GLUON_IN1K checkpoint reaches 80.342% ImageNet-1k top-1.

Model Size

Parameters

pretrainedbool or str= False
Pretrained-weight selector. False → random init; True → the DEFAULT tag (ResNeXt101_32x4dWeights.GLUON_IN1K); a tag string (e.g. "GLUON_IN1K") → that specific checkpoint. Mutually exclusive with weights (which wins if both are given).
weights(ResNeXt101_32x4dWeights, optional, keyword - only)= None
Explicit weights enum member, e.g. ResNeXt101_32x4dWeights.GLUON_IN1K. Takes precedence over pretrained.
**overridesobject= {}
Keyword overrides forwarded into ResNeXtConfig. Note: overriding num_classes away from the checkpoint's class count makes pretrained loading fail the strict key/shape check.

Returns

ResNeXtForImageClassification

Classifier with the ResNeXt-101 (32x4d) configuration applied (or with overrides merged on top of it), optionally initialised from pretrained weights.

Notes

Pretrained weights are converted from the timm Gluon checkpoint resnext101_32x4d.gluon_in1k and hosted on the Hugging Face Hub under lucid-dl/resnext-101-32x4d. The Gluon preset uses bicubic interpolation with a 0.875 crop_pct (256 resize → 224 crop).

Examples

>>> import lucid
>>> from lucid.models.vision.resnext import resnext_101_32x4d_cls
>>> model = resnext_101_32x4d_cls()
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(1, 1000)
Load ImageNet-pretrained weights:
>>> model = resnext_101_32x4d_cls(pretrained=True)
>>> from lucid.models.vision.resnext import ResNeXt101_32x4dWeights
>>> model = resnext_101_32x4d_cls(weights=ResNeXt101_32x4dWeights.GLUON_IN1K)

Used by 1