Skip to content
class

MultiplicativeNoise

extendsPhotometricTransform[MultiplierParam]
MultiplicativeNoise(multiplier: tuple[float, float] = (0.9, 1.1), elementwise: bool = False, p: float = 0.5)

Multiply pixel values by random noise (Albumentations MultiplicativeNoise).

With elementwise=False (default) a single scalar is sampled per call and the whole image is scaled by it; with elementwise=True an independent multiplier is sampled per pixel. The output is always clipped back to [0, 1].

Parameters

multiplier(float, float)= (0.9, 1.1)
Inclusive range of the per-pixel (or per-image) multiplier.
elementwisebool= False
If True, sample one multiplier per pixel rather than one per image.
pfloat= 0.5
Probability of applying the transform.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.MultiplicativeNoise(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__(multiplier: tuple[float, float] = (0.9, 1.1), elementwise: bool = False, p: float = 0.5)

Instance methods

1
fn

make_params

→MultiplierParam
make_params(img: Tensor)

Sample per-call random parameters for MultiplicativeNoise.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

MultiplierParam

Carries the constructor's multiplier bounds verbatim (lo, hi). The actual scalar / per-pixel multiplier draw is deferred to the apply step so elementwise can switch between the two regimes without re-running the sampling head.

Dunder methods

1