Skip to content

LVAE Config

Source

LVAE Pydantic model.

LVAEConfig

Bases: ArchitectureConfig

LVAE model.

decoder_conv_strides = Field(default=[2, 2], validate_default=True) class-attribute instance-attribute

Dimensions (2D or 3D) of the convolutional layers.

input_shape = Field(default=(64, 64), validate_default=True) class-attribute instance-attribute

Shape of the input patch (Z, Y, X) or (Y, X) if the data is 2D.

is_3D()

Return whether the model is 3D or not.

Returns:

  • bool

    Whether the model is 3D or not.

model_dump(**kwargs)

Dump the model as a dictionary, ignoring the architecture keyword.

Parameters:

  • **kwargs (Any, default: {} ) –

    Additional keyword arguments from Pydantic BaseModel model_dump method.

Returns:

  • {str: Any}

    Model as a dictionary.

set_3D(is_3D)

Set 3D model by setting the conv_dims parameters.

Parameters:

  • is_3D (bool) –

    Whether the algorithm is 3D or not.

validate_conv_strides()

Validate the convolutional strides.

Returns:

  • list

    Validated strides.

Raises:

  • ValueError

    If the number of strides is not 2.

validate_decoder_even(decoder_n_filters) classmethod

Validate that num_channels_init is even.

Parameters:

  • decoder_n_filters (int) –

    Number of channels.

Returns:

  • int

    Validated number of channels.

Raises:

  • ValueError

    If the number of channels is odd.

validate_encoder_even(encoder_n_filters) classmethod

Validate that num_channels_init is even.

Parameters:

  • encoder_n_filters (int) –

    Number of channels.

Returns:

  • int

    Validated number of channels.

Raises:

  • ValueError

    If the number of channels is odd.

validate_input_shape(input_shape) classmethod

Validate the input shape.

Parameters:

  • input_shape (list) –

    Shape of the input patch.

Returns:

  • list

    Validated input shape.

Raises:

  • ValueError

    If the number of dimensions is not 3 or 4.

validate_multiscale_count()

Validate the multiscale count.

Returns:

  • Self

    The validated model.

validate_z_dims(z_dims)

Validate the z_dims.

Parameters:

  • z_dims (tuple) –

    Tuple of z dimensions.

Returns:

  • tuple

    Validated z dimensions.

Raises:

  • ValueError

    If the number of z dimensions is not 4.