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
paper-cited 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% (torchvision weights) — the most accurate
of the four canonical DenseNets.
Model Size
Parameters
pretrainedbool or str= FalseFalse → random init; True → DEFAULT tag; a tag
string → that checkpoint.Explicit enum member; takes precedence over
pretrained.**overridesobject= {}Keyword overrides forwarded into
DenseNetConfig.Returns
DenseNetForImageClassificationClassifier 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)