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:

Name Type Description
algorithm {n2v, care, n2n, pn2v}

Algorithm to use.

loss {n2v, mae, mse}

Loss function to use.

model UNetConfig

Model architecture to use.

optimizer (OptimizerConfig, optional)

Optimizer to use.

lr_scheduler (LrSchedulerConfig, optional)

Learning rate scheduler to use.

Raises:

Type Description
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.

get_compatible_algorithms() classmethod

Get the list of compatible algorithms.

Returns:

Type Description
list of str

List of compatible algorithms.