Skip to content

[PoC] add docstring for prototype datasets #5843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ architectures, and common image transformations for computer vision.
transforms
models
datasets
prototype_datasets
utils
ops
io
Expand Down
20 changes: 20 additions & 0 deletions docs/source/prototype_datasets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Prototype Datasets
==================

.. currentmodule:: torchvision.prototype.datasets

API
---

.. autofunction:: home
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just here to make the cross link from the dataset docstrings work.


Builtin datasets
----------------


.. autosummary::
:toctree: generated/
:template: class.rst
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've not used the class_dataset.rst template here, since we no longer promote "special members", i.e. dunder methods like __getitem__.


ImageNet
VOC
31 changes: 31 additions & 0 deletions torchvision/prototype/datasets/_builtin/imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,38 @@ class ImageNetDemux(enum.IntEnum):
@register_dataset(NAME)
class ImageNet(Dataset):
"""
$DESCRIPTION
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just a placeholder, because I was to lazy to write something here for now. This should still be static and will not be filled at runtime.


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!
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure how we can put the download instructions here without duplicating them in the resources. I'm inclined to put something like "Just instantiate this and follow the instructions in the error message" here, but that also seems weird.


- **homepage**: https://www.image-net.org/
- **license**: ADDME
- **citation**: ADDME
- **task**: image classification
- **dependencies**:

- `scipy <https://pypi.org/project/scipy/>`_
- **number of samples**:

.. table::

=========== ==================
``split`` ``len(dataset)``
=========== ==================
``"train"`` ``1_281_167``
``"val"`` ``50_000``
``"test"`` ``100_000``
=========== ==================
"""

def __init__(
Expand Down
62 changes: 62 additions & 0 deletions torchvision/prototype/datasets/_builtin/voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down