Unverified Commit 5b611444 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Big doc revamp - simplify and improve the subpackage pages (#4783)

parent 57b3b42c
...@@ -14,6 +14,7 @@ docs/build ...@@ -14,6 +14,7 @@ docs/build
# sphinx-gallery # sphinx-gallery
docs/source/auto_examples/ docs/source/auto_examples/
docs/source/gen_modules/ docs/source/gen_modules/
docs/source/generated/
# pytorch-sphinx-theme gets installed here # pytorch-sphinx-theme gets installed here
docs/src docs/src
......
...@@ -32,6 +32,7 @@ clean: ...@@ -32,6 +32,7 @@ clean:
rm -rf $(BUILDDIR)/* rm -rf $(BUILDDIR)/*
rm -rf $(SOURCEDIR)/auto_examples/ # sphinx-gallery rm -rf $(SOURCEDIR)/auto_examples/ # sphinx-gallery
rm -rf $(SOURCEDIR)/gen_modules/ # sphinx-gallery rm -rf $(SOURCEDIR)/gen_modules/ # sphinx-gallery
rm -rf $(SOURCEDIR)/generated/ # autosummary
.PHONY: help Makefile docset .PHONY: help Makefile docset
......
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}
{{ name | underline}}
.. autoclass:: {{ name }}
:members:
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}
{{ name | underline}}
.. autoclass:: {{ name }}
:members:
__getitem__,
{% if "category_name" in methods %} category_name {% endif %}
:special-members:
.. role:: hidden
:class: hidden-section
.. currentmodule:: {{ module }}
{{ name | underline}}
.. autofunction:: {{ name }}
...@@ -144,6 +144,9 @@ html_css_files = [ ...@@ -144,6 +144,9 @@ html_css_files = [
htmlhelp_basename = "PyTorchdoc" htmlhelp_basename = "PyTorchdoc"
autosummary_generate = True
# -- Options for LaTeX output --------------------------------------------- # -- Options for LaTeX output ---------------------------------------------
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). # The paper size ('letterpaper' or 'a4paper').
......
torchvision.datasets Datasets
==================== ========
Torchvision provides many built-in datasets in the ``torchvision.datasets``
module, as well as utility classes for building your own datasets.
Built-in datasets
~~~~~~~~~~~~~~~~~
All datasets are subclasses of :class:`torch.utils.data.Dataset` All datasets are subclasses of :class:`torch.utils.data.Dataset`
i.e, they have ``__getitem__`` and ``__len__`` methods implemented. i.e, they have ``__getitem__`` and ``__len__`` methods implemented.
...@@ -19,263 +25,58 @@ All the datasets have almost similar API. They all have two common arguments: ...@@ -19,263 +25,58 @@ All the datasets have almost similar API. They all have two common arguments:
``transform`` and ``target_transform`` to transform the input and target respectively. ``transform`` and ``target_transform`` to transform the input and target respectively.
You can also create your own datasets using the provided :ref:`base classes <base_classes_datasets>`. You can also create your own datasets using the provided :ref:`base classes <base_classes_datasets>`.
Caltech
~~~~~~~
.. autoclass:: Caltech101
:members: __getitem__
:special-members:
.. autoclass:: Caltech256
:members: __getitem__
:special-members:
CelebA
~~~~~~
.. autoclass:: CelebA
:members: __getitem__
:special-members:
CIFAR
~~~~~
.. autoclass:: CIFAR10
:members: __getitem__
:special-members:
.. autoclass:: CIFAR100
Cityscapes
~~~~~~~~~~
.. note ::
Requires Cityscape to be downloaded.
.. autoclass:: Cityscapes
:members: __getitem__
:special-members:
COCO
~~~~
.. note ::
These require the `COCO API to be installed`_
.. _COCO API to be installed: https://github.com/pdollar/coco/tree/master/PythonAPI
Captions
^^^^^^^^
.. autoclass:: CocoCaptions
:members: __getitem__
:special-members:
Detection
^^^^^^^^^
.. autoclass:: CocoDetection
:members: __getitem__
:special-members:
EMNIST
~~~~~~
.. autoclass:: EMNIST
FakeData
~~~~~~~~
.. autoclass:: FakeData
Fashion-MNIST
~~~~~~~~~~~~~
.. autoclass:: FashionMNIST
Flickr
~~~~~~
.. autoclass:: Flickr8k
:members: __getitem__
:special-members:
.. autoclass:: Flickr30k
:members: __getitem__
:special-members:
HMDB51
~~~~~~~
.. autoclass:: HMDB51
:members: __getitem__
:special-members:
ImageNet
~~~~~~~~~~~
.. autoclass:: ImageNet
.. note ::
This requires `scipy` to be installed
iNaturalist
~~~~~~~~~~~
.. autoclass:: INaturalist
:members: __getitem__, category_name
Kinetics-400
~~~~~~~~~~~~
.. autoclass:: Kinetics400
:members: __getitem__
:special-members:
KITTI
~~~~~~~~~
.. autoclass:: Kitti
:members: __getitem__
:special-members:
KMNIST
~~~~~~~~~~~~~
.. autoclass:: KMNIST
LFW
~~~~~
.. autoclass:: LFWPeople
:members: __getitem__
:special-members:
.. autoclass:: LFWPairs
:members: __getitem__
:special-members:
LSUN
~~~~
.. autoclass:: LSUN
:members: __getitem__
:special-members:
MNIST
~~~~~
.. autoclass:: MNIST
Omniglot
~~~~~~~~
.. autoclass:: Omniglot
PhotoTour
~~~~~~~~~
.. autoclass:: PhotoTour
:members: __getitem__
:special-members:
Places365
~~~~~~~~~
.. autoclass:: Places365
:members: __getitem__
:special-members:
QMNIST
~~~~~~
.. autoclass:: QMNIST
SBD
~~~~~~
.. autoclass:: SBDataset
:members: __getitem__
:special-members:
SBU
~~~
.. autoclass:: SBU
:members: __getitem__
:special-members:
SEMEION
~~~~~~~
.. autoclass:: SEMEION
:members: __getitem__
:special-members:
STL10
~~~~~
.. autoclass:: STL10
:members: __getitem__
:special-members:
SVHN
~~~~~
.. autoclass:: SVHN
:members: __getitem__
:special-members:
UCF101
~~~~~~~
.. autoclass:: UCF101
:members: __getitem__
:special-members:
USPS
~~~~~
.. autoclass:: USPS
:members: __getitem__
:special-members:
VOC
~~~~~~
.. autoclass:: VOCSegmentation
:members: __getitem__
:special-members:
.. autoclass:: VOCDetection
:members: __getitem__
:special-members:
WIDERFace
~~~~~~~~~
.. autoclass:: WIDERFace
:members: __getitem__
:special-members:
.. autosummary::
:toctree: generated/
:template: class_dataset.rst
Caltech101
Caltech256
CelebA
CIFAR10
CIFAR100
Cityscapes
CocoCaptions
CocoDetection
EMNIST
FakeData
FashionMNIST
Flickr8k
Flickr30k
HMDB51
ImageNet
INaturalist
Kinetics400
Kitti
KMNIST
LFWPeople
LFWPairs
LSUN
MNIST
Omniglot
PhotoTour
Places365
QMNIST
SBDataset
SBU
SEMEION
STL10
SVHN
UCF101
USPS
VOCSegmentation
VOCDetection
WIDERFace
.. _base_classes_datasets: .. _base_classes_datasets:
Base classes for custom datasets Base classes for custom datasets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: DatasetFolder .. autosummary::
:members: __getitem__, find_classes, make_dataset :toctree: generated/
:special-members: :template: class.rst
.. autoclass:: ImageFolder
:members: __getitem__
:special-members:
.. autoclass:: VisionDataset DatasetFolder
:members: __getitem__ ImageFolder
:special-members: VisionDataset
[html writers]
table_style: colwidths-auto # Necessary for the table generated by autosummary to look decent
torchvision.models.feature_extraction Feature extraction for model inspection
===================================== =======================================
.. currentmodule:: torchvision.models.feature_extraction .. currentmodule:: torchvision.models.feature_extraction
Feature extraction utilities let us tap into our models to access intermediate The ``torchvision.models.feature_extraction`` package contains
feature extraction utilities that let us tap into our models to access intermediate
transformations of our inputs. This could be useful for a variety of transformations of our inputs. This could be useful for a variety of
applications in computer vision. Just a few examples are: applications in computer vision. Just a few examples are:
...@@ -157,6 +158,9 @@ Here is an example of how we might extract features for MaskRCNN: ...@@ -157,6 +158,9 @@ Here is an example of how we might extract features for MaskRCNN:
API Reference API Reference
------------- -------------
.. autofunction:: create_feature_extractor .. autosummary::
:toctree: generated/
:template: function.rst
.. autofunction:: get_graph_node_names create_feature_extractor
get_graph_node_names
...@@ -32,11 +32,11 @@ architectures, and common image transformations for computer vision. ...@@ -32,11 +32,11 @@ architectures, and common image transformations for computer vision.
:caption: Package Reference :caption: Package Reference
datasets datasets
io transforms
models models
feature_extraction feature_extraction
ops ops
transforms io
utils utils
.. toctree:: .. toctree::
......
torchvision.io Reading/Writing images and videos
============== =================================
.. currentmodule:: torchvision.io .. currentmodule:: torchvision.io
...@@ -10,11 +10,13 @@ images. ...@@ -10,11 +10,13 @@ images.
Video Video
----- -----
.. autofunction:: read_video .. autosummary::
:toctree: generated/
:template: function.rst
.. autofunction:: read_video_timestamps read_video
read_video_timestamps
.. autofunction:: write_video write_video
Fine-grained video API Fine-grained video API
...@@ -24,8 +26,11 @@ In addition to the :mod:`read_video` function, we provide a high-performance ...@@ -24,8 +26,11 @@ In addition to the :mod:`read_video` function, we provide a high-performance
lower-level API for more fine-grained control compared to the :mod:`read_video` function. lower-level API for more fine-grained control compared to the :mod:`read_video` function.
It does all this whilst fully supporting torchscript. It does all this whilst fully supporting torchscript.
.. autoclass:: VideoReader .. autosummary::
:members: __next__, get_metadata, set_current_stream, seek :toctree: generated/
:template: class.rst
VideoReader
Example of inspecting a video: Example of inspecting a video:
...@@ -59,24 +64,23 @@ Example of inspecting a video: ...@@ -59,24 +64,23 @@ Example of inspecting a video:
Image Image
----- -----
.. autoclass:: ImageReadMode .. autosummary::
:toctree: generated/
.. autofunction:: read_image :template: class.rst
.. autofunction:: decode_image ImageReadMode
.. autofunction:: encode_jpeg .. autosummary::
:toctree: generated/
.. autofunction:: decode_jpeg :template: function.rst
.. autofunction:: write_jpeg read_image
decode_image
.. autofunction:: encode_png encode_jpeg
decode_jpeg
.. autofunction:: decode_png write_jpeg
encode_png
.. autofunction:: write_png decode_png
write_png
.. autofunction:: read_file read_file
write_file
.. autofunction:: write_file
.. _models: .. _models:
torchvision.models Models and pre-trained weights
################## ##############################
The models subpackage contains definitions of models for addressing The ``torchvision.models`` subpackage contains definitions of models for addressing
different tasks, including: image classification, pixelwise semantic different tasks, including: image classification, pixelwise semantic
segmentation, object detection, instance segmentation, person segmentation, object detection, instance segmentation, person
keypoint detection and video classification. keypoint detection and video classification.
...@@ -256,48 +256,72 @@ regnet_y_32gf 80.878 95.340 ...@@ -256,48 +256,72 @@ regnet_y_32gf 80.878 95.340
Alexnet Alexnet
------- -------
.. autofunction:: alexnet .. autosummary::
:toctree: generated/
:template: function.rst
alexnet
VGG VGG
--- ---
.. autofunction:: vgg11 .. autosummary::
.. autofunction:: vgg11_bn :toctree: generated/
.. autofunction:: vgg13 :template: function.rst
.. autofunction:: vgg13_bn
.. autofunction:: vgg16 vgg11
.. autofunction:: vgg16_bn vgg11_bn
.. autofunction:: vgg19 vgg13
.. autofunction:: vgg19_bn vgg13_bn
vgg16
vgg16_bn
vgg19
vgg19_bn
ResNet ResNet
------ ------
.. autofunction:: resnet18 .. autosummary::
.. autofunction:: resnet34 :toctree: generated/
.. autofunction:: resnet50 :template: function.rst
.. autofunction:: resnet101
.. autofunction:: resnet152 resnet18
resnet34
resnet50
resnet101
resnet152
SqueezeNet SqueezeNet
---------- ----------
.. autofunction:: squeezenet1_0 .. autosummary::
.. autofunction:: squeezenet1_1 :toctree: generated/
:template: function.rst
squeezenet1_0
squeezenet1_1
DenseNet DenseNet
--------- ---------
.. autofunction:: densenet121 .. autosummary::
.. autofunction:: densenet169 :toctree: generated/
.. autofunction:: densenet161 :template: function.rst
.. autofunction:: densenet201
densenet121
densenet169
densenet161
densenet201
Inception v3 Inception v3
------------ ------------
.. autofunction:: inception_v3 .. autosummary::
:toctree: generated/
:template: function.rst
inception_v3
.. note :: .. note ::
This requires `scipy` to be installed This requires `scipy` to be installed
...@@ -306,7 +330,11 @@ Inception v3 ...@@ -306,7 +330,11 @@ Inception v3
GoogLeNet GoogLeNet
------------ ------------
.. autofunction:: googlenet .. autosummary::
:toctree: generated/
:template: function.rst
googlenet
.. note :: .. note ::
This requires `scipy` to be installed This requires `scipy` to be installed
...@@ -315,71 +343,103 @@ GoogLeNet ...@@ -315,71 +343,103 @@ GoogLeNet
ShuffleNet v2 ShuffleNet v2
------------- -------------
.. autofunction:: shufflenet_v2_x0_5 .. autosummary::
.. autofunction:: shufflenet_v2_x1_0 :toctree: generated/
.. autofunction:: shufflenet_v2_x1_5 :template: function.rst
.. autofunction:: shufflenet_v2_x2_0
shufflenet_v2_x0_5
shufflenet_v2_x1_0
shufflenet_v2_x1_5
shufflenet_v2_x2_0
MobileNet v2 MobileNet v2
------------- -------------
.. autofunction:: mobilenet_v2 .. autosummary::
:toctree: generated/
:template: function.rst
mobilenet_v2
MobileNet v3 MobileNet v3
------------- -------------
.. autofunction:: mobilenet_v3_large .. autosummary::
.. autofunction:: mobilenet_v3_small :toctree: generated/
:template: function.rst
mobilenet_v3_large
mobilenet_v3_small
ResNext ResNext
------- -------
.. autofunction:: resnext50_32x4d .. autosummary::
.. autofunction:: resnext101_32x8d :toctree: generated/
:template: function.rst
resnext50_32x4d
resnext101_32x8d
Wide ResNet Wide ResNet
----------- -----------
.. autofunction:: wide_resnet50_2 .. autosummary::
.. autofunction:: wide_resnet101_2 :toctree: generated/
:template: function.rst
wide_resnet50_2
wide_resnet101_2
MNASNet MNASNet
-------- --------
.. autofunction:: mnasnet0_5 .. autosummary::
.. autofunction:: mnasnet0_75 :toctree: generated/
.. autofunction:: mnasnet1_0 :template: function.rst
.. autofunction:: mnasnet1_3
mnasnet0_5
mnasnet0_75
mnasnet1_0
mnasnet1_3
EfficientNet EfficientNet
------------ ------------
.. autofunction:: efficientnet_b0 .. autosummary::
.. autofunction:: efficientnet_b1 :toctree: generated/
.. autofunction:: efficientnet_b2 :template: function.rst
.. autofunction:: efficientnet_b3
.. autofunction:: efficientnet_b4 efficientnet_b0
.. autofunction:: efficientnet_b5 efficientnet_b1
.. autofunction:: efficientnet_b6 efficientnet_b2
.. autofunction:: efficientnet_b7 efficientnet_b3
efficientnet_b4
efficientnet_b5
efficientnet_b6
efficientnet_b7
RegNet RegNet
------------ ------------
.. autofunction:: regnet_y_400mf .. autosummary::
.. autofunction:: regnet_y_800mf :toctree: generated/
.. autofunction:: regnet_y_1_6gf :template: function.rst
.. autofunction:: regnet_y_3_2gf
.. autofunction:: regnet_y_8gf regnet_y_400mf
.. autofunction:: regnet_y_16gf regnet_y_800mf
.. autofunction:: regnet_y_32gf regnet_y_1_6gf
.. autofunction:: regnet_x_400mf regnet_y_3_2gf
.. autofunction:: regnet_x_800mf regnet_y_8gf
.. autofunction:: regnet_x_1_6gf regnet_y_16gf
.. autofunction:: regnet_x_3_2gf regnet_y_32gf
.. autofunction:: regnet_x_8gf regnet_x_400mf
.. autofunction:: regnet_x_16gf regnet_x_800mf
.. autofunction:: regnet_x_32gf regnet_x_1_6gf
regnet_x_3_2gf
regnet_x_8gf
regnet_x_16gf
regnet_x_32gf
Quantized Models Quantized Models
---------------- ----------------
...@@ -473,22 +533,34 @@ LR-ASPP MobileNetV3-Large 57.9 91.2 ...@@ -473,22 +533,34 @@ LR-ASPP MobileNetV3-Large 57.9 91.2
Fully Convolutional Networks Fully Convolutional Networks
---------------------------- ----------------------------
.. autofunction:: torchvision.models.segmentation.fcn_resnet50 .. autosummary::
.. autofunction:: torchvision.models.segmentation.fcn_resnet101 :toctree: generated/
:template: function.rst
torchvision.models.segmentation.fcn_resnet50
torchvision.models.segmentation.fcn_resnet101
DeepLabV3 DeepLabV3
--------- ---------
.. autofunction:: torchvision.models.segmentation.deeplabv3_resnet50 .. autosummary::
.. autofunction:: torchvision.models.segmentation.deeplabv3_resnet101 :toctree: generated/
.. autofunction:: torchvision.models.segmentation.deeplabv3_mobilenet_v3_large :template: function.rst
torchvision.models.segmentation.deeplabv3_resnet50
torchvision.models.segmentation.deeplabv3_resnet101
torchvision.models.segmentation.deeplabv3_mobilenet_v3_large
LR-ASPP LR-ASPP
------- -------
.. autofunction:: torchvision.models.segmentation.lraspp_mobilenet_v3_large .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.segmentation.lraspp_mobilenet_v3_large
.. _object_det_inst_seg_pers_keypoint_det: .. _object_det_inst_seg_pers_keypoint_det:
...@@ -615,39 +687,63 @@ Keypoint R-CNN ResNet-50 FPN 0.3789 0.1242 ...@@ -615,39 +687,63 @@ Keypoint R-CNN ResNet-50 FPN 0.3789 0.1242
Faster R-CNN Faster R-CNN
------------ ------------
.. autofunction:: torchvision.models.detection.fasterrcnn_resnet50_fpn .. autosummary::
.. autofunction:: torchvision.models.detection.fasterrcnn_mobilenet_v3_large_fpn :toctree: generated/
.. autofunction:: torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn :template: function.rst
torchvision.models.detection.fasterrcnn_resnet50_fpn
torchvision.models.detection.fasterrcnn_mobilenet_v3_large_fpn
torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn
RetinaNet RetinaNet
--------- ---------
.. autofunction:: torchvision.models.detection.retinanet_resnet50_fpn .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.detection.retinanet_resnet50_fpn
SSD SSD
--- ---
.. autofunction:: torchvision.models.detection.ssd300_vgg16 .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.detection.ssd300_vgg16
SSDlite SSDlite
------- -------
.. autofunction:: torchvision.models.detection.ssdlite320_mobilenet_v3_large .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.detection.ssdlite320_mobilenet_v3_large
Mask R-CNN Mask R-CNN
---------- ----------
.. autofunction:: torchvision.models.detection.maskrcnn_resnet50_fpn .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.detection.maskrcnn_resnet50_fpn
Keypoint R-CNN Keypoint R-CNN
-------------- --------------
.. autofunction:: torchvision.models.detection.keypointrcnn_resnet50_fpn .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.detection.keypointrcnn_resnet50_fpn
Video classification Video classification
...@@ -686,14 +782,26 @@ ResNet (2+1)D 57.50 78.81 ...@@ -686,14 +782,26 @@ ResNet (2+1)D 57.50 78.81
ResNet 3D ResNet 3D
---------- ----------
.. autofunction:: torchvision.models.video.r3d_18 .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.video.r3d_18
ResNet Mixed Convolution ResNet Mixed Convolution
------------------------ ------------------------
.. autofunction:: torchvision.models.video.mc3_18 .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.video.mc3_18
ResNet (2+1)D ResNet (2+1)D
------------- -------------
.. autofunction:: torchvision.models.video.r2plus1d_18 .. autosummary::
:toctree: generated/
:template: function.rst
torchvision.models.video.r2plus1d_18
.. _ops: .. _ops:
torchvision.ops Operators
=============== =========
.. currentmodule:: torchvision.ops .. currentmodule:: torchvision.ops
...@@ -10,29 +10,36 @@ torchvision.ops ...@@ -10,29 +10,36 @@ torchvision.ops
.. note:: .. note::
All operators have native support for TorchScript. All operators have native support for TorchScript.
.. autosummary::
:toctree: generated/
:template: function.rst
.. autofunction:: batched_nms batched_nms
.. autofunction:: box_area box_area
.. autofunction:: box_convert box_convert
.. autofunction:: box_iou box_iou
.. autofunction:: clip_boxes_to_image clip_boxes_to_image
.. autofunction:: deform_conv2d deform_conv2d
.. autofunction:: generalized_box_iou generalized_box_iou
.. autofunction:: masks_to_boxes masks_to_boxes
.. autofunction:: nms nms
.. autofunction:: ps_roi_align ps_roi_align
.. autofunction:: ps_roi_pool ps_roi_pool
.. autofunction:: remove_small_boxes remove_small_boxes
.. autofunction:: roi_align roi_align
.. autofunction:: roi_pool roi_pool
.. autofunction:: sigmoid_focal_loss sigmoid_focal_loss
.. autofunction:: stochastic_depth stochastic_depth
.. autoclass:: RoIAlign .. autosummary::
.. autoclass:: PSRoIAlign :toctree: generated/
.. autoclass:: RoIPool :template: class.rst
.. autoclass:: PSRoIPool
.. autoclass:: DeformConv2d RoIAlign
.. autoclass:: MultiScaleRoIAlign PSRoIAlign
.. autoclass:: FeaturePyramidNetwork RoIPool
.. autoclass:: StochasticDepth PSRoIPool
DeformConv2d
MultiScaleRoIAlign
FeaturePyramidNetwork
StochasticDepth
.. _transforms: .. _transforms:
torchvision.transforms Transforming and augmenting images
====================== ==================================
.. currentmodule:: torchvision.transforms .. currentmodule:: torchvision.transforms
Transforms are common image transformations. They can be chained together using :class:`Compose`. Transforms are common image transformations available in the
``torchvision.transforms`` module. They can be chained together using
:class:`Compose`.
Most transform classes have a function equivalent: :ref:`functional Most transform classes have a function equivalent: :ref:`functional
transforms <functional_transforms>` give fine-grained control over the transforms <functional_transforms>` give fine-grained control over the
transformations. transformations.
...@@ -90,131 +92,94 @@ For any custom transformations to be used with ``torch.jit.script``, they should ...@@ -90,131 +92,94 @@ For any custom transformations to be used with ``torch.jit.script``, they should
Compositions of transforms Compositions of transforms
-------------------------- --------------------------
.. autoclass:: Compose .. autosummary::
:toctree: generated/
:template: class.rst
Compose
Transforms on PIL Image and torch.\*Tensor Transforms on PIL Image and torch.\*Tensor
------------------------------------------ ------------------------------------------
.. autoclass:: CenterCrop .. autosummary::
:members: :toctree: generated/
:template: class.rst
.. autoclass:: ColorJitter
:members: CenterCrop
ColorJitter
.. autoclass:: FiveCrop FiveCrop
:members: Grayscale
Pad
.. autoclass:: Grayscale RandomAffine
:members: RandomApply
RandomCrop
.. autoclass:: Pad RandomGrayscale
:members: RandomHorizontalFlip
RandomPerspective
.. autoclass:: RandomAffine RandomResizedCrop
:members: RandomRotation
RandomSizedCrop
.. autoclass:: RandomApply RandomVerticalFlip
Resize
.. autoclass:: RandomCrop TenCrop
:members: GaussianBlur
RandomInvert
.. autoclass:: RandomGrayscale RandomPosterize
:members: RandomSolarize
RandomAdjustSharpness
.. autoclass:: RandomHorizontalFlip RandomAutocontrast
:members: RandomEqualize
.. autoclass:: RandomPerspective
:members:
.. autoclass:: RandomResizedCrop
:members:
.. autoclass:: RandomRotation
:members:
.. autoclass:: RandomSizedCrop
:members:
.. autoclass:: RandomVerticalFlip
:members:
.. autoclass:: Resize
:members:
.. autoclass:: Scale
:members:
.. autoclass:: TenCrop
:members:
.. autoclass:: GaussianBlur
:members:
.. autoclass:: RandomInvert
:members:
.. autoclass:: RandomPosterize
:members:
.. autoclass:: RandomSolarize
:members:
.. autoclass:: RandomAdjustSharpness
:members:
.. autoclass:: RandomAutocontrast
:members:
.. autoclass:: RandomEqualize
:members:
.. _transforms_pil_only: .. _transforms_pil_only:
Transforms on PIL Image only Transforms on PIL Image only
---------------------------- ----------------------------
.. autoclass:: RandomChoice .. autosummary::
:toctree: generated/
:template: class.rst
.. autoclass:: RandomOrder RandomChoice
RandomOrder
.. _transforms_tensor_only: .. _transforms_tensor_only:
Transforms on torch.\*Tensor only Transforms on torch.\*Tensor only
--------------------------------- ---------------------------------
.. autoclass:: LinearTransformation .. autosummary::
:members: :toctree: generated/
:template: class.rst
.. autoclass:: Normalize
:members:
.. autoclass:: RandomErasing LinearTransformation
:members: Normalize
RandomErasing
.. autoclass:: ConvertImageDtype ConvertImageDtype
.. _conversion_transforms: .. _conversion_transforms:
Conversion Transforms Conversion Transforms
--------------------- ---------------------
.. autoclass:: ToPILImage .. autosummary::
:members: :toctree: generated/
:template: class.rst
.. autoclass:: ToTensor
:members:
.. autoclass:: PILToTensor ToPILImage
:members: ToTensor
PILToTensor
Generic Transforms Generic Transforms
------------------ ------------------
.. autoclass:: Lambda .. autosummary::
:members: :toctree: generated/
:template: class.rst
Lambda
Automatic Augmentation Transforms Automatic Augmentation Transforms
...@@ -226,27 +191,22 @@ ImageNet policies provide significant improvements when applied to other dataset ...@@ -226,27 +191,22 @@ ImageNet policies provide significant improvements when applied to other dataset
In TorchVision we implemented 3 policies learned on the following datasets: ImageNet, CIFAR10 and SVHN. In TorchVision we implemented 3 policies learned on the following datasets: ImageNet, CIFAR10 and SVHN.
The new transform can be used standalone or mixed-and-matched with existing transforms: The new transform can be used standalone or mixed-and-matched with existing transforms:
.. autoclass:: AutoAugmentPolicy .. autosummary::
:members: :toctree: generated/
:template: class.rst
.. autoclass:: AutoAugment
:members:
`RandAugment <https://arxiv.org/abs/1909.13719>`_ is a simple high-performing Data Augmentation technique which improves the accuracy of Image Classification models. AutoAugmentPolicy
AutoAugment
.. autoclass:: RandAugment RandAugment
:members: TrivialAugmentWide
`TrivialAugmentWide <https://arxiv.org/abs/2103.10158>`_ is a dataset-independent data-augmentation technique which improves the accuracy of Image Classification models.
.. autoclass:: TrivialAugmentWide
:members:
.. _functional_transforms: .. _functional_transforms:
Functional Transforms Functional Transforms
--------------------- ---------------------
.. currentmodule:: torchvision.transforms.functional
Functional transforms give you fine-grained control of the transformation pipeline. Functional transforms give you fine-grained control of the transformation pipeline.
As opposed to the transformations above, functional transforms don't contain a random number As opposed to the transformations above, functional transforms don't contain a random number
generator for their parameters. generator for their parameters.
...@@ -291,5 +251,41 @@ you can use a functional transform to build transform classes with custom behavi ...@@ -291,5 +251,41 @@ you can use a functional transform to build transform classes with custom behavi
rotation_transform = MyRotationTransform(angles=[-30, -15, 0, 15, 30]) rotation_transform = MyRotationTransform(angles=[-30, -15, 0, 15, 30])
.. automodule:: torchvision.transforms.functional .. autosummary::
:members: :toctree: generated/
:template: function.rst
adjust_brightness
adjust_contrast
adjust_gamma
adjust_hue
adjust_saturation
adjust_sharpness
affine
autocontrast
center_crop
convert_image_dtype
crop
equalize
erase
five_crop
gaussian_blur
get_image_num_channels
get_image_size
hflip
invert
normalize
pad
perspective
pil_to_tensor
posterize
resize
resized_crop
rgb_to_grayscale
rotate
solarize
ten_crop
to_grayscale
to_pil_image
to_tensor
vflip
.. _utils: .. _utils:
torchvision.utils Utils
================= =====
.. currentmodule:: torchvision.utils The ``torchvision.utils`` module contains various utilities, mostly :ref:`for
vizualization <sphx_glr_auto_examples_plot_visualization_utils.py>`.
.. autofunction:: make_grid
.. autofunction:: save_image .. currentmodule:: torchvision.utils
.. autofunction:: draw_bounding_boxes .. autosummary::
:toctree: generated/
:template: function.rst
.. autofunction:: draw_segmentation_masks draw_bounding_boxes
draw_segmentation_masks
make_grid
save_image
...@@ -10,6 +10,8 @@ from .vision import VisionDataset ...@@ -10,6 +10,8 @@ from .vision import VisionDataset
class CocoDetection(VisionDataset): class CocoDetection(VisionDataset):
"""`MS Coco Detection <https://cocodataset.org/#detection-2016>`_ Dataset. """`MS Coco Detection <https://cocodataset.org/#detection-2016>`_ Dataset.
It requires the `COCO API to be installed <https://github.com/pdollar/coco/tree/master/PythonAPI>`_.
Args: Args:
root (string): Root directory where images are downloaded to. root (string): Root directory where images are downloaded to.
annFile (string): Path to json annotation file. annFile (string): Path to json annotation file.
...@@ -59,6 +61,8 @@ class CocoDetection(VisionDataset): ...@@ -59,6 +61,8 @@ class CocoDetection(VisionDataset):
class CocoCaptions(CocoDetection): class CocoCaptions(CocoDetection):
"""`MS Coco Captions <https://cocodataset.org/#captions-2015>`_ Dataset. """`MS Coco Captions <https://cocodataset.org/#captions-2015>`_ Dataset.
It requires the `COCO API to be installed <https://github.com/pdollar/coco/tree/master/PythonAPI>`_.
Args: Args:
root (string): Root directory where images are downloaded to. root (string): Root directory where images are downloaded to.
annFile (string): Path to json annotation file. annFile (string): Path to json annotation file.
......
...@@ -161,12 +161,10 @@ class DeformConv2d(nn.Module): ...@@ -161,12 +161,10 @@ class DeformConv2d(nn.Module):
""" """
Args: Args:
input (Tensor[batch_size, in_channels, in_height, in_width]): input tensor input (Tensor[batch_size, in_channels, in_height, in_width]): input tensor
offset (Tensor[batch_size, 2 * offset_groups * kernel_height * kernel_width, offset (Tensor[batch_size, 2 * offset_groups * kernel_height * kernel_width, out_height, out_width]):
out_height, out_width]): offsets to be applied for each position in the offsets to be applied for each position in the convolution kernel.
convolution kernel. mask (Tensor[batch_size, offset_groups * kernel_height * kernel_width, out_height, out_width]):
mask (Tensor[batch_size, offset_groups * kernel_height * kernel_width, masks to be applied for each position in the convolution kernel.
out_height, out_width]): masks to be applied for each position in the
convolution kernel.
""" """
return deform_conv2d( return deform_conv2d(
input, input,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment