InceptionResNetV2ForImageClassification
ImageClassificationModelInceptionResNetV2ForImageClassification(config: InceptionResNetConfig)Inception-ResNet v2 image classifier (backbone + GAP + dropout + linear).
Combines an InceptionResNetV2 backbone with a
global-average-pool, optional lucid.nn.Dropout
(p=config.dropout, default 0.2), and a single
lucid.nn.Linear projection producing
config.num_classes logits. No auxiliary classifier — the
residual shortcuts already provide effective gradient flow
throughout the network. The classifier attribute is named
classif (not classifier) to match the canonical timm /
TensorFlow-Slim state-dict key.
Parameters
configInceptionResNetConfiginception_resnet_v2_cls for the
paper-cited configuration.Attributes
configInceptionResNetConfigconv2d_1a … conv2d_7b, mixed_5b, repeat, mixed_6a, repeat_1,InceptionResNetV2.avgpoolnn.AdaptiveAvgPool2ddropoutnn.Modulelucid.nn.Dropout when config.dropout > 0 (default
0.2), otherwise lucid.nn.Identity.classifnn.Linearnum_classes — named
classif for state-dict compatibility.Notes
From Szegedy et al., "Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning", AAAI 2017. Loss is the standard categorical cross-entropy
computed only when labels is not None. Approximately
55.8 M parameters; top-5 ImageNet validation error 3.08%. The key
empirical message of the paper is that residual connections do not
raise the final accuracy ceiling beyond a comparably-sized
non-residual Inception v4, but they dramatically accelerate
training convergence.
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)Used by 2
Constructors
1Instance methods
2forward(x: Tensor, labels: Tensor | None = None)Replace the classification head with a freshly initialised one.
The head keeps the reference checkpoint's classif attribute name,
so this cannot come from ClassificationHeadMixin (which looks for
self.classifier). The class docstring documented the method
without anything implementing it.