Examples#
The benchmarks/ directory of the repository contains
eight complete, self-contained training examples – one per challenge /
database – written against the modern library API. They also serve
as the reference usage for the whole package: each one shows reader and
dataset usage, model construction, training with the library trainer, and
evaluation with the official challenge metrics where applicable.
Each benchmark is runnable as a module with a --smoke debug mode
(a few hundred iterations on a subset, no full training):
python -m benchmarks.train_crnn_cinc2021.train --help
python -m benchmarks.train_crnn_cinc2021.train --smoke
The examples#
Benchmark |
Task / Database |
Architectures |
|---|---|---|
|
26-class classification, CinC Challenge 2021 (all 6 lead sets) |
|
|
27-class classification, CinC Challenge 2020 (strict subset of the 2021 data) |
|
|
ECG waveform delineation, LUDB |
|
|
In-hospital arrhythmia detection, CPSC2019 |
|
|
LOC/RLOC regression, CPSC2021 (3 sub-tasks) |
|
|
End-to-end + segmentation challenge score, CPSC2020 |
|
|
24-class classification on ECG + metal-oxide gas sensors, CinC Challenge 2023 |
|
|
Multi-task (classification + regression) on circulatory sounds, CinC Challenge 2022 |
|
Points to note#
Determinism: every
train.pycallsseed_everything()and usesworker_init_fn; a given--seedfully determines the run.Library datasets/readers/metrics: the examples consume
torch_ecg.databasesreaders and datasets instead of local copies, and compute official challenge metrics via the library.Offline preparation:
train_hybrid_cpsc2021runs the (idempotent) offline preparation viapersistence()automatically.Checkpoints: written via
save()with the full model config, loadable withfrom_checkpoint().
Tests of the examples#
test/test_pipelines/ contains thin pytest wrappers over the
benchmarks (fast lanes run the non-downloading parts; the nightly full
suite trains briefly on real data), so the examples are continuously
verified against the library.