Randomly permute the RGB channel order (Albumentations ChannelShuffle).
Samples a uniformly random permutation of (0, 1, 2) via a
Fisher-Yates shuffle, then reorders the channel axis accordingly.
No pixel arithmetic is performed — the operation is a pure slice +
concat, so it composes cleanly with autograd.
Parameters
pfloat= 0.5Probability of applying the transform.
Raises
ValueErrorIf the input image does not have exactly 3 channels.
Examples
>>> import lucid
>>> import lucid.utils.transforms as T
>>> tf = T.ChannelShuffle(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 ChannelShuffle.
Parameters
imgTensorImage tensor; not inspected, carried through for dispatch.
Returns
PermParamsCarries order — a uniformly-random permutation of
(0, 1, 2) produced by a Fisher-Yates shuffle.