inception_resnet_v2_cls(pretrained: bool | str = False, weights: InceptionResNetV2Weights | None = None, overrides: object = {})Inception-ResNet v2 image classifier (backbone + GAP + dropout + linear).
Builds an InceptionResNetV2ForImageClassification with the
paper-cited Szegedy 2017 topology and a single
lucid.nn.Linear classifier head producing
config.num_classes logits. Approximately 55.8 M parameters
total; achieves a top-5 ImageNet validation error of 3.08%.
Model Size
Parameters
pretrainedbool or str= FalseFalse → random init; True
→ the DEFAULT tag (InceptionResNetV2Weights.TF_IN1K);
a tag string (e.g. "TF_IN1K") → that specific checkpoint.
Mutually exclusive with weights (which wins if both are
given).InceptionResNetV2Weights.TF_IN1K. Takes precedence over
pretrained.**overridesobject= {}InceptionResNetConfig.
Common picks: num_classes=N to retarget the head,
dropout=p to adjust regularisation. Note: overriding
num_classes away from the checkpoint's class count makes
pretrained loading fail the strict key/shape check — load with a
matching head, then call reset_classifier.Returns
InceptionResNetV2ForImageClassificationClassifier with the Inception-ResNet v2 configuration applied
(or with overrides merged on top of it), optionally
initialised from pretrained weights.
Notes
See Szegedy et al., "Inception-v4, Inception-ResNet and the Impact
of Residual Connections on Learning", AAAI 2017, §3.3. The
classifier attribute is named classif (not classifier) for
timm / TensorFlow-Slim state-dict compatibility. Pretrained weights
are converted from timm's inception_resnet_v2.tf_in1k checkpoint
and hosted on the Hugging Face Hub under
lucid-dl/inception-resnet-v2.
Examples
>>> import lucid
>>> from lucid.models.vision.inception_resnet import inception_resnet_v2_cls
>>> model = inception_resnet_v2_cls()
>>> x = lucid.randn(2, 3, 299, 299)
>>> out = model(x)
>>> out.logits.shape
(2, 1000)
Load ImageNet-pretrained weights:
>>> model = inception_resnet_v2_cls(pretrained=True) # DEFAULT tag
>>> from lucid.models.vision.inception_resnet import InceptionResNetV2Weights
>>> model = inception_resnet_v2_cls(weights=InceptionResNetV2Weights.TF_IN1K)