Skip to content

Commit

Permalink
update and fix ResNet cn docs (PaddlePaddle#4322)
Browse files Browse the repository at this point in the history
* refine cn docs

* width_per_group -> width

* remove ResNeXt from Overview

* trigger

* copy from en docs

* add a blank line

* trigger ci (remove PADDLEPADDLE_PR)

* refine `Returns`

* add space between cn and en char

* refine desc of pretrained

* fix wrong ref
  • Loading branch information
SigureMo authored Jun 16, 2022
1 parent 5f23c43 commit db134a6
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 276 deletions.
1 change: 0 additions & 1 deletion docs/api/paddle/vision/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ paddle.vision 目录是飞桨在视觉领域的高层API。具体如下:
" :ref:`resnet152 <cn_api_paddle_vision_models_resnet152>` ", "152层的ResNet模型"
" :ref:`wide_resnet50_2 <cn_api_paddle_vision_models_wide_resnet50_2>` ", "50层的WideResNet模型"
" :ref:`wide_resnet101_2 <cn_api_paddle_vision_models_wide_resnet101_2>` ", "101层的WideResNet模型"
" :ref:`ResNeXt <cn_api_paddle_vision_models_ResNeXt>` ", "ResNeXt模型"
" :ref:`resnext50_32x4d <cn_api_paddle_vision_models_resnext50_32x4d>` ", "ResNeXt-50 32x4d模型"
" :ref:`resnext50_64x4d <cn_api_paddle_vision_models_resnext50_64x4d>` ", "ResNeXt-50 64x4d模型"
" :ref:`resnext101_32x4d <cn_api_paddle_vision_models_resnext101_32x4d>` ", "ResNeXt-101 32x4d模型"
Expand Down
33 changes: 0 additions & 33 deletions docs/api/paddle/vision/models/ResNeXt_cn.rst

This file was deleted.

32 changes: 11 additions & 21 deletions docs/api/paddle/vision/models/ResNet_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,27 @@
ResNet
-------------------------------

.. py:class:: paddle.vision.models.ResNet(Block, depth=50, width=64, num_classes=1000, with_pool=True)
.. py:class:: paddle.vision.models.ResNet(Block, depth=50, width=64, num_classes=1000, with_pool=True, groups=1)
ResNet模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。
ResNet 模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。

参数
:::::::::

- **Block** (BasicBlock|BottleneckBlock) - 模型的残差模块。
- **depth** (int,可选) - resnet模型的深度。默认值:50。
- **width** (int,可选) - resnet模型的基础宽度。默认值:64。
- **num_classes** (int, 可选) - 最后一个全连接层输出的维度。如果该值小于0,则不定义最后一个全连接层。默认值:1000。
- **depth** (int,可选) - ResNet 模型的深度。默认值:50。
- **width** (int,可选) - 各个卷积块的每个卷积组基础宽度。默认值:64。
- **num_classes** (int, 可选) - 最后一个全连接层输出的维度。如果该值小于 0,则不定义最后一个全连接层。默认值:1000。
- **with_pool** (bool,可选) - 是否定义最后一个全连接层之前的池化层。默认值:True。
- **groups** (int,可选) - 各个卷积块的分组数。默认值:1。

返回
:::::::::
ResNet模型,Layer的实例。

ResNet 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import ResNet
from paddle.vision.models.resnet import BottleneckBlock, BasicBlock
resnet50 = ResNet(BottleneckBlock, 50)
wide_resnet50_2 = ResNet(BottleneckBlock, 50, width=64*2)
resnet18 = ResNet(BasicBlock, 18)
x = paddle.rand([1, 3, 224, 224])
out = resnet18(x)

print(out.shape)
COPY-FROM: paddle.vision.models.ResNet
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnet101_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnet101

.. py:function:: paddle.vision.models.resnet101(pretrained=False, **kwargs)
101层的resnet模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。
101 层的 ResNet 模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnet101模型,Layer的实例。

101 层的 ResNet 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnet101
# build model
model = resnet101()
# build model and load imagenet pretrained weight
# model = resnet101(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnet101
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnet152_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnet152

.. py:function:: paddle.vision.models.resnet152(pretrained=False, **kwargs)
152层的resnet模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。
152 层的 ResNet 模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnet152模型,Layer的实例。

152 层的 ResNet 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnet152
# build model
model = resnet152()
# build model and load imagenet pretrained weight
# model = resnet152(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnet152
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnet18_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnet18

.. py:function:: paddle.vision.models.resnet18(pretrained=False, **kwargs)
18层的resnet模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。
18 层的 ResNet 模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnet18模型,Layer的实例。

18 层的 ResNet 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnet18
# build model
model = resnet18()
# build model and load imagenet pretrained weight
# model = resnet18(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnet18
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnet34_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnet34

.. py:function:: paddle.vision.models.resnet34(pretrained=False, **kwargs)
34层的resnet模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。
34 层的 ResNet 模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnet34模型,Layer的实例。

34 层的 ResNet 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnet34
# build model
model = resnet34()
# build model and load imagenet pretrained weight
# model = resnet34(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnet34
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnet50_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnet50

.. py:function:: paddle.vision.models.resnet50(pretrained=False, **kwargs)
50层的resnet模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。
50 层的 ResNet 模型,来自论文 `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnet50模型,Layer的实例。

50 层的 ResNet 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnet50
# build model
model = resnet50()
# build model and load imagenet pretrained weight
# model = resnet50(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnet50
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnext101_32x4d_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnext101_32x4d

.. py:function:: paddle.vision.models.resnext101_32x4d(pretrained=False, **kwargs)
ResNeXt-101 32x4d模型,来自论文 `"Aggregated Residual Transformations for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ 。
ResNeXt-101 32x4d 模型,来自论文 `"Aggregated Residual Transformations for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnext101_32x4d模型,Layer的实例。

ResNeXt-101 32x4d 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnext101_32x4d
# build model
model = resnext101_32x4d()
# build model and load imagenet pretrained weight
# model = resnext101_32x4d(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnext101_32x4d
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnext101_64x4d_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnext101_64x4d

.. py:function:: paddle.vision.models.resnext101_64x4d(pretrained=False, **kwargs)
ResNeXt-101 64x4d模型,来自论文 `"Aggregated Residual Transformations for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ 。
ResNeXt-101 64x4d 模型,来自论文 `"Aggregated Residual Transformations for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnext101_64x4d模型,Layer的实例。

ResNeXt-101 64x4d 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnext101_64x4d
# build model
model = resnext101_64x4d()
# build model and load imagenet pretrained weight
# model = resnext101_64x4d(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnext101_64x4d
24 changes: 7 additions & 17 deletions docs/api/paddle/vision/models/resnext152_32x4d_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ resnext152_32x4d

.. py:function:: paddle.vision.models.resnext152_32x4d(pretrained=False, **kwargs)
ResNeXt-152 32x4d模型,来自论文 `"Aggregated Residual Transformations for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ 。
ResNeXt-152 32x4d 模型,来自论文 `"Aggregated Residual Transformations for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_ 。

参数
:::::::::
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。

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

返回
:::::::::
resnext152_32x4d模型,Layer的实例。

ResNeXt-152 32x4d 模型,:ref:`cn_api_fluid_dygraph_Layer` 的实例。

代码示例
:::::::::
.. code-block:: python
import paddle
from paddle.vision.models import resnext152_32x4d
# build model
model = resnext152_32x4d()
# build model and load imagenet pretrained weight
# model = resnext152_32x4d(pretrained=True)
x = paddle.rand([1, 3, 224, 224])
out = model(x)

print(out.shape)
COPY-FROM: paddle.vision.models.resnext152_32x4d
Loading

0 comments on commit db134a6

Please sign in to comment.