Skip to content
module

DenseNet

17 members
lucid.models.vision.densenet

DenseNet family — Huang et al., CVPR 2017.

Image Classification
Paper

Huang, Gao, et al. "Densely Connected Convolutional Networks." Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 4700–4708.

Overview

DenseNet takes the residual-shortcut idea to its logical extreme. Inside each dense block, every layer receives as input the concatenated feature maps of all previous layers in the block, not just the immediately preceding layer. For a block of LL layers the ℓ\ell-th layer computes

xℓ=Hℓ([x0,  x1,  …,  xℓ−1]),x_\ell = H_\ell\bigl( [x_0,\; x_1,\; \dots,\; x_{\ell-1}] \bigr),

where [⋅][\cdot] denotes channel-wise concatenation and HℓH_\ell is a BN → ReLU → 3×33\times3 Conv composite (optionally preceded by a 1×11\times1 bottleneck). Each HℓH_\ell contributes a small fixed number kk of new feature maps — the growth rate — so the input width of layer ℓ\ell grows linearly as k0+(ℓ−1) kk_0 + (\ell - 1)\,k.

This dense connectivity has three notable consequences. First, every layer has direct supervision-style access to the loss gradient through the concatenation paths, easing optimisation in very deep networks. Second, parameter efficiency is excellent: because each layer only adds kk (typically 12, 24, or 32) new channels rather than transforming the full activation, a DenseNet with 0.8 M parameters matches the accuracy of a 1.7 M parameter ResNet on CIFAR. Third, feature reuse is explicit — later layers can directly combine raw early features with refined deep features without re-encoding them.

The four ImageNet variants — DenseNet-121, 169, 201, and 264 — differ only in the per-block layer counts (block_config). All use four dense blocks separated by transition layers (1×11\times1 Conv + 2×22\times2 average pool) that compress the channel count and halve the spatial resolution. DenseNet-121 reaches a top-1 ImageNet error of 25.0% with 8 M parameters, substantially better parameter efficiency than the contemporary ResNet-50.

Classes

Functions

Weights