BatchRandomGaussianBlur#
- class torchaug.batch_transforms.BatchRandomGaussianBlur(kernel_size, sigma=(0.1, 2.0), p=0.5, inplace=False, value_check=False)[source]#
Blurs batch of images with randomly chosen Gaussian blur.
The batch of images is expected to be of shape [B, …, C, H, W] where … means an arbitrary number of 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)p (
float, optional) – Probability to apply gaussian blur.Default:0.5inplace (
bool, optional) – If True, perform inplace operation to save memory and time.Default:Falsevalue_check (
bool, optional) – Bool to perform tensor value check. Might cause slow down on some devices because of synchronization or large batch size.Default:False- apply_transform(imgs)[source]#
Blur the batch of images.
- Parameters:
imgs (
Tensor) – Batch of images to be blurred.- Return type:
Tensor- Returns:
Gaussian blurred images
- static get_params(sigma_min, sigma_max, batch_size)[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.batch_size (
int) – The number of samples to draw.
- Return type:
Tensor- Returns:
Standard deviation to calculate kernel for gaussian blurring.