Skip to content

Conversation

@liyongchao911
Copy link
Contributor

@liyongchao911 liyongchao911 commented May 6, 2022

  1. correct the default value of padding, None(was 0)
  2. add annotation for the parameter fill and padding_mode, ref pad api
  3. use copy-from function for the code example

PADDLEPADDLE_PR=42428

-------------------------------

.. py:class:: paddle.vision.transforms.RandomCrop(size, padding=0, pad_if_needed=False, keys=None)
.. py:class:: paddle.vision.transforms.RandomCrop(size, padding=None, pad_if_needed=False, keys=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要加上fill和padding_mode两个参数

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

- padding (int|sequence,可选) - 对图像四周外边进行填充,如果提供了长度为4的序列,则将其分别用于填充左边界,上边界,右边界和下边界。 默认值:None,不填充。
- pad_if_needed (boolean,可选) - 如果裁剪后的图像小于期望的大小时,是否对裁剪后的图像进行填充,以避免引发异常,默认值:False,保持初次裁剪后的大小,不填充。
- fill (float|tuple, 可选) - 用于填充的像素值。仅当padding_mode为constant时参数值有效。 默认值:0。 如果参数值是一个长度为3的元组,则会分别用于填充R,G,B通道。
- padding_mode (string,可选) - 填充模式。支持: constant, edge, reflect 或 symmetric。 默认值:constant。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

  • 预览格式有点乱掉了,前后加上空行试一下
  • 数据不需要加

- ``symmetric`` 表示使用原图像的镜像值进行填充(使用边缘上的值);比如:使用该模式对 ``[1, 2, 3, 4]`` 的两端分别填充2个值,结果是 ``[2, 1, 1, 2, 3, 4, 4, 3]``。
- keys (list[str]|tuple[str],可选) - 与 ``BaseTransform`` 定义一致。默认值: None。

形状
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

改成HWC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Collaborator

@Ligoml Ligoml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Ligoml Ligoml merged commit f840638 into PaddlePaddle:develop May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants