class
PixelDropout
extends
PhotometricTransform[PixelMaskParams]PixelDropout(dropout_prob: float = 0.01, per_channel: bool = False, drop_value: float = 0.0, p: float = 0.5)Randomly set individual pixels to a fill value (Albumentations PixelDropout).
Samples a per-pixel Bernoulli mask with drop probability
dropout_prob and replaces masked pixels with drop_value
using a multiplicative keep-mask + additive fill (autograd-friendly,
no in-place writes). When per_channel=True the mask is sampled
independently for each channel; otherwise a single mask is broadcast
across channels.
Parameters
dropout_probfloat= 0.01Independent per-pixel drop probability.
per_channelbool= FalseIf
True, sample the dropout mask independently per channel.
If False, a single mask is shared across channels so dropped
pixels go to the fill value in all channels at once.drop_valuefloat= 0.0Value written into dropped pixels.
pfloat= 0.5Probability of applying the transform.
Examples
>>> import lucid
>>> import lucid.utils.transforms as T
>>> tf = T.PixelDropout(dropout_prob=0.05, per_channel=False, 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 PixelDropout.
Parameters
imgTensorImage tensor; its channel count and spatial size are read
to size the Bernoulli keep-mask.
Returns
PixelMaskParamsCarries mask — a per-pixel keep mask of shape
(C, H, W) (when per_channel=True) or (1, H, W)
(otherwise), with each entry independently 1 with
probability 1 - dropout_prob.