Skip to content

Commit 198be14

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Update transforms docs sub-structure (#7291)
Summary: Co-authored-by: Philip Meier <[email protected]> Reviewed By: vmoens Differential Revision: D44416596 fbshipit-source-id: 995a5ab32054b30ff674160a451708e1d117abe9
1 parent 21d490e commit 198be14

File tree

1 file changed

+36
-51
lines changed

1 file changed

+36
-51
lines changed

docs/source/transforms.rst

Lines changed: 36 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ transformations.
1414
This is useful if you have to build a more complex transformation pipeline
1515
(e.g. in the case of segmentation tasks).
1616

17-
Most transformations accept both `PIL <https://pillow.readthedocs.io>`_
18-
images and tensor images, although some transformations are :ref:`PIL-only
19-
<transforms_pil_only>` and some are :ref:`tensor-only
20-
<transforms_tensor_only>`. The :ref:`conversion_transforms` may be used to
21-
convert to and from PIL images.
17+
Most transformations accept both `PIL <https://pillow.readthedocs.io>`_ images
18+
and tensor images, although some transformations are PIL-only and some are
19+
tensor-only. The :ref:`conversion_transforms` may be used to convert to and from
20+
PIL images, or for converting dtypes and ranges.
2221

2322
The transformations that accept tensor images also accept batches of tensor
2423
images. A Tensor Image is a tensor with ``(C, H, W)`` shape, where ``C`` is a
@@ -70,8 +69,10 @@ The following examples illustrate the use of the available transforms:
7069
produce the same results.
7170

7271

73-
Scriptable transforms
74-
---------------------
72+
Transforms scriptability
73+
------------------------
74+
75+
.. TODO: Add note about v2 scriptability (in next PR)
7576
7677
In order to script the transformations, please use ``torch.nn.Sequential`` instead of :class:`Compose`.
7778

@@ -89,39 +90,36 @@ Make sure to use only scriptable transformations, i.e. that work with ``torch.Te
8990
For any custom transformations to be used with ``torch.jit.script``, they should be derived from ``torch.nn.Module``.
9091

9192

92-
Compositions of transforms
93-
--------------------------
93+
Geometry
94+
--------
9495

9596
.. autosummary::
9697
:toctree: generated/
9798
:template: class.rst
9899

99-
Compose
100-
100+
Resize
101+
RandomCrop
102+
RandomResizedCrop
103+
CenterCrop
104+
FiveCrop
105+
TenCrop
106+
Pad
107+
RandomAffine
108+
RandomPerspective
109+
RandomRotation
110+
RandomHorizontalFlip
111+
RandomVerticalFlip
101112

102-
Transforms on PIL Image and torch.\*Tensor
103-
------------------------------------------
113+
Color
114+
-----
104115

105116
.. autosummary::
106117
:toctree: generated/
107118
:template: class.rst
108119

109-
CenterCrop
110120
ColorJitter
111-
FiveCrop
112121
Grayscale
113-
Pad
114-
RandomAffine
115-
RandomApply
116-
RandomCrop
117122
RandomGrayscale
118-
RandomHorizontalFlip
119-
RandomPerspective
120-
RandomResizedCrop
121-
RandomRotation
122-
RandomVerticalFlip
123-
Resize
124-
TenCrop
125123
GaussianBlur
126124
RandomInvert
127125
RandomPosterize
@@ -130,23 +128,20 @@ Transforms on PIL Image and torch.\*Tensor
130128
RandomAutocontrast
131129
RandomEqualize
132130

133-
134-
.. _transforms_pil_only:
135-
136-
Transforms on PIL Image only
137-
----------------------------
131+
Composition
132+
-----------
138133

139134
.. autosummary::
140135
:toctree: generated/
141136
:template: class.rst
142137

138+
Compose
139+
RandomApply
143140
RandomChoice
144141
RandomOrder
145142

146-
.. _transforms_tensor_only:
147-
148-
Transforms on torch.\*Tensor only
149-
---------------------------------
143+
Miscellaneous
144+
-------------
150145

151146
.. autosummary::
152147
:toctree: generated/
@@ -155,12 +150,12 @@ Transforms on torch.\*Tensor only
155150
LinearTransformation
156151
Normalize
157152
RandomErasing
158-
ConvertImageDtype
153+
Lambda
159154

160155
.. _conversion_transforms:
161156

162-
Conversion Transforms
163-
---------------------
157+
Conversion
158+
----------
164159

165160
.. autosummary::
166161
:toctree: generated/
@@ -169,20 +164,10 @@ Conversion Transforms
169164
ToPILImage
170165
ToTensor
171166
PILToTensor
167+
ConvertImageDtype
172168

173-
174-
Generic Transforms
175-
------------------
176-
177-
.. autosummary::
178-
:toctree: generated/
179-
:template: class.rst
180-
181-
Lambda
182-
183-
184-
Automatic Augmentation Transforms
185-
---------------------------------
169+
Auto-Augmentation
170+
-----------------
186171

187172
`AutoAugment <https://arxiv.org/pdf/1805.09501.pdf>`_ is a common Data Augmentation technique that can improve the accuracy of Image Classification models.
188173
Though the data augmentation policies are directly linked to their trained dataset, empirical studies show that

0 commit comments

Comments
 (0)