Skip to content

Commit 831aacc

Browse files
committed
Merge branch 'main' of github.com:pytorch/vision into proto_references_latest_at_least_for_now
2 parents 035ccd7 + 928b05c commit 831aacc

39 files changed

+4132
-2962
lines changed

.circleci/config.yml

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.circleci/regenerate.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
7676
if os_type != "win" and btype == "conda":
7777
continue
7878

79-
# Not supporting Python 3.11 conda packages at the
80-
# moment since the necessary dependencies are not
81-
# available. Windows 3.11 Wheels will be built from
82-
# CircleCI here, however.
83-
if python_version == "3.11" and btype == "conda":
84-
continue
85-
8679
w += workflow_pair(
8780
btype, os_type, python_version, cu_version, unicode, prefix, upload, filter_branch=fb
8881
)

.circleci/unittest/linux/scripts/run_test.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,17 @@ eval "$(./conda/bin/conda shell.bash hook)"
66
conda activate ./env
77

88
python -m torch.utils.collect_env
9-
pytest --junitxml=test-results/junit.xml -v --durations 20
9+
10+
case "$(uname -s)" in
11+
Darwin*)
12+
# The largest macOS runner is not able to handle the regular test suite plus the transforms v2 tests at the same
13+
# time due to insufficient resources. Thus, we ignore the transforms v2 tests at first and run them in a separate
14+
# step afterwards.
15+
GLOB='test/test_transforms_v2*'
16+
pytest --junitxml=test-results/junit.xml -v --durations 20 --ignore-glob="${GLOB}"
17+
eval "pytest --junitxml=test-results/junit-transforms-v2.xml -v --durations 20 ${GLOB}"
18+
;;
19+
*)
20+
pytest --junitxml=test-results/junit.xml -v --durations 20
21+
;;
22+
esac

.github/workflows/test-linux-cpu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ jobs:
3939
fi
4040
4141
# Create Conda Env
42-
conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy
42+
conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy 'ffmpeg<4.3'
4343
conda activate /work/ci_env
44-
44+
4545
# Install PyTorch, Torchvision, and testing libraries
4646
set -ex
4747
conda install \

.github/workflows/test-linux-gpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
fi
4444
4545
# Create Conda Env
46-
conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy
46+
conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy 'ffmpeg<4.3'
4747
conda activate /work/ci_env
4848
4949
# Install PyTorch, Torchvision, and testing libraries

docs/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
sys.path.append(os.path.abspath("."))
3535

36+
torchvision.disable_beta_transforms_warning()
37+
3638
# -- General configuration ------------------------------------------------
3739

3840
# Required version of sphinx is set from docs/requirements.txt

docs/source/transforms.rst

Lines changed: 76 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,100 +90,120 @@ 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+
v2.Resize
102+
RandomCrop
103+
v2.RandomCrop
104+
RandomResizedCrop
105+
v2.RandomResizedCrop
106+
CenterCrop
107+
v2.CenterCrop
108+
FiveCrop
109+
v2.FiveCrop
110+
TenCrop
111+
v2.TenCrop
112+
Pad
113+
v2.Pad
114+
RandomAffine
115+
v2.RandomAffine
116+
RandomPerspective
117+
v2.RandomPerspective
118+
RandomRotation
119+
v2.RandomRotation
120+
RandomHorizontalFlip
121+
v2.RandomHorizontalFlip
122+
RandomVerticalFlip
123+
v2.RandomVerticalFlip
101124

102-
Transforms on PIL Image and torch.\*Tensor
103-
------------------------------------------
125+
Color
126+
-----
104127

105128
.. autosummary::
106129
:toctree: generated/
107130
:template: class.rst
108131

109-
CenterCrop
110132
ColorJitter
111-
FiveCrop
133+
v2.ColorJitter
112134
Grayscale
113-
Pad
114-
RandomAffine
115-
RandomApply
116-
RandomCrop
135+
v2.Grayscale
117136
RandomGrayscale
118-
RandomHorizontalFlip
119-
RandomPerspective
120-
RandomResizedCrop
121-
RandomRotation
122-
RandomVerticalFlip
123-
Resize
124-
TenCrop
137+
v2.RandomGrayscale
125138
GaussianBlur
139+
v2.GaussianBlur
126140
RandomInvert
141+
v2.RandomInvert
127142
RandomPosterize
143+
v2.RandomPosterize
128144
RandomSolarize
145+
v2.RandomSolarize
129146
RandomAdjustSharpness
147+
v2.RandomAdjustSharpness
130148
RandomAutocontrast
149+
v2.RandomAutocontrast
131150
RandomEqualize
151+
v2.RandomEqualize
132152

133-
134-
.. _transforms_pil_only:
135-
136-
Transforms on PIL Image only
137-
----------------------------
153+
Composition
154+
-----------
138155

139156
.. autosummary::
140157
:toctree: generated/
141158
:template: class.rst
142159

160+
Compose
161+
v2.Compose
162+
RandomApply
163+
v2.RandomApply
143164
RandomChoice
165+
v2.RandomChoice
144166
RandomOrder
167+
v2.RandomOrder
145168

146-
.. _transforms_tensor_only:
147-
148-
Transforms on torch.\*Tensor only
149-
---------------------------------
169+
Miscellaneous
170+
-------------
150171

151172
.. autosummary::
152173
:toctree: generated/
153174
:template: class.rst
154175

155176
LinearTransformation
177+
v2.LinearTransformation
156178
Normalize
179+
v2.Normalize
157180
RandomErasing
158-
ConvertImageDtype
181+
v2.RandomErasing
182+
Lambda
183+
v2.Lambda
159184

160185
.. _conversion_transforms:
161186

162-
Conversion Transforms
163-
---------------------
187+
Conversion
188+
----------
164189

165190
.. autosummary::
166191
:toctree: generated/
167192
:template: class.rst
168193

169194
ToPILImage
195+
v2.ToPILImage
196+
v2.ToImagePIL
170197
ToTensor
198+
v2.ToTensor
171199
PILToTensor
200+
v2.PILToTensor
201+
ConvertImageDtype
202+
v2.ConvertImageDtype
203+
v2.ConvertDtype
172204

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-
---------------------------------
205+
Auto-Augmentation
206+
-----------------
186207

187208
`AutoAugment <https://arxiv.org/pdf/1805.09501.pdf>`_ is a common Data Augmentation technique that can improve the accuracy of Image Classification models.
188209
Though the data augmentation policies are directly linked to their trained dataset, empirical studies show that
@@ -196,9 +217,13 @@ The new transform can be used standalone or mixed-and-matched with existing tran
196217

197218
AutoAugmentPolicy
198219
AutoAugment
220+
v2.AutoAugment
199221
RandAugment
222+
v2.RandAugment
200223
TrivialAugmentWide
224+
v2.TrivialAugmentWide
201225
AugMix
226+
v2.AugMix
202227

203228
.. _functional_transforms:
204229

packaging/build_conda.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ setup_visual_studio_constraint
1313
setup_junit_results_folder
1414
export CUDATOOLKIT_CHANNEL="nvidia"
1515

16-
conda build -c $CUDATOOLKIT_CHANNEL $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchvision
16+
if [[ "$PYTHON_VERSION" == "3.11" ]]; then
17+
export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c malfet"
18+
fi
19+
20+
conda build -c $CUDATOOLKIT_CHANNEL $CONDA_CHANNEL_FLAGS --no-anaconda-upload --no-test --python "$PYTHON_VERSION" packaging/torchvision

test/builtin_dataset_mocks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
import numpy as np
1919
import pytest
2020
import torch
21-
from datasets_utils import combinations_grid, create_image_file, create_image_folder, make_tar, make_zip
21+
from common_utils import combinations_grid
22+
from datasets_utils import create_image_file, create_image_folder, make_tar, make_zip
2223
from torch.nn.functional import one_hot
2324
from torch.testing import make_tensor as _make_tensor
2425
from torchvision.prototype import datasets

0 commit comments

Comments
 (0)