googlenet_cls(pretrained: bool | str = False, weights: GoogLeNetWeights | None = None, overrides: object = {})GoogLeNet (Inception v1) image classifier with auxiliary heads.
Builds a GoogLeNetForImageClassification with the
paper-cited Szegedy 2015 configuration: 22-layer Inception backbone
- global-average-pool + dropout (
p=0.4) + linear projection toconfig.num_classes, plus two auxiliary classifiers attached at Inception 4a and 4d (enabled by default viaaux_logits=True). Approximately 13.0 M parameters total when auxiliary heads are included. Reaches 69.778% top-1 on ImageNet-1k.
Model Size
Parameters
pretrainedbool or str= FalsePretrained-weight selector.
False → random init; True
→ the DEFAULT tag (GoogLeNetWeights.IMAGENET1K_V1);
a tag string → that specific checkpoint. Mutually exclusive
with weights (which wins if both are given).Explicit weights enum member. Takes precedence over
pretrained.**overridesobject= {}Keyword overrides forwarded into
GoogLeNetConfig. Use
aux_logits=False to disable auxiliary classifiers for
cheaper inference graphs, num_classes=N to retarget the
head, or dropout=p / aux_dropout=p to adjust
regularisation.Returns
GoogLeNetForImageClassificationClassifier with the GoogLeNet configuration applied (or with
overrides merged on top of it).
Notes
See Szegedy et al., "Going Deeper with Convolutions", CVPR 2015,
§5. Auxiliary classifiers were introduced specifically to combat
vanishing gradients in this 22-layer network without the benefit of
residual connections; they contribute to the loss with weight
each during training and are discarded at inference.
Pretrained weights are converted from torchvision's
GoogLeNet_Weights.IMAGENET1K_V1 and hosted under
lucid-dl/googlenet.
Examples
>>> import lucid
>>> from lucid.models.vision.googlenet import googlenet_cls
>>> model = googlenet_cls().eval()
>>> x = lucid.randn(2, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(2, 1000)