Unverified Commit 2f225833 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Add auto-augment introduced transforms in docs (#3793)

* Add auto-augment introduced transforms in docs.

* Adding examples in Gallery.

* Make posterize more extreme.
parent 851b623c
...@@ -136,6 +136,24 @@ Transforms on PIL Image and torch.\*Tensor ...@@ -136,6 +136,24 @@ Transforms on PIL Image and torch.\*Tensor
.. autoclass:: GaussianBlur .. autoclass:: GaussianBlur
:members: :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
......
...@@ -167,6 +167,68 @@ resize_cropper = T.RandomResizedCrop(size=(32, 32)) ...@@ -167,6 +167,68 @@ resize_cropper = T.RandomResizedCrop(size=(32, 32))
resized_crops = [resize_cropper(orig_img) for _ in range(4)] resized_crops = [resize_cropper(orig_img) for _ in range(4)]
plot(resized_crops) plot(resized_crops)
####################################
# RandomInvert
# ~~~~~~~~~~~~
# The :class:`~torchvision.transforms.RandomInvert` transform
# (see also :func:`~torchvision.transforms.functional.invert`)
# randomly inverts the colors of the given image.
inverter = T.RandomInvert()
invertered_imgs = [inverter(orig_img) for _ in range(4)]
plot(invertered_imgs)
####################################
# RandomPosterize
# ~~~~~~~~~~~~~~~
# The :class:`~torchvision.transforms.RandomPosterize` transform
# (see also :func:`~torchvision.transforms.functional.posterize`)
# randomly posterizes the image by reducing the number of bits
# of each color channel.
posterizer = T.RandomPosterize(bits=2)
posterized_imgs = [posterizer(orig_img) for _ in range(4)]
plot(posterized_imgs)
####################################
# RandomSolarize
# ~~~~~~~~~~~~~~
# The :class:`~torchvision.transforms.RandomSolarize` transform
# (see also :func:`~torchvision.transforms.functional.solarize`)
# randomly solarizes the image by inverting all pixel values above
# the threshold.
solarizer = T.RandomSolarize(threshold=192.0)
solarized_imgs = [solarizer(orig_img) for _ in range(4)]
plot(solarized_imgs)
####################################
# RandomAdjustSharpness
# ~~~~~~~~~~~~~~~~~~~~~
# The :class:`~torchvision.transforms.RandomAdjustSharpness` transform
# (see also :func:`~torchvision.transforms.functional.adjust_sharpness`)
# randomly adjusts the sharpness of the given image.
sharpness_adjuster = T.RandomAdjustSharpness(sharpness_factor=2)
sharpened_imgs = [sharpness_adjuster(orig_img) for _ in range(4)]
plot(sharpened_imgs)
####################################
# RandomAutocontrast
# ~~~~~~~~~~~~~~~~~~
# The :class:`~torchvision.transforms.RandomAutocontrast` transform
# (see also :func:`~torchvision.transforms.functional.autocontrast`)
# randomly applies autocontrast to the given image.
autocontraster = T.RandomAutocontrast()
autocontrasted_imgs = [autocontraster(orig_img) for _ in range(4)]
plot(autocontrasted_imgs)
####################################
# RandomEqualize
# ~~~~~~~~~~~~~~
# The :class:`~torchvision.transforms.RandomEqualize` transform
# (see also :func:`~torchvision.transforms.functional.equalize`)
# randomly equalizes the histogram of the given image.
equalizer = T.RandomEqualize()
equalized_imgs = [equalizer(orig_img) for _ in range(4)]
plot(equalized_imgs)
#################################### ####################################
# AutoAugment # AutoAugment
# ~~~~~~~~~~~ # ~~~~~~~~~~~
......
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