Skip to content

Commit 0dff39f

Browse files
authored
Merge branch 'main' into kill-circleci
2 parents 7d2bed7 + 285500d commit 0dff39f

File tree

5 files changed

+74
-55
lines changed

5 files changed

+74
-55
lines changed

.github/scripts/setup-env.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ if [[ "${OS_TYPE}" == "macos" && $(uname -m) == x86_64 ]]; then
2727
# The x86 macOS runners, e.g. the GitHub Actions native "macos-12" runner, has some JPEG and PNG libraries
2828
# installed by default that interfere with our build. We uninstall them here and use the one from conda below.
2929
IMAGE_LIBS=$(brew list | grep -E "jpeg|png")
30-
echo "${IMAGE_LIBS}"
31-
for lib in "${IMAGE_LIBS}"; do
32-
brew uninstall --ignore-dependencies --force "${lib}" || true
30+
for lib in $IMAGE_LIBS; do
31+
brew uninstall --ignore-dependencies --force "${lib}"
3332
done
3433
echo '::endgroup::'
3534
fi

.github/workflows/prototype-tests-linux-gpu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- python-version: "3.8"
1919
runner: linux.g5.4xlarge.nvidia.gpu
2020
gpu-arch-type: cuda
21-
gpu-arch-version: "11.7"
21+
gpu-arch-version: "11.8"
2222
fail-fast: false
2323
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
2424
with:

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- python-version: 3.8
2525
runner: linux.g5.4xlarge.nvidia.gpu
2626
gpu-arch-type: cuda
27-
gpu-arch-version: "11.7"
27+
gpu-arch-version: "11.8"
2828
fail-fast: false
2929
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
3030
with:
@@ -85,7 +85,7 @@ jobs:
8585
- python-version: "3.8"
8686
runner: windows.g5.4xlarge.nvidia.gpu
8787
gpu-arch-type: cuda
88-
gpu-arch-version: "11.7"
88+
gpu-arch-version: "11.8"
8989
fail-fast: false
9090
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
9191
with:

gallery/plot_transforms.py

Lines changed: 64 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,23 @@ def plot(imgs, with_orig=True, row_title=None, **imshow_kwargs):
5151

5252

5353
####################################
54+
# Geometric Transforms
55+
# --------------------
56+
# Geometric image transformation refers to the process of altering the geometric properties of an image,
57+
# such as its shape, size, orientation, or position.
58+
# It involves applying mathematical operations to the image pixels or coordinates to achieve the desired transformation.
59+
#
5460
# Pad
55-
# ---
61+
# ~~~
5662
# The :class:`~torchvision.transforms.Pad` transform
5763
# (see also :func:`~torchvision.transforms.functional.pad`)
58-
# fills image borders with some pixel values.
64+
# pads all image borders with some pixel values.
5965
padded_imgs = [T.Pad(padding=padding)(orig_img) for padding in (3, 10, 30, 50)]
6066
plot(padded_imgs)
6167

6268
####################################
6369
# Resize
64-
# ------
70+
# ~~~~~~
6571
# The :class:`~torchvision.transforms.Resize` transform
6672
# (see also :func:`~torchvision.transforms.functional.resize`)
6773
# resizes an image.
@@ -70,7 +76,7 @@ def plot(imgs, with_orig=True, row_title=None, **imshow_kwargs):
7076

7177
####################################
7278
# CenterCrop
73-
# ----------
79+
# ~~~~~~~~~~
7480
# The :class:`~torchvision.transforms.CenterCrop` transform
7581
# (see also :func:`~torchvision.transforms.functional.center_crop`)
7682
# crops the given image at the center.
@@ -79,46 +85,13 @@ def plot(imgs, with_orig=True, row_title=None, **imshow_kwargs):
7985

8086
####################################
8187
# FiveCrop
82-
# --------
88+
# ~~~~~~~~
8389
# The :class:`~torchvision.transforms.FiveCrop` transform
8490
# (see also :func:`~torchvision.transforms.functional.five_crop`)
8591
# crops the given image into four corners and the central crop.
8692
(top_left, top_right, bottom_left, bottom_right, center) = T.FiveCrop(size=(100, 100))(orig_img)
8793
plot([top_left, top_right, bottom_left, bottom_right, center])
8894

89-
####################################
90-
# Grayscale
91-
# ---------
92-
# The :class:`~torchvision.transforms.Grayscale` transform
93-
# (see also :func:`~torchvision.transforms.functional.to_grayscale`)
94-
# converts an image to grayscale
95-
gray_img = T.Grayscale()(orig_img)
96-
plot([gray_img], cmap='gray')
97-
98-
####################################
99-
# Random transforms
100-
# -----------------
101-
# The following transforms are random, which means that the same transfomer
102-
# instance will produce different result each time it transforms a given image.
103-
#
104-
# ColorJitter
105-
# ~~~~~~~~~~~
106-
# The :class:`~torchvision.transforms.ColorJitter` transform
107-
# randomly changes the brightness, saturation, and other properties of an image.
108-
jitter = T.ColorJitter(brightness=.5, hue=.3)
109-
jitted_imgs = [jitter(orig_img) for _ in range(4)]
110-
plot(jitted_imgs)
111-
112-
####################################
113-
# GaussianBlur
114-
# ~~~~~~~~~~~~
115-
# The :class:`~torchvision.transforms.GaussianBlur` transform
116-
# (see also :func:`~torchvision.transforms.functional.gaussian_blur`)
117-
# performs gaussian blur transform on an image.
118-
blurrer = T.GaussianBlur(kernel_size=(5, 9), sigma=(0.1, 5))
119-
blurred_imgs = [blurrer(orig_img) for _ in range(4)]
120-
plot(blurred_imgs)
121-
12295
####################################
12396
# RandomPerspective
12497
# ~~~~~~~~~~~~~~~~~
@@ -181,6 +154,45 @@ def plot(imgs, with_orig=True, row_title=None, **imshow_kwargs):
181154
resized_crops = [resize_cropper(orig_img) for _ in range(4)]
182155
plot(resized_crops)
183156

157+
####################################
158+
# Photometric Transforms
159+
# ----------------------
160+
# Photometric image transformation refers to the process of modifying the photometric properties of an image,
161+
# such as its brightness, contrast, color, or tone.
162+
# These transformations are applied to change the visual appearance of an image
163+
# while preserving its geometric structure.
164+
#
165+
# Except :class:`~torchvision.transforms.Grayscale`, the following transforms are random,
166+
# which means that the same transform
167+
# instance will produce different result each time it transforms a given image.
168+
#
169+
# Grayscale
170+
# ~~~~~~~~~
171+
# The :class:`~torchvision.transforms.Grayscale` transform
172+
# (see also :func:`~torchvision.transforms.functional.to_grayscale`)
173+
# converts an image to grayscale
174+
gray_img = T.Grayscale()(orig_img)
175+
plot([gray_img], cmap='gray')
176+
177+
####################################
178+
# ColorJitter
179+
# ~~~~~~~~~~~
180+
# The :class:`~torchvision.transforms.ColorJitter` transform
181+
# randomly changes the brightness, contrast, saturation, hue, and other properties of an image.
182+
jitter = T.ColorJitter(brightness=.5, hue=.3)
183+
jitted_imgs = [jitter(orig_img) for _ in range(4)]
184+
plot(jitted_imgs)
185+
186+
####################################
187+
# GaussianBlur
188+
# ~~~~~~~~~~~~
189+
# The :class:`~torchvision.transforms.GaussianBlur` transform
190+
# (see also :func:`~torchvision.transforms.functional.gaussian_blur`)
191+
# performs gaussian blur transform on an image.
192+
blurrer = T.GaussianBlur(kernel_size=(5, 9), sigma=(0.1, 5))
193+
blurred_imgs = [blurrer(orig_img) for _ in range(4)]
194+
plot(blurred_imgs)
195+
184196
####################################
185197
# RandomInvert
186198
# ~~~~~~~~~~~~
@@ -244,6 +256,11 @@ def plot(imgs, with_orig=True, row_title=None, **imshow_kwargs):
244256
plot(equalized_imgs)
245257

246258
####################################
259+
# Augmentation Transforms
260+
# -----------------------
261+
# The following transforms are combinations of multiple transforms,
262+
# either geometric or photometric, or both.
263+
#
247264
# AutoAugment
248265
# ~~~~~~~~~~~
249266
# The :class:`~torchvision.transforms.AutoAugment` transform
@@ -261,34 +278,36 @@ def plot(imgs, with_orig=True, row_title=None, **imshow_kwargs):
261278
####################################
262279
# RandAugment
263280
# ~~~~~~~~~~~
264-
# The :class:`~torchvision.transforms.RandAugment` transform automatically augments the data.
281+
# The :class:`~torchvision.transforms.RandAugment` is an alternate version of AutoAugment.
265282
augmenter = T.RandAugment()
266283
imgs = [augmenter(orig_img) for _ in range(4)]
267284
plot(imgs)
268285

269286
####################################
270287
# TrivialAugmentWide
271288
# ~~~~~~~~~~~~~~~~~~
272-
# The :class:`~torchvision.transforms.TrivialAugmentWide` transform automatically augments the data.
289+
# The :class:`~torchvision.transforms.TrivialAugmentWide` is an alternate implementation of AutoAugment.
290+
# However, instead of transforming an image multiple times, it transforms an image only once
291+
# using a random transform from a given list with a random strength number.
273292
augmenter = T.TrivialAugmentWide()
274293
imgs = [augmenter(orig_img) for _ in range(4)]
275294
plot(imgs)
276295

277296
####################################
278297
# AugMix
279298
# ~~~~~~
280-
# The :class:`~torchvision.transforms.AugMix` transform automatically augments the data.
299+
# The :class:`~torchvision.transforms.AugMix` transform interpolates between augmented versions of an image.
281300
augmenter = T.AugMix()
282301
imgs = [augmenter(orig_img) for _ in range(4)]
283302
plot(imgs)
284303

285304
####################################
286-
# Randomly-applied transforms
305+
# Randomly-applied Transforms
287306
# ---------------------------
288307
#
289-
# Some transforms are randomly-applied given a probability ``p``. That is, the
290-
# transformed image may actually be the same as the original one, even when
291-
# called with the same transformer instance!
308+
# The following transforms are randomly-applied given a probability ``p``. That is, given ``p = 0.5``,
309+
# there is a 50% chance to return the original image, and a 50% chance to return the transformed image,
310+
# even when called with the same transform instance!
292311
#
293312
# RandomHorizontalFlip
294313
# ~~~~~~~~~~~~~~~~~~~~

test/test_models.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,11 @@ def test_classification_model(model_fn, dev):
682682
model_name = model_fn.__name__
683683
if SKIP_BIG_MODEL and is_skippable(model_name, dev):
684684
pytest.skip("Skipped to reduce memory usage. Set env var SKIP_BIG_MODEL=0 to enable test for this model")
685-
if model_name == "vit_h_14" and dev == "cuda":
686-
# TODO: investigate why this fail on CI. It doesn't fail on AWS cluster with CUDA 11.6
687-
# (can't test with later versions ATM)
688-
pytest.xfail("https://github.com/pytorch/vision/issues/7143")
685+
if model_name == "resnet101" and dev == "cuda":
686+
# TODO: Investigate the Failure with CUDA 11.8: https://github.com/pytorch/vision/issues/7618
687+
# TODO: Investigate/followup on previous failure: https://github.com/pytorch/vision/issues/7143
688+
# its not happening on CI with CUDA 11.8 anymore. Follow up is needed if its still not resolved.
689+
pytest.xfail("https://github.com/pytorch/vision/issues/7618")
689690
kwargs = {**defaults, **_model_params.get(model_name, {})}
690691
num_classes = kwargs.get("num_classes")
691692
input_shape = kwargs.pop("input_shape")

0 commit comments

Comments
 (0)