Skip to content
class

ColorJitter

extendsPhotometricTransform[ColorJitterParams]
ColorJitter(brightness: float | tuple[float, float] = 0.2, contrast: float | tuple[float, float] = 0.2, saturation: float | tuple[float, float] = 0.2, hue: float | tuple[float, float] = 0.2, p: float = 0.5)

Randomly jitter brightness/contrast/saturation/hue.

Albumentations ColorJitter — each factor is sampled uniformly from its range and the four adjustments are applied in random order.

Parameters

brightnessfloat or (float, float)= 0.2
Scalar v → range [max(0, 1-v), 1+v]; tuple used directly.
contrastfloat or (float, float)= 0.2
Scalar v → range [max(0, 1-v), 1+v]; tuple used directly.
saturationfloat or (float, float)= 0.2
Scalar v → range [max(0, 1-v), 1+v]; tuple used directly.
huefloat or (float, float)= 0.2
Scalar v → [-v, v] (v ≤ 0.5).
pfloat= 0.5
No description.

Examples

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

Used by 2

Constructors

1
dunder

__init__

→None
__init__(brightness: float | tuple[float, float] = 0.2, contrast: float | tuple[float, float] = 0.2, saturation: float | tuple[float, float] = 0.2, hue: float | tuple[float, float] = 0.2, p: float = 0.5)

Instance methods

1
fn

make_params

→ColorJitterParams
make_params(img: Tensor)

Sample the per-call parameters from the reference image.

Dunder methods

1