Skip to content

CARE Module

Source

CARE Lightning Module.

CAREModule

Bases: LightningModule

CAREamics PyTorch Lightning module for CARE algorithm.

Parameters:

  • algorithm_config (CAREAlgorithm, N2NAlgorithm, or dict) –

    Configuration for the CARE algorithm, either as a CAREAlgorithm/N2NAlgorithm instance or a dictionary.

__init__(algorithm_config)

Instantiate CARE Module.

Parameters:

  • algorithm_config (CAREAlgorithm, N2NAlgorithm, or dict) –

    Configuration for the CARE algorithm, either as a CAREAlgorithm/N2NAlgorithm instance or a dictionary.

configure_optimizers()

Configure optimizer and learning rate scheduler.

Returns:

  • dict[str, Any]

    A dictionary containing the optimizer and learning rate scheduler.

forward(x)

Forward pass.

Parameters:

  • x (Tensor) –

    Input tensor.

Returns:

  • Tensor

    Model output tensor.

on_fit_start()

On fit start hook for CARE module.

Check that training and validation target data have been supplied.

predict_step(batch, batch_idx)

Prediction step for CARE module.

Parameters:

Returns:

training_step(batch, batch_idx)

Training step for CARE module.

Parameters:

  • batch ((ImageRegionData, ImageRegionData)) –

    A tuple containing the input data and the target data.

  • batch_idx (int) –

    The index of the current batch in the training loop.

Returns:

  • Tensor

    The loss value computed for the current batch.

validation_step(batch, batch_idx)

Validation step for CARE module.

Parameters:

  • batch ((ImageRegionData, ImageRegionData)) –

    A tuple containing the input data and the target data.

  • batch_idx (int) –

    The index of the current batch in the validation loop.