Data augmentation feature to blur your images

This data augmentation feature allows you to blur your images with certain probabilities. The intensity of the blur can also be adjusted by adjusting the "Blur Limit"


Blur Limit

The blur limit sets the range of kernel used in the convolution process to blur the image.

The blur effect is more pronounced with large kernel.

Blur with kernel size=5
Blur with kernel size =11


This sets the probability of the images being blurred. With large probability, the expected number of blurred images goes high. With probability 1, all images are blurred.

Code Implementation

import albumentations as albu
from PIL import Image
import numpy as np
transform =albu.Blur(blur_limit=3, p=0.5)
image = np.array('/some/image/file/path'))
image = transform(image=image)['image']
# Now the image is blurred and ready to be accepted by the model

Further Resources