GaussianBlur — Torchvision 0.22 documentation (original) (raw)

class torchvision.transforms.GaussianBlur(kernel_size, sigma=(0.1, 2.0))[source]

Blurs image with randomly chosen Gaussian blur. If the image is torch Tensor, it is expected to have […, C, H, W] shape, where … means at most one leading dimension.

Parameters:

Returns:

Gaussian blurred version of the input image.

Return type:

PIL Image or Tensor

Examples using GaussianBlur:

forward(img: Tensor) → Tensor[source]

Parameters:

img (PIL Image or Tensor) – image to be blurred.

Returns:

Gaussian blurred image

Return type:

PIL Image or Tensor

static get_params(sigma_min: float, sigma_max: float) → float[source]

Choose sigma for random gaussian blurring.

Parameters:

Returns:

Standard deviation to be passed to calculate kernel for gaussian blurring.

Return type:

float