PyTorch – torchvision.transforms – GaussianBlur()

Shahid Akhtar Khan
Published on 06-Jan-2022 11:42:24
The torchvision.transforms module provides many important transformations that can be used to perform different types of manipulations on the image data. GaussianBlur() transformation is used to blur an image with randomly chosen Gaussian blur.The GaussianBlur() transformation accepts both PIL and tensor images or a batch of tensor images. A tensor ... Read More

PyTorch – How to resize an image to a given size?

Shahid Akhtar Khan
Published on 06-Jan-2022 11:38:02
The Resize() transform resizes the input image to a given size. It's one of the transforms provided by the torchvision.transforms module. Resize() accepts both PIL and tensor images. A tensor image is a torch tensor with shape [C, H, W], where C is the number of channels, H is the ... Read More

PyTorch – torchvision.transforms – RandomVerticalFlip()

Shahid Akhtar Khan
Published on 06-Jan-2022 11:34:18
We apply RandomVerticalFlip() transform to flip an image vertically at a random angle with a given probability. It's one of the transforms provided by the torchvision.transforms module. This module contains many important transformations that can be used to perform different types of manipulations on the image data.RandomVerticalFlip() accepts both PIL ... Read More

PyTorch – How to rotate an image by an angle?

Shahid Akhtar Khan
Published on 06-Jan-2022 11:25:47
RandomRotation() rotates an image by a random angle. The chosen random angle is from a given range of angles in degree. RandomRotation() is one of the many important transforms provided by the torchvision.transforms module. RandomRotation() transform accepts both PIL and tensor images.A tensor image is a Torch tensor with shape ... Read More

PyTorch – torchvision.transforms – RandomResizedCrop()

Shahid Akhtar Khan
Published on 06-Jan-2022 11:21:39
RandomResizedCrop() transform crops a random area of the original input image. This crop size is randomly selected and finally the cropped image is resized to the given size. RandomResizedCrop() transform is one of the transforms provided by the torchvision.transforms module. This module contains many important transforms that can be used ... Read More

PyTorch – torchvision.transforms – RandomHorizontalFlip()

Shahid Akhtar Khan
Published on 06-Jan-2022 11:15:31
To flip an image horizontally in a random fashion with a given probability, we apply RandomHorizontalFlip() transform. It's one of the transforms provided by the torchvision.transforms module. This module contains many important transformations that can be used to perform different types of manipulations on the image data.RandomHorizontalFlip() accepts both PIL ... Read More

PyTorch – torchvision.transforms – RandomGrayscale()

Shahid Akhtar Khan
Published on 06-Jan-2022 11:08:27
To randomly convert an image to grayscale with a probability, we apply RandomGrayscale() transformation. It's one of the transforms provided by the torchvision.transforms module. This module contains many important transformations that can be used to perform different manipulations on the image data.RandomGrayscale() accepts both PIL and tensor images or a ... Read More

PyTorch – How to crop an image at a random location?

Shahid Akhtar Khan
Published on 06-Jan-2022 10:55:31
To crop an image at a random location, we apply RandomCrop() transformation. It's one of the many important transforms provided by the torchvision.transforms module.The RandomCrop() transformation accepts both PIL and tensor images. A tensor image is a torch tensor with shape [C, H, W], where C is the number of ... Read More

PyTorch – How to perform random affine transformation of an image?

Shahid Akhtar Khan
Published on 06-Jan-2022 10:36:47
To perform affine transformation of an image, we apply RandomAffine() transform. It's one of the many important transforms provided by the torchvision.transforms module.RandomAffine() transformation accepts both PIL and tensor images. A tensor image is a PyTorch tensor with shape [C, H, W], where C is the number of channels, H ... Read More

How to pad an image on all sides in PyTorch?

Shahid Akhtar Khan
Published on 06-Jan-2022 10:28:27
To pad an image on all sides, we can apply Pad() transform provided by the torchvision.transforms module. This module contains many important transformations that can be used to perform different types of manipulations on the image data.Pad() transformation accepts both PIL and tensor images or a batch of tensor images. ... Read More
Advertisements