Skip to content

Factory Utils

Source

Utility to handle augmentation configuration.

assemble_augmentations(augmentations, seed=None)

Assemble a list of augmentations.

Parameters:

  • augmentations (Sequence of {"x_flip", "y_flip", "rotate_90"} or None) –

    List of augmentations to apply. If None, all augmentations are applied.

  • seed (int | None, default: None ) –

    Random seed for reproducibility.

Returns:

  • list of augmentations –

    List of augmentations to apply.

validate_input_channels(axes, channels, n_channels, attr_name='n_channels')

Validate channel dimensions.

Parameters:

  • axes (str) –

    Axes of the data (e.g. SYX).

  • channels (Sequence[int] | None) –

    List of channels to use. If None, all channels are used.

  • n_channels (int | None) –

    Number of channels (in and out). If channels is specified, then the number of channels is inferred from its length and this parameter is ignored.

  • attr_name (str, default: 'n_channels' ) –

    Name of the attribute to use in error messages (default: "n_channels").

Raises:

  • ValueError –

    If channels is specified but axes does not include "C". If channels is specified but is empty. If channels is specified but its length does not match n_channels. If n_channels is specified but axes does not include "C".