class
RandomGamma
extends
PhotometricTransform[ScalarParams]RandomGamma(gamma_limit: tuple[int, int] = (80, 120), p: float = 0.5)Random gamma correction (Albumentations RandomGamma).
Samples a gamma value uniformly from gamma_limit / 100 and
applies img ** gamma after clipping the input to [0, 1].
Gamma < 1 brightens midtones; gamma > 1 darkens them.
Parameters
gamma_limit(int, int)= (80, 120)Inclusive range of the gamma exponent expressed in percent
(matches Albumentations' integer-percent convention). Sampled
gamma is
randint(gamma_limit[0], gamma_limit[1]) / 100.pfloat= 0.5Probability of applying the transform.
Examples
>>> import lucid
>>> import lucid.utils.transforms as T
>>> tf = T.RandomGamma(gamma_limit=(80, 120), 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 RandomGamma.
Parameters
imgTensorImage tensor; not inspected, carried through for dispatch.
Returns
ScalarParamsCarries value — the gamma exponent, drawn uniformly
from gamma_limit and divided by 100 to convert the
integer-percent input to a real exponent.