This adds the interface method configure_model_metric(stage: str) -> Optional[Metric] to the TaskModule class. Per default, it returns just None. Taskmodule implementations can override this to return a torchmetrics.Metric which should accept a batch of model outputs and targets. By having this method defined in the taskmodule, it is possible to use its unbatch_output and any available annotation decoding logic. Then, a PyTorchIEModel implementation can use this to easily create metrics that match the data without re-implementing any specific decoding logic.
This adds the interface method
configure_model_metric(stage: str) -> Optional[Metric]
to theTaskModule
class. Per default, it returns justNone
. Taskmodule implementations can override this to return atorchmetrics.Metric
which should accept a batch of model outputs and targets. By having this method defined in the taskmodule, it is possible to use itsunbatch_output
and any available annotation decoding logic. Then, aPyTorchIEModel
implementation can use this to easily create metrics that match the data without re-implementing any specific decoding logic.