|
3 | 3 | ResNet |
4 | 4 | ------------------------------- |
5 | 5 |
|
6 | | -.. py:class:: paddle.vision.models.ResNet(Block, depth=50, width=64, num_classes=1000, with_pool=True) |
| 6 | +.. py:class:: paddle.vision.models.ResNet(Block, depth=50, width=64, num_classes=1000, with_pool=True, groups=1) |
7 | 7 |
|
8 | | - ResNet模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。 |
| 8 | +
|
| 9 | +ResNet 模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。 |
9 | 10 |
|
10 | 11 | 参数 |
11 | 12 | ::::::::: |
| 13 | + |
12 | 14 | - **Block** (BasicBlock|BottleneckBlock) - 模型的残差模块。 |
13 | | - - **depth** (int,可选) - resnet模型的深度。默认值:50。 |
14 | | - - **width** (int,可选) - resnet模型的基础宽度。默认值:64。 |
15 | | - - **num_classes** (int, 可选) - 最后一个全连接层输出的维度。如果该值小于0,则不定义最后一个全连接层。默认值:1000。 |
| 15 | + - **depth** (int,可选) - ResNet 模型的深度。默认值:50。 |
| 16 | + - **width** (int,可选) - 各个卷积块的每个卷积组基础宽度。默认值:64。 |
| 17 | + - **num_classes** (int, 可选) - 最后一个全连接层输出的维度。如果该值小于 0,则不定义最后一个全连接层。默认值:1000。 |
16 | 18 | - **with_pool** (bool,可选) - 是否定义最后一个全连接层之前的池化层。默认值:True。 |
| 19 | + - **groups** (int,可选) - 各个卷积块的分组数。默认值:1。 |
17 | 20 |
|
18 | 21 | 返回 |
19 | 22 | ::::::::: |
20 | | -ResNet模型,Layer的实例。 |
| 23 | + |
| 24 | +ResNet 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。 |
21 | 25 |
|
22 | 26 | 代码示例 |
23 | 27 | ::::::::: |
24 | | -.. code-block:: python |
25 | | -
|
26 | | - import paddle |
27 | | - from paddle.vision.models import ResNet |
28 | | - from paddle.vision.models.resnet import BottleneckBlock, BasicBlock |
29 | | -
|
30 | | - resnet50 = ResNet(BottleneckBlock, 50) |
31 | | -
|
32 | | - wide_resnet50_2 = ResNet(BottleneckBlock, 50, width=64*2) |
33 | | -
|
34 | | - resnet18 = ResNet(BasicBlock, 18) |
35 | | -
|
36 | | - x = paddle.rand([1, 3, 224, 224]) |
37 | | - out = resnet18(x) |
38 | 28 |
|
39 | | - print(out.shape) |
| 29 | +COPY-FROM: paddle.vision.models.ResNet |
0 commit comments