spacr.qt.widgets.training_monitor¶
Incrementally display loss and accuracy during model training.
The widget retains one plot item per metric and updates its data as epochs complete. This preserves the current view and avoids creating overlapping plot items during long training runs.
Classes¶
Display training metrics as incrementally updated curves. |
Module Contents¶
- class spacr.qt.widgets.training_monitor.TrainingMonitor(parent: PySide6.QtWidgets.QWidget | None = None)[source]¶
Bases:
PySide6.QtWidgets.QWidgetDisplay training metrics as incrementally updated curves.
plotsholds onepyqtgraph.PlotWidgetper panel, keyed"loss","accuracy"and"per_class".curvesholds thepyqtgraph.PlotDataItemfor each metric, created when that metric first appears and reused for every epoch after it.Both are populated as epochs arrive and neither is replaced, so a reference taken once stays valid for the life of the panel.
Build the panel that follows a training run’s losses and metrics.
- Parameters:
parent (QWidget, optional) – Parent widget, or
None.
- append(epoch: float, values: Dict[str, float]) int[source]¶
Append finite metric values for one epoch.
- Parameters:
epoch (float) – Epoch coordinate assigned to each accepted value.
values (dict of str to float) – Metric values keyed by series name. Names containing
lossare placed on the loss panel; aggregate accuracy names are placed on the accuracy panel; other names are treated as per-class metrics. Non-numeric and non-finite values are ignored.
- Returns:
int – Number of series updated.