Skip to content

UNet Algorithm Config

Source

UNet-based algorithm Pydantic model.

UNetBasedAlgorithm

Bases: BaseModel

General UNet-based algorithm configuration.

This Pydantic model validates the parameters governing the components of the training algorithm: which algorithm, loss function, model architecture, optimizer, and learning rate scheduler to use.

Currently, we only support N2V, CARE, N2N, and PN2V algorithms. In order to train these algorithms, use the corresponding configuration child classes (e.g. N2VAlgorithm) to ensure coherent parameters (e.g. specific losses).

Attributes:

Raises:

  • ValueError

    Algorithm parameter type validation errors.

  • ValueError

    If the algorithm, loss and model are not compatible.

algorithm instance-attribute

Algorithm name, as defined in SupportedAlgorithm.

loss instance-attribute

Loss function to use, as defined in SupportedLoss.

lr_scheduler = LrSchedulerConfig() class-attribute instance-attribute

Learning rate scheduler to use, defined in SupportedLrScheduler.

model instance-attribute

UNet model configuration.

optimizer = OptimizerConfig() class-attribute instance-attribute

Optimizer to use, defined in SupportedOptimizer.

__str__()

Pretty string representing the configuration.

Returns:

  • str

    Pretty string.

get_num_input_channels()

Get the number of input channels.

Returns:

  • int

    Number of input channels.

uses_batch_norm()

Return whether the model uses batch normalization.

Returns:

  • bool

    Whether the model uses batch normalization.