Skip to content
class

RandomRotate90

extendsGeometricTransform[Rot90Param]
RandomRotate90(p: float = 0.5)

Rotate by a random multiple of 90° (Albumentations RandomRotate90).

Samples k uniformly from {0, 1, 2, 3} and applies lucid.rot90 with that k to image / mask, plus the matching coordinate transform to boxes / keypoints. Exact (no interpolation), so it's a free augmentation for square inputs.

Parameters

pfloat= 0.5
Probability of applying the rotation.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.RandomRotate90(p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)

Used by 1

Constructors

1
dunder

__init__

→None
__init__(p: float = 0.5)

Instance methods

1
fn

make_params

→Rot90Param
make_params(img: Tensor)

Sample per-call random parameters for RandomRotate90.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

Rot90Param

Carries k drawn uniformly from {0, 1, 2, 3}.

Dunder methods

1