class
OneOrOther
extends
_ContainerOneOrOther(first: TransformLike, second: TransformLike, p: float = 0.5)Apply first with probability p else second (Albumentations OneOrOther).
A two-way categorical: every call invokes either first or
second, never both, never neither. The selected child is
forced to run with its own probability gate bypassed — p here
is the switch between the two branches, not a skip-probability,
so the container has effective probability 1.
Parameters
firstTransformLikeChild invoked when the per-call uniform sample is below
p.secondTransformLikeChild invoked otherwise.
pfloat= 0.5Switch probability;
0.5 gives the two branches equal odds.Examples
>>> import lucid.utils.transforms as T
>>> tf = T.OneOrOther(
... first=T.HorizontalFlip(p=1.0),
... second=T.VerticalFlip(p=1.0),
... p=0.7,
... )