DenseNet¶
- class paddle.vision.models. DenseNet ( layers=121, bn_size=4, dropout=0.0, num_classes=1000, with_pool=True ) [source]
-
DenseNet model from “Densely Connected Convolutional Networks”.
- Parameters
-
layers (int, optional) – Layers of DenseNet. Default: 121.
bn_size (int, optional) – Expansion of growth rate in the middle layer. Default: 4.
dropout (float, optional) – Dropout rate. Default: \(0.0\).
num_classes (int, optional) – Output dim of last fc layer. If num_classes <= 0, last fc layer will not be defined. Default: 1000.
with_pool (bool, optional) – Use pool before the last fc layer or not. Default: True.
- Returns
-
Layer. An instance of DenseNet model.
Examples
>>> import paddle >>> from paddle.vision.models import DenseNet >>> # Build model >>> densenet = DenseNet() >>> x = paddle.rand([1, 3, 224, 224]) >>> out = densenet(x) >>> print(out.shape) [1, 1000]
-
forward
(
input
)
forward¶
-
Defines the computation performed at every call. Should be overridden by all subclasses.
- Parameters
-
*inputs (tuple) – unpacked tuple arguments
**kwargs (dict) – unpacked dict arguments