Blur
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"

Parameters

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

Probability

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

1
import albumentations as albu
2
from PIL import Image
3
import numpy as np
4
โ€‹
5
transform =albu.Blur(blur_limit=3, p=0.5)
6
โ€‹
7
โ€‹
8
image = np.array(Image.open('/some/image/file/path'))
9
image = transform(image=image)['image']
10
โ€‹
11
# Now the image is blurred and ready to be accepted by the model
Copied!

Further Resources

โ€‹
Last modified 2mo ago