Skip to content

Commit ad861a3

Browse files
authored
[PaddlePaddle Hackathon] add ShuffleNet zh doc (#3924)
* add shufflenet * refine docs * add shufflenetv2 into overview * add parameter with_pool * trigger CI
1 parent 0f908ff commit ad861a3

File tree

9 files changed

+279
-0
lines changed

9 files changed

+279
-0
lines changed

docs/api/paddle/vision/Overview_cn.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ paddle.vision 目录是飞桨在视觉领域的高层API。具体如下:
7171
" :ref:`inception_v3 <cn_api_paddle_vision_models_inception_v3>` ", "InceptionV3模型"
7272
" :ref:`GoogLeNet <cn_api_paddle_vision_models_GoogLeNet>` ", "GoogLeNet模型"
7373
" :ref:`googlenet <cn_api_paddle_vision_models_googlenet>` ", "GoogLeNet模型"
74+
" :ref:`ShuffleNetV2 <cn_api_paddle_vision_models_ShuffleNetV2>` ", "ShuffleNetV2模型"
75+
" :ref:`shufflenet_v2_x0_25 <cn_api_paddle_vision_models_shufflenet_v2_x0_25>` ", "输出通道缩放比例为 0.25 的 ShuffleNetV2 模型"
76+
" :ref:`shufflenet_v2_x0_33 <cn_api_paddle_vision_models_shufflenet_v2_x0_33>` ", "输出通道缩放比例为 0.33 的 ShuffleNetV2 模型"
77+
" :ref:`shufflenet_v2_x0_5 <cn_api_paddle_vision_models_shufflenet_v2_x0_5>` ", "输出通道缩放比例为 0.5 的 ShuffleNetV2 模型"
78+
" :ref:`shufflenet_v2_x1_0 <cn_api_paddle_vision_models_shufflenet_v2_x1_0>` ", "输出通道缩放比例为 1.0 的 ShuffleNetV2 模型"
79+
" :ref:`shufflenet_v2_x1_5 <cn_api_paddle_vision_models_shufflenet_v2_x1_5>` ", "输出通道缩放比例为 1.5 的 ShuffleNetV2 模型"
80+
" :ref:`shufflenet_v2_x2_0 <cn_api_paddle_vision_models_shufflenet_v2_x2_0>` ", "输出通道缩放比例为 2.0 的 ShuffleNetV2 模型"
81+
" :ref:`shufflenet_v2_swish <cn_api_paddle_vision_models_shufflenet_v2_swish>` ", "使用 swish 进行激活的 ShuffleNetV2 模型"
7482

7583

7684
.. _about_ops:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. _cn_api_paddle_vision_models_ShuffleNetV2:
2+
3+
ShuffleNetV2
4+
-------------------------------
5+
6+
.. py:class:: paddle.vision.models.ShuffleNetV2(scale=1.0, act="relu", num_classes=1000, with_pool=True)
7+
8+
ShuffleNetV2模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **scale** (float,可选) - 模型通道数的缩放比例。默认值:1.0。
13+
- **act** (str, 可选) - 网络中使用的激活函数。默认值:"relu"。
14+
- **num_classes** (int, 可选) - 最后一个全连接层输出的维度。如果该值小于0,则不定义最后一个全连接层。默认值:1000。
15+
- **with_pool** (bool,可选) - 是否定义最后一个全连接层之前的池化层。默认值:True。
16+
17+
返回
18+
:::::::::
19+
ShuffleNetV2模型,Layer的实例。
20+
21+
代码示例
22+
:::::::::
23+
.. code-block:: python
24+
25+
import paddle
26+
from paddle.vision.models import ShuffleNetV2
27+
28+
shufflenet_v2_swish = ShuffleNetV2(scale=1.0, act="swish")
29+
30+
x = paddle.rand([1, 3, 224, 224])
31+
out = shufflenet_v2_swish(x)
32+
33+
print(out.shape)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _cn_api_paddle_vision_models_shufflenet_v2_swish:
2+
3+
shufflenet_v2_swish
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.models.shufflenet_v2_swish(pretrained=False, **kwargs)
7+
8+
使用 swish 进行激活的 ShuffleNetV2 模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。
13+
14+
返回
15+
:::::::::
16+
shufflenet_v2_swish模型,Layer的实例。
17+
18+
代码示例
19+
:::::::::
20+
.. code-block:: python
21+
22+
import paddle
23+
from paddle.vision.models import shufflenet_v2_swish
24+
25+
# build model
26+
model = shufflenet_v2_swish()
27+
28+
# build model and load imagenet pretrained weight
29+
# model = shufflenet_v2_swish(pretrained=True)
30+
31+
x = paddle.rand([1, 3, 224, 224])
32+
out = model(x)
33+
34+
print(out.shape)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _cn_api_paddle_vision_models_shufflenet_v2_x0_25:
2+
3+
shufflenet_v2_x0_25
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.models.shufflenet_v2_x0_25(pretrained=False, **kwargs)
7+
8+
输出通道缩放比例为 0.25 的 ShuffleNetV2 模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。
13+
14+
返回
15+
:::::::::
16+
shufflenet_v2_x0_25模型,Layer的实例。
17+
18+
代码示例
19+
:::::::::
20+
.. code-block:: python
21+
22+
import paddle
23+
from paddle.vision.models import shufflenet_v2_x0_25
24+
25+
# build model
26+
model = shufflenet_v2_x0_25()
27+
28+
# build model and load imagenet pretrained weight
29+
# model = shufflenet_v2_x0_25(pretrained=True)
30+
31+
x = paddle.rand([1, 3, 224, 224])
32+
out = model(x)
33+
34+
print(out.shape)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _cn_api_paddle_vision_models_shufflenet_v2_x0_33:
2+
3+
shufflenet_v2_x0_33
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.models.shufflenet_v2_x0_33(pretrained=False, **kwargs)
7+
8+
输出通道缩放比例为 0.25 的 ShuffleNetV2 模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。
13+
14+
返回
15+
:::::::::
16+
shufflenet_v2_x0_33模型,Layer的实例。
17+
18+
代码示例
19+
:::::::::
20+
.. code-block:: python
21+
22+
import paddle
23+
from paddle.vision.models import shufflenet_v2_x0_33
24+
25+
# build model
26+
model = shufflenet_v2_x0_33()
27+
28+
# build model and load imagenet pretrained weight
29+
# model = shufflenet_v2_x0_33(pretrained=True)
30+
31+
x = paddle.rand([1, 3, 224, 224])
32+
out = model(x)
33+
34+
print(out.shape)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _cn_api_paddle_vision_models_shufflenet_v2_x0_5:
2+
3+
shufflenet_v2_x0_5
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.models.shufflenet_v2_x0_5(pretrained=False, **kwargs)
7+
8+
输出通道缩放比例为 0.5 的 ShuffleNetV2 模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。
13+
14+
返回
15+
:::::::::
16+
shufflenet_v2_x0_5模型,Layer的实例。
17+
18+
代码示例
19+
:::::::::
20+
.. code-block:: python
21+
22+
import paddle
23+
from paddle.vision.models import shufflenet_v2_x0_5
24+
25+
# build model
26+
model = shufflenet_v2_x0_5()
27+
28+
# build model and load imagenet pretrained weight
29+
# model = shufflenet_v2_x0_5(pretrained=True)
30+
31+
x = paddle.rand([1, 3, 224, 224])
32+
out = model(x)
33+
34+
print(out.shape)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _cn_api_paddle_vision_models_shufflenet_v2_x1_0:
2+
3+
shufflenet_v2_x1_0
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.models.shufflenet_v2_x1_0(pretrained=False, **kwargs)
7+
8+
输出通道缩放比例为 1.0 的 ShuffleNetV2 模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。
13+
14+
返回
15+
:::::::::
16+
shufflenet_v2_x1_0模型,Layer的实例。
17+
18+
代码示例
19+
:::::::::
20+
.. code-block:: python
21+
22+
import paddle
23+
from paddle.vision.models import shufflenet_v2_x1_0
24+
25+
# build model
26+
model = shufflenet_v2_x1_0()
27+
28+
# build model and load imagenet pretrained weight
29+
# model = shufflenet_v2_x1_0(pretrained=True)
30+
31+
x = paddle.rand([1, 3, 224, 224])
32+
out = model(x)
33+
34+
print(out.shape)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _cn_api_paddle_vision_models_shufflenet_v2_x1_5:
2+
3+
shufflenet_v2_x1_5
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.models.shufflenet_v2_x1_5(pretrained=False, **kwargs)
7+
8+
输出通道缩放比例为 1.5 的 ShuffleNetV2 模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。
13+
14+
返回
15+
:::::::::
16+
shufflenet_v2_x1_5模型,Layer的实例。
17+
18+
代码示例
19+
:::::::::
20+
.. code-block:: python
21+
22+
import paddle
23+
from paddle.vision.models import shufflenet_v2_x1_5
24+
25+
# build model
26+
model = shufflenet_v2_x1_5()
27+
28+
# build model and load imagenet pretrained weight
29+
# model = shufflenet_v2_x1_5(pretrained=True)
30+
31+
x = paddle.rand([1, 3, 224, 224])
32+
out = model(x)
33+
34+
print(out.shape)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _cn_api_paddle_vision_models_shufflenet_v2_x2_0:
2+
3+
shufflenet_v2_x2_0
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.models.shufflenet_v2_x2_0(pretrained=False, **kwargs)
7+
8+
输出通道缩放比例为 2.0 的 ShuffleNetV2 模型,来自论文 `"ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design" <https://arxiv.org/pdf/1807.11164.pdf>`_ 。
9+
10+
参数
11+
:::::::::
12+
- **pretrained** (bool,可选) - 是否加载在imagenet数据集上的预训练权重。默认值:False。
13+
14+
返回
15+
:::::::::
16+
shufflenet_v2_x2_0模型,Layer的实例。
17+
18+
代码示例
19+
:::::::::
20+
.. code-block:: python
21+
22+
import paddle
23+
from paddle.vision.models import shufflenet_v2_x2_0
24+
25+
# build model
26+
model = shufflenet_v2_x2_0()
27+
28+
# build model and load imagenet pretrained weight
29+
# model = shufflenet_v2_x2_0(pretrained=True)
30+
31+
x = paddle.rand([1, 3, 224, 224])
32+
out = model(x)
33+
34+
print(out.shape)

0 commit comments

Comments
 (0)