class
TrivialAugmentWide
extends
PhotometricTransform[_SingleOpParams]TrivialAugmentWide(num_magnitude_bins: int = 31, interpolation: str | Interpolation = Interpolation.BILINEAR, fill: float = 0.0, p: float = 1.0)Trivial Augment Wide (Müller & Hutter, 2021 — arXiv:2103.10158).
Each call draws one op uniformly from the 14-op vocabulary and one
magnitude uniformly from [0, num_magnitude_bins). Despite its
simplicity it matches the accuracy of much more elaborate policies
(AutoAugment, RandAugment) on ImageNet — making it the default
"set-and-forget" augmentation in modern recipes.
Parameters
num_magnitude_binsint= 31Magnitude bin count. The wide variant uses 31; the original
TrivialAugment uses 10. Larger values give a finer magnitude
grid.
Resample mode for the geometric ops (Shear / Translate /
Rotate).
fillfloat= 0.0Border fill value for the geometric warps.
pfloat= 1.0Probability of applying the policy at all. TrivialAugment is
designed to fire every call (Identity is one of the 14 ops, so
~7% of calls are no-ops by virtue of the op draw); the
p
knob is provided for compositional consistency, not because
p < 1 is recommended.Notes
Photometric (image-only) by Lucid convention — see the module docstring.
Examples
>>> import lucid
>>> from lucid.utils.transforms import TrivialAugmentWide
>>> tf = TrivialAugmentWide()
>>> x = lucid.rand(3, 224, 224)
>>> y = tf(x)
>>> tuple(y.shape)
(3, 224, 224)Used by 2
Constructors
1Instance methods
1Sample per-call random parameters for TrivialAugmentWide.
Parameters
imgTensorImage tensor; not inspected, carried through for dispatch.
Returns
_SingleOpParamsCarries the sampled op_name (uniform over the 14-op
vocabulary) and magnitude — either 0.0 for ops in
NO_MAGNITUDE_OPS, or
magnitudes[mag_idx] (with a random sign for ops in
SIGNED_OPS) where mag_idx is uniform over
[0, num_magnitude_bins).