From 0186db310b46e83b8e01ab032423dc299dd40f18 Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Mon, 21 Sep 2020 09:52:06 +0000 Subject: [PATCH] add return description. test=develop --- .../paddle/vision/datasets/Cifar100_cn.rst | 2 +- .../api/paddle/vision/datasets/Cifar10_cn.rst | 2 +- .../api/paddle/vision/datasets/Flowers_cn.rst | 2 +- .../api/paddle/vision/datasets/MNIST_cn.rst | 2 +- .../api/paddle/vision/datasets/VOC2012_cn.rst | 2 +- .../datasets/folder/DatasetFolder_cn.rst | 54 ------------------- .../vision/datasets/folder/ImageFolder_cn.rst | 50 ----------------- 7 files changed, 5 insertions(+), 109 deletions(-) delete mode 100644 doc/paddle/api/paddle/vision/datasets/folder/DatasetFolder_cn.rst delete mode 100644 doc/paddle/api/paddle/vision/datasets/folder/ImageFolder_cn.rst diff --git a/doc/paddle/api/paddle/vision/datasets/Cifar100_cn.rst b/doc/paddle/api/paddle/vision/datasets/Cifar100_cn.rst index eb893227f..c6e6aed6b 100644 --- a/doc/paddle/api/paddle/vision/datasets/Cifar100_cn.rst +++ b/doc/paddle/api/paddle/vision/datasets/Cifar100_cn.rst @@ -18,7 +18,7 @@ Cifar100 返回 ::::::::: - Cifar100数据集实例 + Cifar100数据集实例,包含image和label两个字段,image数据形状为[3, 32, 32],label数据形状为[1] 代码示例 ::::::::: diff --git a/doc/paddle/api/paddle/vision/datasets/Cifar10_cn.rst b/doc/paddle/api/paddle/vision/datasets/Cifar10_cn.rst index 2ee4e8407..3fa291073 100644 --- a/doc/paddle/api/paddle/vision/datasets/Cifar10_cn.rst +++ b/doc/paddle/api/paddle/vision/datasets/Cifar10_cn.rst @@ -18,7 +18,7 @@ Cifar10 返回 ::::::::: - Cifar10数据集实例 + Cifar10数据集实例,包含image和label两个字段,image数据形状为[3, 32, 32],label数据形状为[1] 代码示例 ::::::::: diff --git a/doc/paddle/api/paddle/vision/datasets/Flowers_cn.rst b/doc/paddle/api/paddle/vision/datasets/Flowers_cn.rst index f0a03968f..b2a1de11d 100644 --- a/doc/paddle/api/paddle/vision/datasets/Flowers_cn.rst +++ b/doc/paddle/api/paddle/vision/datasets/Flowers_cn.rst @@ -20,7 +20,7 @@ Flowers 返回 ::::::::: - Flowers数据集实例 + Flowers数据集实例,包含image和label两个字段,image数据形状为图像尺寸,label数据形状为[1] 代码示例 ::::::::: diff --git a/doc/paddle/api/paddle/vision/datasets/MNIST_cn.rst b/doc/paddle/api/paddle/vision/datasets/MNIST_cn.rst index adc34582f..0bcae7727 100644 --- a/doc/paddle/api/paddle/vision/datasets/MNIST_cn.rst +++ b/doc/paddle/api/paddle/vision/datasets/MNIST_cn.rst @@ -18,7 +18,7 @@ MNIST 返回 ::::::::: - MNIST数据集实例 + MNIST数据集实例,包含image和label两个字段,image数据形状为[1, 28, 28], label数据形状为[1]。 代码示例 ::::::::: diff --git a/doc/paddle/api/paddle/vision/datasets/VOC2012_cn.rst b/doc/paddle/api/paddle/vision/datasets/VOC2012_cn.rst index 2ab458a02..0b40d1bf7 100644 --- a/doc/paddle/api/paddle/vision/datasets/VOC2012_cn.rst +++ b/doc/paddle/api/paddle/vision/datasets/VOC2012_cn.rst @@ -20,7 +20,7 @@ VOC2012 返回 ::::::::: - VOC2012数据集实例 + VOC2012数据集实例,包含image和label两个字段,数据形状均为图像尺寸。 代码示例 ::::::::: diff --git a/doc/paddle/api/paddle/vision/datasets/folder/DatasetFolder_cn.rst b/doc/paddle/api/paddle/vision/datasets/folder/DatasetFolder_cn.rst deleted file mode 100644 index 89259a14d..000000000 --- a/doc/paddle/api/paddle/vision/datasets/folder/DatasetFolder_cn.rst +++ /dev/null @@ -1,54 +0,0 @@ -.. _cn_api_paddle_vision_datasets_DatasetFolder: - -DatasetFolder -------------------------------- - -.. py:class:: paddle.vision.datasets.DatasetFolder(root, loader=None, extensions=None, transform=None, is_valid_file=None) - - 一种通用的数据加载方式,当输入以如下的格式存放时: - root/class_a/1.ext - root/class_a/2.ext - root/class_a/3.ext - - root/class_b/123.ext - root/class_b/456.ext - root/class_b/789.ext - -参数: - - **root** (str) - 根目录路径。 - - **loader** (callable,可选) - 可以加载数据路径的一个函数,如果该值没有设定,默认使用 ``cv2.imread`` 。默认值:None。 - - **extensions** (tuple[str],可选) - 允许的数据后缀列表,如果该值没有设定,默认使用 ``('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif', '.tiff', '.webp')`` 。默认值:None。 - - **transform** (callable,可选) - 数据增强函数。默认值:None。 - - **is_valid_file** (callable,可选) - 根据每条数据的路径来判断是否合法的一个函数。默认值:None。 - - -**代码示例**: - -.. code-block:: python - - import os - import cv2 - import tempfile - import shutil - import numpy as np - from paddle.vision.datasets import DatasetFolder - - def make_fake_dir(): - data_dir = tempfile.mkdtemp() - - for i in range(2): - sub_dir = os.path.join(data_dir, 'class_' + str(i)) - if not os.path.exists(sub_dir): - os.makedirs(sub_dir) - for j in range(2): - fake_img = (np.random.random((32, 32, 3)) * 255).astype('uint8') - cv2.imwrite(os.path.join(sub_dir, str(j) + '.jpg'), fake_img) - return data_dir - - temp_dir = make_fake_dir() - data_folder = DatasetFolder(temp_dir) - - for items in data_folder: - break - - shutil.rmtree(temp_dir) diff --git a/doc/paddle/api/paddle/vision/datasets/folder/ImageFolder_cn.rst b/doc/paddle/api/paddle/vision/datasets/folder/ImageFolder_cn.rst deleted file mode 100644 index 37571e124..000000000 --- a/doc/paddle/api/paddle/vision/datasets/folder/ImageFolder_cn.rst +++ /dev/null @@ -1,50 +0,0 @@ -.. _cn_api_paddle_vision_datasets_ImageFolder: - -ImageFolder -------------------------------- - -.. py:class:: paddle.vision.datasets.ImageFolder(root, loader=None, extensions=None, transform=None, is_valid_file=None) - - 一种通用的数据加载方式,当输入以如下的格式存放时: - root/1.ext - root/2.ext - root/sub_dir/3.ext - -参数: - - **root** (str) - 根目录路径。 - - **loader** (callable,可选) - 可以加载数据路径的一个函数,如果该值没有设定,默认使用 ``cv2.imread`` 。默认值:None。 - - **extensions** (tuple[str],可选) - 允许的数据后缀列表,如果该值没有设定,默认使用 ``('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif', '.tiff', '.webp')`` 。默认值:None。 - - **transform** (callable,可选) - 数据增强函数。默认值:None。 - - **is_valid_file** (callable,可选) - 根据每条数据的路径来判断是否合法的一个函数。默认值:None。 - - -**代码示例**: - -.. code-block:: python - - import os - import cv2 - import tempfile - import shutil - import numpy as np - from paddle.vision.datasets import ImageFolder - - def make_fake_dir(): - data_dir = tempfile.mkdtemp() - - for i in range(2): - sub_dir = os.path.join(data_dir, 'class_' + str(i)) - if not os.path.exists(sub_dir): - os.makedirs(sub_dir) - for j in range(2): - fake_img = (np.random.random((32, 32, 3)) * 255).astype('uint8') - cv2.imwrite(os.path.join(sub_dir, str(j) + '.jpg'), fake_img) - return data_dir - - temp_dir = make_fake_dir() - data_folder = ImageFolder(temp_dir) - - for items in data_folder: - break - - shutil.rmtree(temp_dir) -- GitLab