Gaussian Noise

This data augmentation tool adds gaussian noise to the training images such the testing becomes robust against these noises.

Gaussian noise is a statistical noise having probability density function equal to normal distribution. Normal distribution is characterized by its mean and variance.

Parameters

Variance Limit

This defines the range of variance for the gaussian distribution. The amount of noise present in the image is directly proportional to the variance.

Mean

The mean of the gaussian distribution tells us the point at which the value of the distribution is highest.

Setting the mean to 0 means that the peak of the curve will be located at the origin.

Bivariate Gaussian curves. The inner curve has low variance and the outer has a higher variance
Lena's image with gaussian noise

Code implementation


import albumentations as albu
from PIL import Image
import numpy as np

transform =albu.GaussianNoise(var_limit=(10,50),mean=0,p=0.5)

image = np.array(Image.open('/some/image/file/path'))
image = transform(image=image)['image']

# Now the image is transformed and ready to be accepted by the model

Further Resources

Last updated on Jun 01, 2022

Get AI confident. Start using Hasty today.

Automate 90% of the work, reduce your time to deployment by 40%, and replace your whole ML software stack with our platform.