Skip to content
fn

densenet_121

→DenseNet7M
densenet_121(pretrained: bool = False, overrides: object = {})

DenseNet-121 feature-extracting backbone (no classification head).

Builds a DenseNet with the paper-cited DenseNet-121 topology: per-block dense-layer counts (6, 12, 24, 16), growth rate k=32k = 32, initial conv channels 64. Approximately 8.0 M parameters total — by far the most parameter-efficient of the ImageNet DenseNets, reaching a top-1 error of 25.0% (Huang et al., 2017, Table 3).

Model Size

Parameters

pretrainedbool= False
No checkpoint is published for densenet_121, so True raises NotImplementedError rather than return randomly initialised weights. densenet_121_cls is the checkpointed variant.
**overridesobject= {}
Keyword overrides forwarded into DenseNetConfig (growth_rate, dropout_rate, in_channels, etc.).

Returns

DenseNet

Backbone with the DenseNet-121 configuration applied (or with overrides merged on top of it).

Notes

See Huang et al., "Densely Connected Convolutional Networks", CVPR 2017, Table 1.

Examples

>>> import lucid
>>> from lucid.models.vision.densenet import densenet_121
>>> model = densenet_121()
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.last_hidden_state.shape   # (B, 1024, 1, 1)
(1, 1024, 1, 1)

Used by 1