RPeaksDetectionOutput#

class torch_ecg.components.RPeaksDetectionOutput(*args: Any, **kwargs: Any)[source]#

Bases: BaseOutput

Class that maintains the output of an R peaks detection task.

Parameters:
  • rpeak_indices (Sequence[Sequence[int]]) – Rpeak indices for each batch sample.

  • prob (numpy.ndarray) – Probabilities at each time step (each sample point), of shape (batch_size, signal_length).

compute_metrics(fs: int, thr: float = 0.075) → ClassificationMetrics[source]#

Compute metrics from the output.

Parameters:
  • fs (int) – Sampling frequency of the signal corresponding to the masks.

  • thr (float, default 0.075) – Threshold for a prediction to be truth positive, with units in seconds.

Returns:

metrics – Metrics computed from the output.

Return type:

RPeaksDetectionMetrics

required_fields() → Set[str][source]#

The required fields of the output class.