未验证 提交 2eac1e60 编写于 作者: K Kaipeng Deng 提交者: GitHub

add vision.dataset doc. test=develop (#2607)

上级 a342aa1f
...@@ -6,20 +6,19 @@ Cifar100 ...@@ -6,20 +6,19 @@ Cifar100
.. py:class:: paddle.vision.datasets.Cifar100() .. py:class:: paddle.vision.datasets.Cifar100()
Implementation of `Cifar-100 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ `Cifar-100 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ 数据集的实现,数据集包含100中类别.
dataset, which has 100 categories.
参数 参数
::::::::: :::::::::
data_file(str): path to data file, can be set None if - data_file (str) - 数据集文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None
:attr:`download` is True. Default None - mode (str) - ``'train'`` ``'test'`` 模式,默认为 ``'train'``
mode(str): 'train', 'test' mode. Default 'train'. - transform (callable) - 图片数据的预处理,若未 ``None`` 即为不做预处理。默认值为None
transform(callable): transform to perform on image, None for on transform. - download (bool) - 是否自定下载数据集文件。默认为 ``True``
download(bool): whether to download dataset automatically if
:attr:`data_file` is not set. Default True
Returns: 返回
Dataset: instance of cifar-100 dataset :::::::::
Cifar100数据集实例
代码示例 代码示例
::::::::: :::::::::
...@@ -57,4 +56,4 @@ Cifar100 ...@@ -57,4 +56,4 @@ Cifar100
image, label = model(image, label) image, label = model(image, label)
print(image.numpy().shape, label.numpy().shape) print(image.numpy().shape, label.numpy().shape)
\ No newline at end of file
...@@ -6,22 +6,21 @@ Cifar10 ...@@ -6,22 +6,21 @@ Cifar10
.. py:class:: paddle.vision.datasets.Cifar10() .. py:class:: paddle.vision.datasets.Cifar10()
Implementation of `Cifar-10 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ `Cifar-10 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ 数据集的实现,数据集包含10中类别.
dataset, which has 10 categories.
参数 参数
::::::::: :::::::::
data_file(str): path to data file, can be set None if - data_file (str) - 数据集文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None
:attr:`download` is True. Default None - mode (str) - ``'train'`` ``'test'`` 模式,默认为 ``'train'``
mode(str): 'train', 'test' mode. Default 'train'. - transform (callable) - 图片数据的预处理,若未 ``None`` 即为不做预处理。默认值为None
transform(callable): transform to perform on image, None for on transform. - download (bool) - 是否自定下载数据集文件。默认为 ``True``
download(bool): whether to download dataset automatically if
:attr:`data_file` is not set. Default True
Returns: 返回
Dataset: instance of cifar-10 dataset :::::::::
Cifar10数据集实例
代码示例 代码示例
::::::::: :::::::::
.. code-block:: python .. code-block:: python
...@@ -46,10 +45,10 @@ Cifar10 ...@@ -46,10 +45,10 @@ Cifar10
normalize = Normalize(mean=[0.5, 0.5, 0.5], normalize = Normalize(mean=[0.5, 0.5, 0.5],
std=[0.5, 0.5, 0.5]) std=[0.5, 0.5, 0.5])
cifar10 = Cifar10(mode='train', transform=normalize) cifar100 = Cifar10(mode='train', transform=normalize)
for i in range(10): for i in range(10):
image, label = cifar10[i] image, label = cifar100[i]
image = paddle.to_tensor(image) image = paddle.to_tensor(image)
label = paddle.to_tensor(label) label = paddle.to_tensor(label)
...@@ -57,4 +56,4 @@ Cifar10 ...@@ -57,4 +56,4 @@ Cifar10
image, label = model(image, label) image, label = model(image, label)
print(image.numpy().shape, label.numpy().shape) print(image.numpy().shape, label.numpy().shape)
\ No newline at end of file
...@@ -6,23 +6,23 @@ Flowers ...@@ -6,23 +6,23 @@ Flowers
.. py:class:: paddle.vision.datasets.Flowers() .. py:class:: paddle.vision.datasets.Flowers()
Implementation of `Flowers <https://www.robots.ox.ac.uk/~vgg/data/flowers/>`_ `Flowers <https://www.robots.ox.ac.uk/~vgg/data/flowers/>`_ 数据集
dataset
参数 参数
::::::::: :::::::::
data_file(str): path to data file, can be set None if - data_file (str) - 数据文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None。
:attr:`download` is True. Default None - label_file (str) - 标签文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None。
label_file(str): path to label file, can be set None if - setid_file (str) - 子数据集下标划分文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None。
:attr:`download` is True. Default None - mode (str) - ``'train'`` 或 ``'test'`` 模式,默认为 ``'train'`` 。
setid_file(str): path to subset index file, can be set - transform (callable) - 作用于图片数据的transform,若未 ``None`` 即为无transform。
None if :attr:`download` is True. Default None - download (bool) - 是否自定下载数据集文件。默认为 ``True`` 。
mode(str): 'train', 'valid' or 'test' mode. Default 'train'.
transform(callable): transform to perform on image, None for on transform. 返回
download(bool): whether to download dataset automatically if :::::::::
:attr:`data_file` is not set. Default True
Flowers数据集实例
代码示例
代码示例
::::::::: :::::::::
.. code-block:: python .. code-block:: python
...@@ -35,4 +35,4 @@ Flowers ...@@ -35,4 +35,4 @@ Flowers
sample = flowers[i] sample = flowers[i]
print(sample[0].shape, sample[1]) print(sample[0].shape, sample[1])
\ No newline at end of file
...@@ -6,24 +6,22 @@ MNIST ...@@ -6,24 +6,22 @@ MNIST
.. py:class:: paddle.vision.datasets.MNIST() .. py:class:: paddle.vision.datasets.MNIST()
Implementation of `MNIST <http://yann.lecun.com/exdb/mnist/>`_ dataset `MNIST <http://yann.lecun.com/exdb/mnist/>`_ 数据集
参数 参数
::::::::: :::::::::
image_path(str): path to image file, can be set None if - image_path (str) - 图像文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None。
:attr:`download` is True. Default None - label_path (str) - 标签文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None。
label_path(str): path to label file, can be set None if - chw_format (bool) - 若为 ``True`` 输出形状为[1, 28, 28], 否则为 [1, 784]。默认值为 ``True`` 。
:attr:`download` is True. Default None - mode (str) - ``'train'`` 或 ``'test'`` 模式,默认为 ``'train'`` 。
chw_format(bool): If set True, the output shape is [1, 28, 28], - download (bool) - 是否自定下载数据集文件。默认为 ``True`` 。
otherwise, output shape is [1, 784]. Default True.
mode(str): 'train' or 'test' mode. Default 'train'. 返回
download(bool): whether to download dataset automatically if :::::::::
:attr:`image_path` :attr:`label_path` is not set. Default True
MNIST数据集实例
Returns:
Dataset: MNIST Dataset. 代码示例
代码示例
::::::::: :::::::::
.. code-block:: python .. code-block:: python
...@@ -36,4 +34,4 @@ MNIST ...@@ -36,4 +34,4 @@ MNIST
sample = mnist[i] sample = mnist[i]
print(sample[0].shape, sample[1]) print(sample[0].shape, sample[1])
\ No newline at end of file
...@@ -6,17 +6,23 @@ VOC2012 ...@@ -6,17 +6,23 @@ VOC2012
.. py:class:: paddle.vision.datasets.VOC2012() .. py:class:: paddle.vision.datasets.VOC2012()
Implementation of `VOC2012 <http://host.robots.ox.ac.uk/pascal/VOC/voc2012/>`_ dataset `VOC2012 <http://host.robots.ox.ac.uk/pascal/VOC/voc2012/>`_ 数据集
参数 参数
::::::::: :::::::::
data_file(str): path to data file, can be set None if - data_file (str) - 数据集文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None
:attr:`download` is True. Default None - label_file (str) - 标签文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None
mode(str): 'train', 'valid' or 'test' mode. Default 'train'. - setid_file (str) - 子数据集下标划分文件路径,如果 ``download`` 设置为 ``True`` ,此参数可以设置为None。默认值为None
download(bool): whether to download dataset automatically if - mode (str) - ``'train'`` ``'test'`` 模式,默认为 ``'train'``
:attr:`data_file` is not set. Default True - transform (callable) - 作用于图片数据的transform,若未 ``None`` 即为无transform
- download (bool) - 是否自定下载数据集文件。默认为 ``True``
返回
:::::::::
VOC2012数据集实例
代码示例 代码示例
::::::::: :::::::::
.. code-block:: python .. code-block:: python
...@@ -44,4 +50,4 @@ VOC2012 ...@@ -44,4 +50,4 @@ VOC2012
image, label= model(image, label) image, label= model(image, label)
print(image.numpy().shape, label.numpy().shape) print(image.numpy().shape, label.numpy().shape)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册