Skip to content
fn

densenet_161_cls

→DenseNetForImageClassification28.7M
densenet_161_cls(pretrained: bool | str = False, weights: DenseNet161Weights | None = None, overrides: object = {})

DenseNet-161 image classifier (backbone + GAP + linear head).

Builds a DenseNetForImageClassification with the DenseNet-161 topology (k=48, 96-channel stem) and a lucid.nn.Linear classifier projecting 2208 → config.num_classes. Approximately 28.7 M parameters; top-1 ImageNet accuracy 77.14% — the most accurate DenseNet shipped here.

The topology is not in Huang et al., CVPR 2017 (Table 1 lists 121/169/201/264 at k=32k = 32); it comes from the authors' own released reference-framework models.

Model Size

Parameters

pretrainedbool or str= False
False → random init; True → DEFAULT tag; a tag string → that checkpoint.
weights(DenseNet161Weights, optional, keyword - only)= None
Explicit enum member; takes precedence over pretrained.
**overridesobject= {}
Keyword overrides forwarded into DenseNetConfig.

Returns

DenseNetForImageClassification

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

Examples

>>> import lucid
>>> from lucid.models.vision.densenet import densenet_161_cls
>>> model = densenet_161_cls(pretrained=True)
>>> x = lucid.randn(1, 3, 224, 224)
>>> out = model(x)
>>> out.logits.shape
(1, 1000)

Used by 1