Skip to content
class

InceptionResNetV2ForImageClassification

extendsImageClassificationModelClassificationHeadMixin
InceptionResNetV2ForImageClassification(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

Architecture spec. Use inception_resnet_v2_cls for the paper-cited configuration.

Attributes

Stored copy of the config that built this model.
conv2d_1a … conv2d_7b, mixed_5b, repeat, mixed_6a, repeat_1,
mixed_7a, repeat_2, block8 Same backbone components as on InceptionResNetV2.
Final global average pool to 1×11\times1.
dropoutnn.Module
lucid.nn.Dropout when config.dropout > 0 (default 0.2), otherwise lucid.nn.Identity.
classifnn.Linear
Final classifier projecting 1536 → num_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

L=−1N∑n=1Nlog⁡softmax⁡(logitsn) yn,\mathcal{L} = -\frac{1}{N} \sum_{n=1}^{N} \log \operatorname{softmax}(\text{logits}_n)_{\,y_n},

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

1
dunder

__init__

→None
__init__(config: InceptionResNetConfig)

Instance methods

1