class
RandomResizedCrop
extends
GeometricTransform[CropBox]RandomResizedCrop(height: int, width: int, scale: tuple[float, float] = (0.08, 1.0), ratio: tuple[float, float] = (3.0 / 4.0, 4.0 / 3.0), interpolation: int | str | Interpolation = 1, p: float = 1.0)Crop a random area/aspect region then resize to height x width.
Albumentations RandomResizedCrop.
Parameters
pfloat= 1.0Probability of applying the transform; otherwise the input
passes through unchanged.
Examples
>>> import lucid, lucid.utils.transforms as T
>>> tf = T.RandomResizedCrop(16, 16, p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 16, 16)Used by 2
Constructors
1Instance methods
1Sample per-call random parameters for RandomResizedCrop.
Parameters
imgTensorImage tensor; its spatial size sets the source area and
bounds the sampled crop window.
Returns
CropBoxCrop window (top, left, height, width) whose area
fraction is uniform in scale and whose aspect ratio is
log-uniform in ratio. Falls back to a centred,
ratio-clamped crop after 10 failed area / aspect draws so
the method always returns a valid window.