class
RandomToneCurve
extends
PhotometricTransform[ScalarParams]RandomToneCurve(scale: float = 0.1, p: float = 0.5)Apply a random S-shaped tone curve around midtones (Albumentations RandomToneCurve).
Samples an amount a uniformly from (-scale, scale) and adds
a * sin(2 * pi * x) to the clipped image. The sine wave biases
midtones up (if a > 0) or down (if a < 0) while leaving the
deep shadows and bright highlights near identity, producing a
classic photographic S-curve.
Parameters
scalefloat= 0.1Half-width of the symmetric range from which the tone-curve
amount is sampled (uniform
(-scale, scale)).pfloat= 0.5Probability of applying the transform.
Examples
>>> import lucid
>>> import lucid.utils.transforms as T
>>> tf = T.RandomToneCurve(scale=0.1, 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 RandomToneCurve.
Parameters
imgTensorImage tensor; not inspected, carried through for dispatch.
Returns
ScalarParamsCarries value — the S-curve amount drawn uniformly
from (-scale, scale); positive values brighten
midtones, negative values darken them.