RandomGaussianBlur#
- class torchaug.transforms.RandomGaussianBlur(kernel_size, sigma=(0.1, 2.0), p=0.5, value_check=False)[source]#
Blurs image with randomly chosen Gaussian blur.
The image is expected to have the shape […, C, H, W], where … means an arbitrary number of leading dimensions.
- Parameters:
kernel_size (
int|tuple[int,int]) – Size of the Gaussian kernel.sigma (
float|tuple[float,float], optional) – Standard deviation to be used for creating kernel to perform blurring. If float, sigma is fixed. If it is tuple of float (min, max), sigma is chosen uniformly at random to lie in the given range.Default:(0.1, 2.0)value_check (
bool, optional) – Bool to perform tensor value check. Might cause slow down on some devices because of synchronization.Default:False- apply_transform(img)[source]#
Blur the image.
- Parameters:
img (
Tensor) – Image to be blurred.- Return type:
Tensor- Returns:
Gaussian blurred image.
- static get_params(sigma_min, sigma_max)[source]#
Choose sigma for random gaussian blurring.
- Parameters:
sigma_min (
Tensor) – Minimum standard deviation that can be chosen for blurring kernel.sigma_max (
Tensor) – Maximum standard deviation that can be chosen for blurring kernel.
- Return type:
Tensor- Returns:
Standard deviation to be passed to calculate kernel for gaussian blurring.