class
InceptionV4ForImageClassification
extends
ImageClassificationModelClassificationHeadMixinInceptionV4ForImageClassification(config: InceptionV4Config)Inception-v4 image classifier (trunk + GAP + dropout + linear).
Adds the paper's head to the InceptionV4 trunk: global
average pooling over the grid, dropout with keep
probability 0.8 (config.dropout = 0.2), and a single
lucid.nn.Linear layer producing config.num_classes
logits. The trunk is held directly as features and the head as
last_linear so the state dict matches the released checkpoint's
keys one-for-one.
Parameters
configInceptionV4ConfigArchitecture spec. Use
inception_v4_cls for the paper
configuration.Attributes
configInceptionV4ConfigStored copy of the config that built this model.
featuresnn.SequentialSame 22-module trunk as
InceptionV4.features.global_ poolnn.AdaptiveAvgPool2dGlobal average pool to .
head_ dropnn.Modulelucid.nn.Dropout when config.dropout > 0, otherwise
lucid.nn.Identity.last_ linearnn.LinearClassifier projecting 1536 →
num_classes.Notes
The loss, computed only when labels is given, is the mean
categorical cross-entropy
42.7 M parameters in total. The paper reports 20.0% top-1 / 5.0% top-5 single-crop error on the ImageNet validation set (Table 2).
Examples
>>> import lucid
>>> from lucid.models.vision.inception_v4 import inception_v4_cls
>>> model = inception_v4_cls().eval()
>>> out = model(lucid.randn(2, 3, 299, 299))
>>> out.logits.shape
(2, 1000)Used by 2
Constructors
1Instance methods
1forward(x: Tensor, labels: Tensor | None = None)Classify a batch of images.
Parameters
Returns
InceptionV4Outputlogits of shape (B, num_classes) and loss (or
None).