Skip to content
class

D4

extendsGeometricTransform[D4Param]
D4(p: float = 1.0)

Random element of the dihedral group D4 (Albumentations D4).

The 8 symmetries of a square = rot90^k (k∈0..3) optionally followed by a horizontal flip.

Parameters

pfloat= 1.0
Probability of applying the transform; otherwise the input passes through unchanged.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.D4(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 = 1.0)

Instance methods

1
fn

make_params

→D4Param
make_params(img: Tensor)

Sample per-call random parameters for D4.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

D4Param

Carries k (rot90 count, 0..3) and flip (whether to follow with a horizontal flip). The two together uniformly cover the 8 elements of the square-symmetry group D4.

Dunder methods

1