Skip to content
class

RandomGridShuffle

extendsGeometricTransform[ShuffleParam]
RandomGridShuffle(grid: tuple[int, int] = (3, 3), p: float = 0.5)

Split into a grid and shuffle the cells (Albumentations RandomGridShuffle).

Parameters

grid(int, int)= (3, 3)
Number of cells (rows, cols).
pfloat= 0.5
No description.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.RandomGridShuffle(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__(grid: tuple[int, int] = (3, 3), p: float = 0.5)

Instance methods

1
fn

make_params

→ShuffleParam
make_params(img: Tensor)

Sample per-call random parameters for RandomGridShuffle.

Parameters

Image tensor; not inspected, carried through for dispatch.

Returns

ShuffleParam

Carries perm (a Fisher-Yates permutation of the grid_h * grid_w cell indices in row-major order) and grid (the cell-grid shape verbatim from the constructor).

Dunder methods

1