Skip to content
class

SomeOf

extends_Container
SomeOf(transforms: list[TransformLike], n: int = 1, p: float = 1.0)

Apply n randomly-chosen children (Albumentations SomeOf).

Parameters

transformslist of Transform
No description.
nint= 1
Number of children to apply (without replacement).
pfloat= 1.0
No description.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.SomeOf([T.HorizontalFlip(p=1.0), T.VerticalFlip(p=1.0),
...                T.Transpose(p=1.0)], n=2, p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)
Picks n of them each call, so an augmentation pipeline varies
without listing every combination.

Used by 1

Constructors

2
dunder

__init__

→None
__init__(transforms: list[TransformLike], n: int = 1, p: float = 1.0)
dunder

__call__

→object
__call__(inputs: object)

Instance methods

1
fn

make_params

→Emptyfrom _NoParams
make_params(img: Tensor)

Dunder methods

1