From ecfd3a04ba1574bbe993e186050a423f25afad49 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Thu, 20 Oct 2022 12:48:20 +0800 Subject: [PATCH] add cn doc for RandomPerspective and perspective (#5353) --- .../transforms/RandomPerspective_cn.rst | 42 +++++++++++++++++++ .../vision/transforms/perspective_cn.rst | 35 ++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 docs/api/paddle/vision/transforms/RandomPerspective_cn.rst create mode 100644 docs/api/paddle/vision/transforms/perspective_cn.rst diff --git a/docs/api/paddle/vision/transforms/RandomPerspective_cn.rst b/docs/api/paddle/vision/transforms/RandomPerspective_cn.rst new file mode 100644 index 00000000000..0284cf14225 --- /dev/null +++ b/docs/api/paddle/vision/transforms/RandomPerspective_cn.rst @@ -0,0 +1,42 @@ +.. _cn_api_vision_transforms_RandomPerspective: + +RandomPerspective +------------------------------- + +.. py:class:: paddle.vision.transforms.RandomPerspective(prob=0.5, distortion_scale=0.5, interpolation='nearest', fill=0, keys=None) + +按照一定概率对图片进行透视变换。 + +参数 +:::::::::::: + - **prob** (float,可选) - 进行透视变换的概率,范围为 [0, 1] 。默认值: 0.5 。 + - **distortion_scale** (float,可选) - 图片失真程度的大小,范围为 [0, 1] 。默认值: 0.5 。 + - **interpolation** (str,可选) - 插值的方法。 + 如果这个参数没有设定或者输入图像为单通道,则该参数会根据使用的后端,被设置为 ``PIL.Image.NEAREST`` 或者 ``cv2.INTER_NEAREST`` 。 + 当使用 ``pil`` 作为后端时, 支持的插值方法如下: + - "nearest": Image.NEAREST + - "bilinear": Image.BILINEAR + - "bicubic": Image.BICUBIC + 当使用 ``cv2`` 作为后端时, 支持的插值方法如下: + - "nearest": cv2.INTER_NEAREST + - "bilinear": cv2.INTER_LINEAR + - "bicubic": cv2.INTER_CUBIC + - **fill** (int|list|tuple,可选) - 对图像扩展时填充的值。默认值: 0 ,如果只设定一个数字则所有通道上像素值均为该值。 + - **keys** (list[str]|tuple[str],可选) - 与 ``BaseTransform`` 定义一致。默认值: None 。 + +形状 +:::::::::::: + + - img (PIL.Image|np.ndarray|Paddle.Tensor) - 输入的图像数据,数据格式为 [H, W, C] 。 + - output (PIL.Image|np.ndarray|Paddle.Tensor) - 返回随机透视变换后的图像数据。 + +返回 +:::::::::::: + + 计算 ``RandomPerspective`` 的可调用对象。 + + +代码示例 +:::::::::::: + +COPY-FROM: paddle.vision.transforms.RandomPerspective diff --git a/docs/api/paddle/vision/transforms/perspective_cn.rst b/docs/api/paddle/vision/transforms/perspective_cn.rst new file mode 100644 index 00000000000..a532f99ffe1 --- /dev/null +++ b/docs/api/paddle/vision/transforms/perspective_cn.rst @@ -0,0 +1,35 @@ +.. _cn_api_vision_transforms_perspective: + +perspective +------------------------------- + +.. py:function:: paddle.vision.transforms.perspective(img, startpoints, endpoints, interpolation='nearest', fill=0) + +对图像进行透视变换。 + +参数 +:::::::::::: + - **img** (PIL.Image|numpy.ndarray|paddle.Tensor) - 输入图像。 + - **startpoints** (list(list(float))) - 在原图上的四个角(左上、右上、右下、左下)的坐标。 + - **endpoints** (list(list(float))) - 在变换后的图上的四个角(左上、右上、右下、左下)的坐标。 + - **interpolation** (str,可选) - 插值的方法。 + 如果这个参数没有设定或者输入图像为单通道,则该参数会根据使用的后端,被设置为 ``PIL.Image.NEAREST`` 或者 ``cv2.INTER_NEAREST`` 。 + 当使用 ``pil`` 作为后端时, 支持的插值方法如下: + - "nearest": Image.NEAREST + - "bilinear": Image.BILINEAR + - "bicubic": Image.BICUBIC + 当使用 ``cv2`` 作为后端时, 支持的插值方法如下: + - "nearest": cv2.INTER_NEAREST + - "bilinear": cv2.INTER_LINEAR + - "bicubic": cv2.INTER_CUBIC + - **fill** (int|list|tuple,可选) - 对图像扩展时填充的像素值,默认值: 0 ,如果只设定一个数字则所有通道上像素值均为该值。 + +返回 +:::::::::::: + + ``PIL.Image 或 numpy ndarray 或 paddle.Tensor`` ,透视变换后的图像。 + +代码示例 +:::::::::::: + +COPY-FROM: paddle.vision.transforms.perspective