-
Notifications
You must be signed in to change notification settings - Fork 5.9k
fix en docs of paddle.vision.transforms.Normalize, paddle.vision.models.alexnet, paddle.vision.models.mobilenet, ops apis #42380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bfff0a7
3490ea5
a67eb00
a911302
e35a338
fc6efd9
edffa60
1e4efae
946dadd
717c851
c37cf1f
f34ceb7
55ac012
1602d7b
7bdd26a
7d3f53f
a77f8bf
cfca125
84035b8
661babb
acddea7
0f2f6ba
e853cf5
1023256
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. | ||
| # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
|
|
@@ -75,14 +75,14 @@ class MobileNetV2(nn.Layer): | |
| `"MobileNetV2: Inverted Residuals and Linear Bottlenecks" <https://arxiv.org/abs/1801.04381>`_. | ||
|
|
||
| Args: | ||
| scale (float): scale of channels in each layer. Default: 1.0. | ||
| num_classes (int): output dim of last fc layer. If num_classes <=0, last fc layer | ||
| scale (float, optional): scale of channels in each layer. Default: 1.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): use pool before the last fc layer or not. Default: True. | ||
| with_pool (bool, optional): use pool before the last fc layer or not. Default: True. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这三个参数也都是optional哦 |
||
| Examples: | ||
| .. code-block:: python | ||
|
|
||
| :name: code-example1 | ||
| import paddle | ||
| from paddle.vision.models import MobileNetV2 | ||
|
|
||
|
|
@@ -92,6 +92,7 @@ class MobileNetV2(nn.Layer): | |
| out = model(x) | ||
|
|
||
| print(out.shape) | ||
| # [1, 1000] | ||
| """ | ||
|
|
||
| def __init__(self, scale=1.0, num_classes=1000, with_pool=True): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,13 +33,15 @@ class VGG(nn.Layer): | |
|
|
||
| Args: | ||
| features (nn.Layer): Vgg features create by function make_layers. | ||
| num_classes (int): Output dim of last fc layer. If num_classes <=0, last fc layer | ||
| 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): Use pool before the last three fc layer or not. Default: True. | ||
| with_pool (bool, optional): Use pool before the last three fc layer or not. Default: True. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 后两个参数是optional哦 |
||
| Examples: | ||
| .. code-block:: python | ||
| :name: code-example | ||
|
|
||
| import paddle | ||
| from paddle.vision.models import VGG | ||
| from paddle.vision.models.vgg import make_layers | ||
|
|
||
|
|
@@ -49,6 +51,12 @@ class VGG(nn.Layer): | |
|
|
||
| vgg11 = VGG(features) | ||
|
|
||
| x = paddle.rand([1, 3, 224, 224]) | ||
| out = vgg11(x) | ||
|
|
||
| print(out.shape) | ||
| # [1, 1000] | ||
|
|
||
| """ | ||
|
|
||
| def __init__(self, features, num_classes=1000, with_pool=True): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -951,7 +951,7 @@ def psroi_pool(x, boxes, boxes_num, output_size, spatial_scale=1.0, name=None): | |
| boxes_num (Tensor): The number of boxes contained in each picture in the batch. | ||
| output_size (int|Tuple(int, int)) The pooled output size(H, W), data type | ||
| is int32. If int, H and W are both equal to output_size. | ||
| spatial_scale (float): Multiplicative spatial scale factor to translate ROI coords from their | ||
| spatial_scale (float, optional): Multiplicative spatial scale factor to translate ROI coords from their | ||
| input scale to the scale used when pooling. Default: 1.0 | ||
| name(str, optional): The default value is None. | ||
| Normally there is no need for user to set this property. | ||
|
|
@@ -963,12 +963,15 @@ def psroi_pool(x, boxes, boxes_num, output_size, spatial_scale=1.0, name=None): | |
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spatial_scale是可选参数 |
||
| Examples: | ||
| .. code-block:: python | ||
|
|
||
| :name: code-example1 | ||
|
|
||
| import paddle | ||
| x = paddle.uniform([2, 490, 28, 28], dtype='float32') | ||
| boxes = paddle.to_tensor([[1, 5, 8, 10], [4, 2, 6, 7], [12, 12, 19, 21]], dtype='float32') | ||
| boxes_num = paddle.to_tensor([1, 2], dtype='int32') | ||
| pool_out = paddle.vision.ops.psroi_pool(x, boxes, boxes_num, 7, 1.0) | ||
| print(pool_out.shape) | ||
| # [3, 10, 7, 7] | ||
| """ | ||
|
|
||
| check_type(output_size, 'output_size', (int, tuple, list), 'psroi_pool') | ||
|
|
@@ -1014,7 +1017,7 @@ class PSRoIPool(Layer): | |
| Args: | ||
| output_size (int|Tuple(int, int)) The pooled output size(H, W), data type | ||
| is int32. If int, H and W are both equal to output_size. | ||
| spatial_scale (float): Multiplicative spatial scale factor to translate ROI coords from their | ||
| spatial_scale (float, optional): Multiplicative spatial scale factor to translate ROI coords from their | ||
| input scale to the scale used when pooling. Default: 1.0. | ||
|
|
||
| Shape: | ||
|
|
@@ -1025,19 +1028,19 @@ class PSRoIPool(Layer): | |
| The output_channels equal to C / (pooled_h * pooled_w), where C is the channels of input. | ||
|
|
||
| Returns: | ||
| None | ||
| None. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Examples: | ||
| .. code-block:: python | ||
|
|
||
| :name: code-example1 | ||
| import paddle | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 示例代码增加一些输出数据展示? |
||
|
|
||
| psroi_module = paddle.vision.ops.PSRoIPool(7, 1.0) | ||
| x = paddle.uniform([2, 490, 28, 28], dtype='float32') | ||
| boxes = paddle.to_tensor([[1, 5, 8, 10], [4, 2, 6, 7], [12, 12, 19, 21]], dtype='float32') | ||
| boxes_num = paddle.to_tensor([1, 2], dtype='int32') | ||
| pool_out = psroi_module(x, boxes, boxes_num) | ||
|
|
||
| print(pool_out.shape) # [3, 10, 7, 7] | ||
| """ | ||
|
|
||
| def __init__(self, output_size, spatial_scale=1.0): | ||
|
|
@@ -1187,7 +1190,7 @@ def roi_align(x, | |
| aligned=True, | ||
| name=None): | ||
| """ | ||
| This operator implements the roi_align layer. | ||
| Implementing the roi_align layer. | ||
| Region of Interest (RoI) Align operator (also known as RoI Align) is to | ||
| perform bilinear interpolation on inputs of nonuniform sizes to obtain | ||
| fixed-size feature maps (e.g. 7*7), as described in Mask R-CNN. | ||
|
|
@@ -1211,31 +1214,31 @@ def roi_align(x, | |
| the batch, the data type is int32. | ||
| output_size (int or Tuple[int, int]): The pooled output size(h, w), data | ||
| type is int32. If int, h and w are both equal to output_size. | ||
| spatial_scale (float32): Multiplicative spatial scale factor to translate | ||
| spatial_scale (float32, optional): Multiplicative spatial scale factor to translate | ||
| ROI coords from their input scale to the scale used when pooling. | ||
| Default: 1.0 | ||
| sampling_ratio (int32): number of sampling points in the interpolation | ||
| Default: 1.0. | ||
| sampling_ratio (int32, optional): number of sampling points in the interpolation | ||
| grid used to compute the output value of each pooled output bin. | ||
| If > 0, then exactly ``sampling_ratio x sampling_ratio`` sampling | ||
| points per bin are used. | ||
| If <= 0, then an adaptive number of grid points are used (computed | ||
| as ``ceil(roi_width / output_width)``, and likewise for height). | ||
| Default: -1 | ||
| aligned (bool): If False, use the legacy implementation. If True, pixel | ||
| Default: -1. | ||
| aligned (bool, optional): If False, use the legacy implementation. If True, pixel | ||
| shift the box coordinates it by -0.5 for a better alignment with the | ||
| two neighboring pixel indices. This version is used in Detectron2. | ||
| Default: True | ||
| Default: True. | ||
| name(str, optional): For detailed information, please refer to : | ||
| ref:`api_guide_Name`. Usually name is no need to set and None by | ||
| default. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Returns: | ||
| Tensor: The output of ROIAlignOp is a 4-D tensor with shape (num_boxes, | ||
| The output of ROIAlignOp is a 4-D tensor with shape (num_boxes, | ||
| channels, pooled_h, pooled_w). The data type is float32 or float64. | ||
|
|
||
| Examples: | ||
| .. code-block:: python | ||
|
|
||
| :name: code-example1 | ||
| import paddle | ||
| from paddle.vision.ops import roi_align | ||
|
|
||
|
|
@@ -1306,12 +1309,12 @@ class RoIAlign(Layer): | |
| when pooling. Default: 1.0 | ||
|
|
||
| Returns: | ||
| align_out (Tensor): The output of ROIAlign operator is a 4-D tensor with | ||
| The output of ROIAlign operator is a 4-D tensor with | ||
| shape (num_boxes, channels, pooled_h, pooled_w). | ||
|
|
||
| Examples: | ||
| .. code-block:: python | ||
|
|
||
| :name: code-example1 | ||
| import paddle | ||
| from paddle.vision.ops import RoIAlign | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这三个参数都是optional哦