vgg16

paddle.vision.models. vgg16 ( pretrained=False, batch_norm=False, **kwargs ) [源代码]

16 层的 VGG 模型,来自论文 "Very Deep Convolutional Networks For Large-Scale Image Recognition"

参数

  • pretrained (bool,可选) - 是否加载预训练权重。如果为 True,则返回在 ImageNet 上预训练的模型。默认值为 False。

  • batch_norm (bool,可选) - 是否在每个卷积层后添加批归一化层。默认值为 False。

  • **kwargs (可选) - 附加的关键字参数,具体可选参数请参见 VGG

返回

Layer,16 层的 VGG 模型实例。

代码示例

import paddle
from paddle.vision.models import vgg16

# build model
model = vgg16()

# build vgg16 model with batch_norm
model = vgg16(batch_norm=True)

x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
# [1, 1000]