B.Sc. thesis · Daffodil International University · 2026
Reading paper ECGs from a phone photo.
In many hospitals in Bangladesh, 12-lead ECGs are printed on thermal paper and handed to the patient; no digital signal is kept. A phone photograph is often the only copy. We built a dataset of 1,191 smartphone photographs of paper ECGs from Enam Medical College Hospital (1,175 patients), each labelled from the cardiologist's own written remark, and a strict evaluation protocol around it. A deliberately plain image model reads the photo directly and reaches a macro AUROC of 0.923 (95% CI 0.895–0.946) on a locked test set opened once.
- Paper 1 Manuscript in preparation for IEEE JBHI
- Paper 2 Photo to written report — in progress
The problem
Most ECG AI needs a signal. Here, there is only paper.
No digital signal
Paper printouts keep no signal, and most ECG models need one.
Messy photos
Phone, light, tilt, curl, shadows and handwriting on the page all vary.
Few clinic photos
Existing image datasets are mostly scans or renders; few are phone photos from real South-Asian clinics.
The contribution is the dataset and the evaluation protocol, not a fancy model. The model is plain on purpose, so the results measure the data and the protocol.
Paper 1 · The data
1,191 photos, labelled from the cardiologist’s own remark
- 1,191
- smartphone photos of paper ECGs
- 1,175
- patients, after merging 10 duplicate printouts
- 6
- capture sessions, 2 phone types
- 240
- test records, opened exactly once (21 Nov 2026)
Five labels (multi-label)
- Normal
- Ischaemia
- Arrhythmia/conduction block
- Rate abnormality
- Other
Each handwritten remark was mapped to classes with a published vocabulary (AHA/ACCF/HRS 2007 statements, PTB-XL codes); rate abnormality comes from the printed heart rate (<60 or >100). The split was frozen before training: 949 development records (5-fold cross-validation by patient) and 240 test records, opened exactly once and enforced by code.
What careful data work found
- Duplicates. 10 pairs of the same printout had been entered twice — merged.
- Silent imputation. The clinical spreadsheet had quietly filled blanks with imputed values — restored to missing.
- Clipped values. ECG values were clipped (exactly 8 records at the minimum and maximum of every field) — 40 cells corrected by reading the printed header from the photos (98–99% agreement with known values).
- Readable text. 22% of images carried printed or handwritten text — masked so the model cannot read it.
How it works
Anatomy of a reading
Synthetic example; output values are illustrative, not a patient.
- 01
A 12-lead ECG printed on thermal paper
Often the only record: no digital signal is kept.
- 02
A phone photograph
Phones, light, tilt, curl, shadows and handwriting all vary.
- 03
Crop the sheet, mask the text band
Raw colour kept: no grayscale, no contrast tricks, no flips — a mirrored ECG is a different ECG.
- 04
Resize to 448 × 1024
Enough detail for the waveform; higher resolution gave no measurable gain.
- 05
A deliberately plain model
ConvNeXt-Tiny from an ImageNet start; 3 seeds × 5 folds = 15 models averaged.
- 06
Five probabilities
Normal, Ischaemia, Arrhythmia/block, Rate abnormality, Other (multi-label).
- 07
Thresholds fixed on development data only
The locked test set never touches a decision.
Paper 1 · Results
How well does it read the photo?
Primary endpoint = macro AUROC over Normal, Ischaemia, Arrhythmia/block and Rate. Development cross-validation of the same model: 0.892 (0.875–0.909). Honest weak spots: Arrhythmia/block sensitivity 0.42; “Other” is hard.
Paper 1 · Checks
Does it read the ECG, or a shortcut?
Toggle what the model sees. If it were reading the paper, the grid or the handwriting, erasing the trace would not hurt.
0.892 macro AUROC
The normal input: paper, grid and trace.
Development cross-validation numbers, not the locked test set.
- 0.851 when one whole capture session is left out: it works on unseen sessions.
- Caveat: phones and sessions are 98% identifiable from the image, and Honor photos score lower than iPhone photos (0.877 vs 0.931 in a later model).
- 0.645 vs 0.643 macro-F1: the machine’s printed interpretation and our model are level on 200 records. The cardiologist saw the machine statement, which favours the machine.
Same ECG, different paper
- Same 977 ECGs in nine physical forms: 0.826–0.844
- Three external image sets (Germany, China, USA): 0.83–0.89
The model was never retrained on these images. Crumpling, stains and scanning barely matter: every change stays within ±0.021.
Pictures are a synthetic simulation of each form. The brief gives the range, not a per-form score, so none is shown.
Pre-registered
What did not work
Negative results, reported as planned.
Higher image resolution
No measurable gain.
Grid rectification
Flattening the paper geometrically: +0.011, interval includes 0.
Photo-quality scores
Measured blur and lighting do not predict errors.
Lab values from the ECG photo
Anaemia and kidney function: not better than age + sex.
Paper 2 · In progress
From a photo to a written report
Idea of the co-supervisor, Dr Mohammad Ali Moni (Charles Sturt University). All numbers are development cross-validation (n = 949); the internal test is not run yet.
Four lines, cardiologist style
Rate, Findings, Impression and Advice, plus measurements and a confidence line. The chosen system (R3) is classifier-gated: the report can never contradict the classifier, by construction.
Example layout and confidence values are illustrative, not a patient. Paper 2 numbers are development cross-validation (n = 949); the internal test is not run yet.
Every pre-trained seed beats every ImageNet seed. What transfers is “ECG-like paper”, not the exact layout (pre-registered control; seeds 1–2 still running).
Direct reading wins by +0.062 (CI +0.044 to +0.082). Digitising loses Arrhythmia/block (−0.128) and Ischaemia (−0.080) detail.
A large public ECG vision-language model with no training calls almost everything abnormal; a small fine-tuned one does worse than the classifier-based design.
- 2.5 /min
- mean heart-rate error
- 9 · 5.8 · 14.2 ms
- PR · QRS · QTc mean error
- −27%
- disagreement with the cardiologist when the uncertain 20% are referred (0.330 → 0.240)
- 0.279 vs 0.157
- bits of model uncertainty where the cardiologist hedged vs did not
Which leads does the model look at?
Right bundle-branch block
Blanking V1 changes the logit most (+2.12), then V2 (+0.88).
- strongest effect when blanked
- clear effect
Hover or tab through the lead boxes.
Method: blank out one lead box and measure the change. These match the clinically expected territories. Caveat: aVR sits next to V1 on the print, so part of its effect may be alignment.
Where this goes
Next steps
Blinded reader study
Two cardiologists rate reports from four systems (protocol drafted).
Prospective test set
150–300 new photos for paper 2.
Controlled-access release
Public release of the dataset once permissions are final.
Offline phone app
Photo in, report and a “refer” flag out — for clinics without digital ECG.
Bigger models, more sites
Fine-tuning a large ECG vision-language model; better digitisers; more hospitals and phone types.
ECG age (exploratory)
An “ECG age” from the photo: +5.6 years in patients with reduced kidney function. Early; not in the papers.
Credits
People and skills
- Student
- Md Rashadul Islam
- Supervisor
- Dr. Md. Ali Hossain, NanoBio Technology Center, DIU
- Co-supervisor / collaborator
- Dr Mohammad Ali Moni, Charles Sturt University
- Hospital
- Enam Medical College Hospital, Bangladesh
What this project shows
- Hospital data collection and data auditing
- Label standardisation with published vocabularies
- Pre-registered hypotheses, locked test sets
- PyTorch, timm, ConvNeXt
- Vision-language models, LoRA
- Synthetic data rendering
- Cloud GPU training on a fixed budget (Vertex AI)
- Bootstrap intervals, paired comparisons, calibration, selective prediction
- OCR of printed values
- LaTeX, IEEE JBHI
Numbers are from the manuscript draft and may change in peer review. All ECG images on this page are synthetic.