Skip to content
class

RandomBrightness

extendsPhotometricTransform[ScalarParams]
RandomBrightness(limit: float | tuple[float, float] = 0.2, p: float = 0.5)

Randomly perturb brightness only (Albumentations RandomBrightness).

Samples an additive brightness offset uniformly from limit, adds it to the image, and clips to [0, 1]. Equivalent to the brightness leg of RandomBrightnessContrast — included as a standalone class for parity with the Albumentations API.

Parameters

limitfloat or (float, float)= 0.2
Additive brightness offset range. Scalar v is interpreted as the symmetric range (-v, v).
pfloat= 0.5
Probability of applying the transform.

Examples

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

Used by 1

Constructors

1
dunder

__init__

→None
__init__(limit: float | tuple[float, float] = 0.2, p: float = 0.5)

Instance methods

1
fn

make_params

→ScalarParams
make_params(img: Tensor)

Sample per-call random parameters for RandomBrightness.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

ScalarParams

Carries value — the additive brightness offset drawn uniformly from limit.

Dunder methods

1