ResNet-18 feature-extracting backbone (no classification head).
Builds a ResNet with the paper-cited ResNet-18 topology:
_BasicBlock blocks stacked [2, 2, 2, 2] over four
stages, yielding approximately 11.7M parameters. The original
paper (He et al., 2015) reports a 69.76% ImageNet-1k top-1
validation accuracy with this configuration (Table 4). Used as a
lightweight backbone where parameter / FLOP budget is tight.
Model Size
Parameters
pretrainedbool= FalseReserved for future pretrained-weight loading. Currently
ignored — the returned model is randomly initialised.
**overridesobject= {}Keyword overrides forwarded into
ResNetConfig to
customise individual fields (e.g. in_channels=1 for
grayscale input, zero_init_residual=True for large-batch
training).Returns
ResNetBackbone with the ResNet-18 configuration applied (or with
overrides merged on top of it).
Notes
See He et al., "Deep Residual Learning for Image Recognition", CVPR 2016 (arXiv:1512.03385), Table 1. The key insight is the identity shortcut
which lets gradients propagate through a clean identity branch even in very deep networks.
Examples
>>> import lucid
>>> from lucid.models.vision.resnet import resnet_18
>>> model = resnet_18()
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.last_hidden_state.shape # (B, 512, H/32, W/32)
(1, 512, 7, 7)