From c9c01716af88782917f42e518d33fc2c31ceb588 Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Wed, 20 Apr 2022 16:59:18 +0200 Subject: [PATCH] [PoC] add docstring for prototype datasets --- .circleci/config.yml | 1 + .circleci/config.yml.in | 1 + docs/source/index.rst | 1 + docs/source/prototype_datasets.rst | 20 ++++++ .../prototype/datasets/_builtin/imagenet.py | 31 ++++++++++ .../prototype/datasets/_builtin/voc.py | 62 +++++++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 docs/source/prototype_datasets.rst diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d8e2fc5bc9..637b80d9df3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1062,6 +1062,7 @@ jobs: conda activate ./env pushd docs pip install --progress-bar=off -r requirements.txt + pip install --progress-bar=off --user --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu make html popd - persist_to_workspace: diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index a348faaa866..fe16b568aa0 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -1062,6 +1062,7 @@ jobs: conda activate ./env pushd docs pip install --progress-bar=off -r requirements.txt + pip install --progress-bar=off --user --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu make html popd - persist_to_workspace: diff --git a/docs/source/index.rst b/docs/source/index.rst index 06737ae4b60..03815152d8e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -34,6 +34,7 @@ architectures, and common image transformations for computer vision. transforms models datasets + prototype_datasets utils ops io diff --git a/docs/source/prototype_datasets.rst b/docs/source/prototype_datasets.rst new file mode 100644 index 00000000000..9464b076ee3 --- /dev/null +++ b/docs/source/prototype_datasets.rst @@ -0,0 +1,20 @@ +Prototype Datasets +================== + +.. currentmodule:: torchvision.prototype.datasets + +API +--- + +.. autofunction:: home + +Builtin datasets +---------------- + + +.. autosummary:: + :toctree: generated/ + :template: class.rst + + ImageNet + VOC diff --git a/torchvision/prototype/datasets/_builtin/imagenet.py b/torchvision/prototype/datasets/_builtin/imagenet.py index 1307757cef6..9131fdb7005 100644 --- a/torchvision/prototype/datasets/_builtin/imagenet.py +++ b/torchvision/prototype/datasets/_builtin/imagenet.py @@ -54,7 +54,38 @@ class ImageNetDemux(enum.IntEnum): @register_dataset(NAME) class ImageNet(Dataset): """ + $DESCRIPTION + + Args: + root: Path to directory that contains the dataset files or where they will be + downloaded to. If omitted, defaults to + :func:`torchvision.prototype.datasets.home` ``/ imagenet``. + split: Can be on of ``"train"`` (default), ``"val"``, or ``"test"``. + skip_integrity_check: If ``True``, skips the integrity check of dataset files after download. Defaults to + ``False``. + + .. warning:: + + The dataset files cannot be downloaded automatically! + - **homepage**: https://www.image-net.org/ + - **license**: ADDME + - **citation**: ADDME + - **task**: image classification + - **dependencies**: + + - `scipy `_ + - **number of samples**: + + .. table:: + + =========== ================== + ``split`` ``len(dataset)`` + =========== ================== + ``"train"`` ``1_281_167`` + ``"val"`` ``50_000`` + ``"test"`` ``100_000`` + =========== ================== """ def __init__( diff --git a/torchvision/prototype/datasets/_builtin/voc.py b/torchvision/prototype/datasets/_builtin/voc.py index d875df521f2..f632036d5d2 100644 --- a/torchvision/prototype/datasets/_builtin/voc.py +++ b/torchvision/prototype/datasets/_builtin/voc.py @@ -38,7 +38,69 @@ def _info() -> Dict[str, Any]: @register_dataset(NAME) class VOC(Dataset): """ + $DESCRIPTION + + Args: + root: Path to directory that contains the dataset files or where they will be + downloaded to. If omitted, defaults to + :func:`torchvision.prototype.datasets.home` ``/ voc``. + split: Can be on of ``"train"`` (default), ``"val"``, ``"trainval"``, or ``"test"``. ``"test"`` is only + available for ``year="2007"``. + year: Can be on of ``"2007"``, ``"2008"``, ``"2009"``, ``"2010"``, ``"2011"``, or ``"2012"`` (default). + task: Can be either ``"detection"`` (default) or ``"segmentation"``. + skip_integrity_check: If ``True``, skips the integrity check of dataset files after download. Defaults to + ``False``. + - **homepage**: http://host.robots.ox.ac.uk/pascal/VOC/ + - **license**: ADDME + - **citation**: ADDME + - **task**: object detection, semantic segmentation + - **number of samples**: + + .. table:: + + ============== ========== ================== ================== + ``split`` ``year`` ``task`` ``len(dataset)`` + ============== ========== ================== ================== + ``"train"`` ``"2007"`` ``"detection"`` ``2_501`` + ``"train"`` ``"2007"`` ``"segmentation"`` ``209`` + ``"train"`` ``"2008"`` ``"detection"`` ``2_111`` + ``"train"`` ``"2008"`` ``"segmentation"`` ``511`` + ``"train"`` ``"2009"`` ``"detection"`` ``3_473`` + ``"train"`` ``"2009"`` ``"segmentation"`` ``749`` + ``"train"`` ``"2010"`` ``"detection"`` ``4_998`` + ``"train"`` ``"2010"`` ``"segmentation"`` ``964`` + ``"train"`` ``"2011"`` ``"detection"`` ``5_717`` + ``"train"`` ``"2011"`` ``"segmentation"`` ``1_112`` + ``"train"`` ``"2012"`` ``"detection"`` ``5_717`` + ``"train"`` ``"2012"`` ``"segmentation"`` ``1_464`` + ``"val"`` ``"2007"`` ``"detection"`` ``2_510`` + ``"val"`` ``"2007"`` ``"segmentation"`` ``213`` + ``"val"`` ``"2008"`` ``"detection"`` ``2_221`` + ``"val"`` ``"2008"`` ``"segmentation"`` ``512`` + ``"val"`` ``"2009"`` ``"detection"`` ``3_581`` + ``"val"`` ``"2009"`` ``"segmentation"`` ``750`` + ``"val"`` ``"2010"`` ``"detection"`` ``5_105`` + ``"val"`` ``"2010"`` ``"segmentation"`` ``964`` + ``"val"`` ``"2011"`` ``"detection"`` ``5_823`` + ``"val"`` ``"2011"`` ``"segmentation"`` ``1_111`` + ``"val"`` ``"2012"`` ``"detection"`` ``5_823`` + ``"val"`` ``"2012"`` ``"segmentation"`` ``1_449`` + ``"trainval"`` ``"2007"`` ``"detection"`` ``5_011`` + ``"trainval"`` ``"2007"`` ``"segmentation"`` ``422`` + ``"trainval"`` ``"2008"`` ``"detection"`` ``4_332`` + ``"trainval"`` ``"2008"`` ``"segmentation"`` ``1_023`` + ``"trainval"`` ``"2009"`` ``"detection"`` ``7_054`` + ``"trainval"`` ``"2009"`` ``"segmentation"`` ``1_499`` + ``"trainval"`` ``"2010"`` ``"detection"`` ``10_103`` + ``"trainval"`` ``"2010"`` ``"segmentation"`` ``1_928`` + ``"trainval"`` ``"2011"`` ``"detection"`` ``11_540`` + ``"trainval"`` ``"2011"`` ``"segmentation"`` ``2_223`` + ``"trainval"`` ``"2012"`` ``"detection"`` ``11_540`` + ``"trainval"`` ``"2012"`` ``"segmentation"`` ``2_913`` + ``"test"`` ``"2007"`` ``"detection"`` ``4_952`` + ``"test"`` ``"2007"`` ``"segmentation"`` ``210`` + ============== ========== ================== ================== """ def __init__(