class
Solarize
extends
PhotometricTransform[ScalarParams]Solarize(threshold: float | tuple[float, float] = 128, p: float = 0.5)Invert pixel intensities above a threshold (Albumentations Solarize).
Samples a threshold uniformly from threshold (on the 0-255
scale, divided by 255 internally), then replaces every pixel
x >= t with 1 - x, leaving pixels below the threshold
untouched. Classic photographic posterisation effect, also used by
AutoAugment / RandAugment.
Parameters
thresholdfloat or (float, float)= 128Threshold (0-255 scale) for the inversion cutoff. Scalar
v
is interpreted as the constant range (v, v); a tuple samples
the threshold uniformly per call.pfloat= 0.5Probability of applying the transform.
Examples
>>> import lucid
>>> import lucid.utils.transforms as T
>>> tf = T.Solarize(threshold=128, p=1.0)
>>> out = tf(T.Image(lucid.rand(3, 32, 32))).data
>>> tuple(out.shape)
(3, 32, 32)Used by 1
Constructors
1Instance methods
1Sample per-call random parameters for Solarize.
Parameters
imgTensorImage tensor; not inspected, carried through for dispatch.
Returns
ScalarParamsCarries value — the inversion threshold on the unit
scale (sampled from threshold on the 0-255 scale, then
divided by 255).