You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/transforms.rst
+36-51Lines changed: 36 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -14,11 +14,10 @@ transformations.
14
14
This is useful if you have to build a more complex transformation pipeline
15
15
(e.g. in the case of segmentation tasks).
16
16
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.
22
21
23
22
The transformations that accept tensor images also accept batches of tensor
24
23
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:
70
69
produce the same results.
71
70
72
71
73
-
Scriptable transforms
74
-
---------------------
72
+
Transforms scriptability
73
+
------------------------
74
+
75
+
.. TODO: Add note about v2 scriptability (in next PR)
75
76
76
77
In order to script the transformations, please use ``torch.nn.Sequential`` instead of :class:`Compose`.
77
78
@@ -89,39 +90,36 @@ Make sure to use only scriptable transformations, i.e. that work with ``torch.Te
89
90
For any custom transformations to be used with ``torch.jit.script``, they should be derived from ``torch.nn.Module``.
90
91
91
92
92
-
Compositions of transforms
93
-
--------------------------
93
+
Geometry
94
+
--------
94
95
95
96
.. autosummary::
96
97
:toctree: generated/
97
98
:template: class.rst
98
99
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
101
112
102
-
Transforms on PIL Image and torch.\*Tensor
103
-
------------------------------------------
113
+
Color
114
+
-----
104
115
105
116
.. autosummary::
106
117
:toctree: generated/
107
118
:template: class.rst
108
119
109
-
CenterCrop
110
120
ColorJitter
111
-
FiveCrop
112
121
Grayscale
113
-
Pad
114
-
RandomAffine
115
-
RandomApply
116
-
RandomCrop
117
122
RandomGrayscale
118
-
RandomHorizontalFlip
119
-
RandomPerspective
120
-
RandomResizedCrop
121
-
RandomRotation
122
-
RandomVerticalFlip
123
-
Resize
124
-
TenCrop
125
123
GaussianBlur
126
124
RandomInvert
127
125
RandomPosterize
@@ -130,23 +128,20 @@ Transforms on PIL Image and torch.\*Tensor
130
128
RandomAutocontrast
131
129
RandomEqualize
132
130
133
-
134
-
.. _transforms_pil_only:
135
-
136
-
Transforms on PIL Image only
137
-
----------------------------
131
+
Composition
132
+
-----------
138
133
139
134
.. autosummary::
140
135
:toctree: generated/
141
136
:template: class.rst
142
137
138
+
Compose
139
+
RandomApply
143
140
RandomChoice
144
141
RandomOrder
145
142
146
-
.. _transforms_tensor_only:
147
-
148
-
Transforms on torch.\*Tensor only
149
-
---------------------------------
143
+
Miscellaneous
144
+
-------------
150
145
151
146
.. autosummary::
152
147
:toctree: generated/
@@ -155,12 +150,12 @@ Transforms on torch.\*Tensor only
155
150
LinearTransformation
156
151
Normalize
157
152
RandomErasing
158
-
ConvertImageDtype
153
+
Lambda
159
154
160
155
.. _conversion_transforms:
161
156
162
-
Conversion Transforms
163
-
---------------------
157
+
Conversion
158
+
----------
164
159
165
160
.. autosummary::
166
161
:toctree: generated/
@@ -169,20 +164,10 @@ Conversion Transforms
169
164
ToPILImage
170
165
ToTensor
171
166
PILToTensor
167
+
ConvertImageDtype
172
168
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
+
-----------------
186
171
187
172
`AutoAugment <https://arxiv.org/pdf/1805.09501.pdf>`_ is a common Data Augmentation technique that can improve the accuracy of Image Classification models.
188
173
Though the data augmentation policies are directly linked to their trained dataset, empirical studies show that
0 commit comments