Skip to content
class

Blur

extendsPhotometricTransform[KSizeParam]
Blur(blur_limit: int = 7, p: float = 0.5)

Box (mean) blur with a random odd kernel size (Albumentations Blur).

Samples an odd kernel size k uniformly from [3, blur_limit] and convolves the image with a normalised k x k all-ones kernel via functional.depthwise_conv2d.

Parameters

blur_limitint= 7
Inclusive upper bound on the sampled kernel size; values are rounded up to the next odd integer to keep the kernel centred.
pfloat= 0.5
Probability of applying the transform.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.Blur(p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)

Used by 1

Constructors

1
dunder

__init__

→None
__init__(blur_limit: int = 7, p: float = 0.5)

Instance methods

1
fn

make_params

→KSizeParam
make_params(img: Tensor)

Sample per-call random parameters for Blur.

Parameters

Image tensor used only to fix the parameter dtype / dispatch context; no spatial information is read.

Returns

KSizeParam

Carries ksize — the odd box-kernel side length sampled uniformly from [3, blur_limit].

Notes

Even draws are forced to the next odd integer so the kernel stays centred on each output pixel.

Dunder methods

1