Skip to content
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 to config.num_classes, plus two auxiliary classifiers attached at Inception 4a and 4d (enabled by default via aux_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= False
Pretrained-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).
weights(GoogLeNetWeights, optional, keyword - only)= None
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

GoogLeNetForImageClassification

Classifier 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 0.30.3 each during training and are discarded at inference. Pretrained weights are converted from reference_vision'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)

Used by 1