resnet_34_cls(pretrained: bool | str = False, weights: ResNet34Weights | None = None, overrides: object = {})ResNet-34 image classifier (backbone + GAP + linear head).
Builds a ResNetForImageClassification with the paper-cited
ResNet-34 topology: _BasicBlock blocks stacked
[3, 4, 6, 3] over four stages, followed by global average
pooling and a linear projection to config.num_classes.
Approximately 21.8M parameters and 73.31% ImageNet-1k top-1 in
He et al., 2015 (Table 4).
Model Size
Parameters
pretrainedbool or str= FalsePretrained-weight selector.
False → random init; True
→ the DEFAULT tag (ResNet34Weights.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
ResNetConfig.Returns
ResNetForImageClassificationClassifier with the ResNet-34 configuration applied (or with
overrides merged on top of it), optionally initialised from
pretrained weights.
Notes
See He et al., "Deep Residual Learning for Image Recognition",
CVPR 2016 (arXiv:1512.03385), Table 1. Pretrained weights are
converted from torchvision's ResNet34_Weights and hosted on the
Hugging Face Hub under lucid-dl/resnet-34.
Examples
>>> import lucid
>>> from lucid.models.vision.resnet import resnet_34_cls
>>> model = resnet_34_cls()
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(1, 1000)