The problem, and who has it
During labour, the baby's heart rate and the mother's contractions are recorded as a CTG (cardiotocograph) and read by eye. Experts often disagree: nine obstetricians reading the same 634 traces agreed on the overall classification only 48% of the time (Hruban et al., 2015). Errors cost lives in both directions. About 900,000 babies a year die during labour (UNICEF / UN IGME, 2023). Over-reading the trace raises caesarean rates without improving survival (Cochrane CD006066).
Who has it: a midwife or junior doctor on a busy labour ward, often without a senior on hand, who must decide whether a trace needs escalating.
What it does
CTG-Escalate is a second reader, never the decision-maker. It reads the last 60 minutes of fetal heart rate (FHR) and contractions and returns one of three outputs:
- 🔴 Escalate for senior review, with the risk of acidemia and the top features that drove it;
- 🟢 Continue routine monitoring, which is explicitly not reassurance;
- ⚠️ Check transducer: when too much signal is missing, it declines to score rather than guess.
It can also read a photo or scan of a paper CTG strip: it finds the grid, straightens a small tilt, traces the ink back into numbers, and runs the same frozen model.
How I built it (method)
- Data: the open CTU-UHB intrapartum CTG database (PhysioNet), with 552 labours, 4 Hz FHR and contractions, and umbilical-artery pH for every baby. Label: pH < 7.15 (acidemia); pH < 7.05 is a secondary label.
- Split discipline: before any feature or model code existed, I locked away 30% (166 labours) and recorded the list's SHA-256 hash. Every design choice was made on the other 386.
- Signal processing (no fitted parameters):
- remove artefacts and spikes;
- interpolate short gaps;
- measure signal loss;
- estimate the baseline iteratively;
- detect contractions.
- 29 clinical features: baseline and its drift, variability (including Dawes-style STV), accelerations, decelerations (depth, area, duration, prolonged, late-type) and their timing relative to contractions.
- Model: L2 logistic regression (C = 0.1) → Platt calibration → signal-loss gate. The rules were fixed in advance and applied to development data only:
- the model with the best development-CV AUROC is chosen;
- the gate is the cut-off that maximizes AUROC on answered traces while setting aside at most 15%;
- the threshold matches the FIGO rule's false-alarm rate, so the comparison is fair.
- Vision path: a deterministic digitizer for strip images (
ctg/strip.py). It fits the pink grid as a lattice (16 intervals of 10 bpm, and 8 contraction intervals), deskews up to ±3°, and reads the ink column by column.
Evaluation
Metrics: AUROC with 1,000-sample bootstrap 95% CIs; paired AUROC differences; and, in clinical units, escalations and missed acidemic births per 100 labours. Measurement: the frozen model was scored once on the 166 locked held-out labours (32 acidemic). evaluate.py checks the SHA-256 hashes of both the held-out list and the model before running, and logs every run.
| Held-out (166 labours) | AUROC (95% CI) |
|---|---|
| CTG-Escalate | 0.739 (0.628–0.834) |
| Computerized FIGO rule (B0) | 0.639 (0.537–0.734) |
| Logistic regression, 7 FIGO features (B1) | 0.728 (0.622–0.830) |
| Gradient boosting, 29 features (B2) | 0.788 (0.693–0.873) |
- vs the FIGO rule: +0.099 (95% CI +0.018 to +0.182), a real difference.
- Per 100 labours: CTG-Escalate raised 18.1 escalations and missed 9.0 acidemic births (15 of 32). The FIGO rule raised 13.9 escalations and missed 13.9 (23 of 32).
- Severe acidemia (pH < 7.05): it missed 3 of 13, against 8 of 13 for the rule. It declined to score 7.8% of traces.
Head-to-head with published deep learning (pre-registered): I re-implemented four published models and trained them on the same 386 labours, then scored each once on the same 166:
- multimodal CNN: 0.728;
- 1-D ResNet: 0.733;
- PatchTST from scratch: 0.660;
- PatchTST with 2026 "foundation model" masked pretraining, done leak-free on about 8,000 open hours: 0.688.
None beat CTG-Escalate. Every paired CI spans zero.
Reading from images: no public dataset of CTG images with outcomes exists, so I built one. I turned 15,068 open recordings into simulated phone photos (tilt, blur, uneven light, noise, JPEG), excluding both held-out sets.
- Failures: 0. Heart-rate error: 1.5 bpm median.
- Same decision as from the true signal: 95%.
- Predicting the experts' FIGO reading on 14,547 JNU-CTG recordings: AUROC 0.852 from the true signal, and 0.846 when a model trained on digital signals reads photos.
Scaling test: on 12,606 Chinese pregnancies (JNU-CTG), the features predicted the obstetricians' FIGO reading with AUROC 0.84 (held out, n = 3,782). Traces recorded 1–2 weeks before birth could not predict asphyxia (0.52, with the experts at 0.53), so the model must not be used outside labour.
Where the result stops being useful:
- Ranking: it did not beat the simple 7-feature logistic regression, and gradient boosting, which I rejected during development, scored higher on held-out data. The CIs overlap, so the model ranking is inconclusive.
- Gate: the signal gate did not demonstrably improve accuracy.
- Improvement search: a nested-CV search on development data (tuned LR, elastic net, splines, GBM, CNN, LR + CNN) found nothing that beat v1.
Reproduce:
bash scripts/download_data.sh && python scripts/build_features.py
python evaluate.py --split holdout --seed 20261204 --rerun-reason "reproduction"
The seed, config.yaml and the frozen models are all in the repo. Rebuilding with develop.py gives a byte-identical model.
Who benefits, and who could be harmed
- Benefits: labour-ward staff facing heavy CTG reading loads and disagreement between readers; mothers and babies in units without continuous senior cover; and, through the photo reader, units that only have paper strips.
- Harmed by false negatives (the worst error): it misses about half of acidemic births (15 of 32). A "continue" could give false reassurance and delay delivery. The demo says on every "continue" that it is not reassurance.
- Harmed by false positives: 57% of escalations were for babies without acidemia. That means unnecessary intervention, caesarean risk and alarm fatigue.
- Abstention: "check transducer" calls add work. The total-loss gate also missed the most dangerous pattern: one acidemic baby's last 17 minutes were blank, yet the trace passed the gate.
- Equity: one hospital and one population (2010–2012, ≥ 37 weeks). Performance elsewhere is unknown.
Limitations
- Single centre, n = 552, and only 32 held-out positives, so the CIs are wide.
- pH is a surrogate outcome, not brain injury or death.
- Retrospective: "the last hour before delivery" is not real-time prediction.
- The FIGO rule is my computerized approximation of the guideline. There is no clinician-reader comparison.
- The photo reader is tested on simulated photos only, not real paper. It assumes the European 1 cm/min layout.
- Not a medical device. Not for clinical use.
Challenges and what I learned
- Honest evaluation is harder than modelling. The biggest temptation was to re-tune after seeing held-out data. The locked split and the run log made that impossible, which is why the results can be trusted.
- Simple beat fancy. With 386 labelled labours, careful clinical features matched four published deep models. The preprint that claimed AUROC 0.83 had pretrained on its own test traces, and the result didn't reproduce leak-free.
- Missing signal is itself a warning sign. Babies whose final 10 minutes were mostly blank were acidemic 30% of the time, against 14% otherwise.
What I'd do with another month
- Replace the total-loss gate with one that escalates on trailing gaps, pre-registered and tested on new data.
- External validation on another hospital's intrapartum data, with the threshold fixed.
- A real-time, sliding-window version evaluated hour by hour during labour.
- A clinician-reader comparison on the same held-out traces.
- Test the photo reader on real scanned strips with known pH, and add the US 3 cm/min format.
Attribution
- Data:
- CTU-UHB Intrapartum CTG Database v1.0.0 (Chudáček et al., BMC Pregnancy and Childbirth 2014; PhysioNet, Goldberger et al. 2000), ODC-BY 1.0.
- JNU-CTG (Jinan University, Zenodo 10.5281/zenodo.21800730), CC BY 4.0.
- FHRMA recordings via CTGDL (Zenodo 10.5281/zenodo.19510407), GPL-3.0.
- Re-implemented models: Petrozziello et al. 2019 (MCNN); Wang et al. 2017 (ResNet); Nie et al. 2023 (PatchTST); Fridman & Ben Shachar 2026 (masked pretraining).
- Libraries: NumPy, SciPy, pandas, scikit-learn, PyTorch, wfdb, Matplotlib, Pillow, Gradio.
- Video: Kokoro TTS (Apache-2.0) narration; Inter, JetBrains Mono and Font Awesome fonts (SIL OFL).
- Statistics cited: UNICEF / UN IGME; Hruban et al. 2015; Alfirevic et al., Cochrane 2013.

