class
InceptionV3ForImageClassification
extends
PretrainedModelClassificationHeadMixinInceptionV3ForImageClassification(config: InceptionConfig)Inception v3 image classifier with optional auxiliary classifier.
Combines an InceptionV3 backbone with a global-average-pool
lucid.nn.Dropout(p=config.dropout, default 0.5) +lucid.nn.Linearhead producingconfig.num_classeslogits. Whenconfig.aux_logits=True, an auxiliary classifier (_InceptionAux) attaches after the last Inception-C block and contributes a 0.4-weighted cross-entropy term during training.
Parameters
configInceptionConfigArchitecture spec. Use
inception_v3_cls for the
timm-compatible default (no auxiliary head). Pass
aux_logits=True to enable the auxiliary classifier — used
during training to combat vanishing gradients and provide
intermediate supervision.Attributes
configInceptionConfigStored copy of the config that built this model.
stem, inception_a0, ..., inception_e1, reduction_a, reduction_bSame backbone components as on
InceptionV3.avgpoolnn.AdaptiveAvgPool2dFinal global average pool to .
dropnn.DropoutDropout applied before the main classifier
(
p=config.dropout, 0.5 in the paper).classifiernn.ModuleFinal linear projection 2048 →
num_classes.auxnn.ModuleAuxiliary classifier (
_InceptionAux) when
config.aux_logits=True; otherwise
lucid.nn.Identity.Notes
From Szegedy et al., "Rethinking the Inception Architecture for Computer Vision", CVPR 2016, §6. Total loss with auxiliary head is
The paper also introduces label smoothing — replacing the one-hot target with — although that is a training-loop concern handled outside this module. Final top-5 ImageNet validation error in the paper is 3.5% with ≈24 M parameters.
Examples
Inference path (auxiliary head ignored even if enabled):
>>> import lucid
>>> from lucid.models.vision.inception import inception_v3_cls
>>> model = inception_v3_cls().eval()
>>> x = lucid.randn(2, 3, 299, 299)
>>> out = model(x)
>>> out.logits.shape
(2, 1000)Used by 2
Constructors
1Instance methods
1forward(x: Tensor, labels: Tensor | None = None)