Skip to content

How TraceRead AI works

Every step of one real run, with its numbers

We printed a public research ECG, photographed it with TraceRead's photo simulator and ran it through the same code end to end. Here is what went in, what each step did and what came out.

The ECG in this run

Thickened heart muscle

Dataset
PTB-XL 1.0.3
Record
15863
Printed as page
T-0057
Licence
CC BY 4.0
Photo usable

Step 1: the photo

On the phone

What went in: one photo of a printed ECG

PTB-XL record 15863, a public research ECG from Germany, was printed as page T-0057 on A4 at 25 mm a second and 10 mm per millivolt. TraceRead's photo simulator then took a photo of it: tilted, lit unevenly, slightly blurred, with sensor noise and JPEG compression, the way a phone camera would.

This record was in PTB-XL's test set, so TraceRead AI never saw it during training. The person was a man aged 68. Age and sex are all TraceRead keeps.

Photo made by computer of the printed PTB-XL record 15863
Shown at 1600 by 1200 pixels.

Step 2: page finder

TraceRead AI

Find the paper and how it is turned

TraceRead AI looks at the whole photo and marks the four corners of the page, and which way up it is. Fixed code then measures the printed millimetre grid to correct the scale and the tilt, and makes the page flat.

Page found
yes
Turned
0 degrees
Paper
A4
The photo with the four page corners TraceRead AI found
The four corners TraceRead AI found, in red.

Step 3: layout reader

TraceRead AI

Work out where each lead sits

Every row of a printout starts with a calibration pulse, a small square step that is 10 mm tall for 1 millivolt. TraceRead AI finds the pulses, and fixed code matches them against 14 known page layouts to work out where each of the 12 leads sits and how long it runs.

Layout
3x4 with one lead II strip
Calibration pulses read
4 of 4
Height of 1 millivolt
10 mm
Paper speed used
25 mm a second
Pulse width suggested
31.8 mm a second
Layout match
0.981

Warnings this step raised

  • The calibration pulse looks wider than expected, which would mean a paper speed of about 31.8 millimetres a second. TraceRead still reads the page at 25 millimetres a second, the usual speed, so timings could be a little off if that reading were right.

Step 4: trace rebuild

TraceRead AI

Rebuild every lead as a digital signal

TraceRead AI marks which pixels are trace ink. Fixed code then follows the ink of each lead, column by column, and turns it into millivolts, 500 points a second. The rebuilt line is drawn back over the paper so a doctor can see at a glance if a lead was misread.

Because this ECG is public, we can check the rebuilt signal against the original recording. 1.00 would be a perfect match; the second number allows the two to be lined up by up to a tenth of a second.

LeadSeconds shownInk foundMatchLined up
I0 to 2.5100%0.980.99
aVR2.5 to 5100%0.960.96
V15 to 7.5100%0.960.97
V47.5 to 10100%0.970.99
II0 to 2.5100%0.991.00
aVL2.5 to 5100%0.940.94
V25 to 7.5100%0.950.96
V57.5 to 10100%1.001.00
III0 to 2.5100%0.900.90
aVF2.5 to 5100%0.970.97
V35 to 7.5100%0.960.97
V67.5 to 10100%1.001.00
II, rhythm strip0 to 100.990.99

Median match for this page: 0.96.

The flattened page with every rebuilt lead drawn over it in red
The flat page with every rebuilt lead drawn over it in red.

Step 5: coverage map

Fixed code

Mark which seconds the paper shows

A 3x4 printout shows each lead for only 2.5 of the 10 seconds the machine recorded. The coverage map tells the pattern finder exactly which seconds of each lead it has, so a part that is not on the paper is never read as a flat line.

I
aVR
V1
V4
II
aVL
V2
V5
III
aVF
V3
V6
II strip
0 s5 s10 s

Step 6: hold for retake

Fixed code

Decide whether the photo can be read

Before any pattern is read, a fixed rule checks the calibration pulses, the layout match and whether leads were cut off. If the rebuilt trace looks unreliable, TraceRead gives no first read and asks for a new photo.

Photo usableThe layout match score was 0.981 (a photo is held back when the score is below 0.888) and 4 of 4 calibration pulses were read. The AI's own uncertainty about the five main heart groups was 0.306 (a photo is held back above 0.497). Neither check fired, so the photo is used.

Step 7: measures

Fixed code

Measure the heartbeat

Fixed code finds every beat, lines the leads up and measures them together. The same code run on the original recording shows how much the photo changed each number, and a reference ECG program from the PTB-XL+ dataset gives a second opinion.

MeasureFrom the photoOriginal recordingReference program
Heart rate (beats a minute)636363
PR interval (ms)136137134
QRS width (ms)888796
QT interval (ms)406396426
QTc, corrected for heart rate (ms)414404433
Heart axis (degrees)201927
PR 150 msQRS 82 msQT 406 ms
The median heartbeat of lead II, from the photo, with the points the PR, QRS and QT measures start and end at.

Step 8: pattern finder

TraceRead AI

Score 71 patterns and flag the ones that pass their line

TraceRead AI reads the 12 rebuilt leads and the coverage map together and scores 71 patterns of rhythm, conduction, thickened heart muscle and ST and T changes. A pattern is flagged when its score passes a line set in advance on other ECGs, never on this one. The lines are set so that patterns are not missed, which is why a pattern can be flagged with a low score, and why some flags are wrong: the doctor decides.

What the dataset's cardiologists recorded for this ECG

  • Unspecific reduced blood flow pattern
  • Left ventricular hypertrophy
  • Sinus rhythm

TraceRead AI flagged 7 patterns. 3 of them are also among the dataset's statements (Sinus rhythm, Left ventricular hypertrophy and Unspecific reduced blood flow pattern). Not in the dataset's statements: Reduced blood flow pattern, front and side, ST depression, Unspecific wide QRS and Left atrial enlargement.

TraceRead AI's score for each pattern, from 0 to 100. The thin line is where that pattern gets flagged.

  • Sinus rhythm

    flagged

    the usual rhythm, started by the heart's natural pacemaker

    95
  • Left ventricular hypertrophy

    flagged

    the muscle wall of the main pumping chamber may be thicker than usual

    60
  • Unspecific reduced blood flow pattern

    flagged

    beat changes that can go with reduced blood flow to the heart muscle, without a clear place

    56
  • Reduced blood flow pattern, front and side

    flagged

    beat changes over the front and side of the heart that can go with reduced blood flow to the heart muscle

    27
  • ST depression

    flagged

    the middle part of the beat sits lower than usual

    19
  • Unspecific wide QRS

    flagged

    the signal spreads slowly inside the lower chambers, so the main spike is wide

    7
  • Left atrial enlargement

    flagged

    the upper left chamber may be larger or under more strain than usual

    2

Step 9: your doctor

The last step is always a person

Everything above is an AI first read. A qualified doctor checks the red line against the paper, checks every number, keeps, changes or removes each pattern, and decides. No generative AI writes clinical text: pattern names come from a fixed list and measures are numbers from fixed code.

An AI first read is not the last word.

  • A qualified doctor reviews every AI first read. Nothing reaches a patient until a doctor signs it.
  • Do not rely on TraceRead alone in an emergency.
  • A normal AI first read does not rule out heart disease.
  • For adults, 18 and over.

Every run, not just the good ones

All 12 runs we made for this site

We printed and photographed 12 public test ECGs and ran every one. 12 were usable and none was held for a retake. The median match between the rebuilt traces and the original recordings was 0.88, or 0.98 after lining them up by up to a tenth of a second.

PagePhotoMatchTraceRead AI flaggedThe dataset's cardiologists recorded
T-0010Usable0.88SR, ASMI, ABQRS, IVCD, LVH, ALMI, ISC_, LAO/LAE, QWAVE, ILMIAMI, SR
T-0018Usable0.94SR, ABQRS, IMI, ILMIIRBBB, NDT, SR
T-0025Usable0.80NORM, SR, SARRHNORM, SARRH
T-0045Usable0.99SR, CRBBB, IRBBB, QWAVE, LAO/LAECRBBB, AFIB
T-0046Usable0.78SR, LAFB, NDT, NT_, NST_, STD_, LOWT, IVCD, ALMI, LAO/LAE, QWAVEIVCD, ALMI, SR
T-0048Usable0.77AFIB, NST_, STD_, ISCAL, ISC_, ASMI, LOWT, LVH, IVCD, PACEISCIN, AFIB, AFLT
T-0053Usable0.00SR, NORMNORM, SR
T-0056Usable0.88SR, NDT, LOWT, STD_, NST_, NT_, LVH, ISC_NDT, SR
T-0057Usable0.96SR, LVH, ISC_, ISCAL, STD_, IVCD, LAO/LAEISC_, LVH, SR
T-0058Usable0.90SR, IMI, ABQRS, ILMI, IVCD, QWAVE, ALMIIMI, SR
T-0059Usable0.011AVB, AFIB, ASMI, NST_, IRBBB, IVCD, LAO/LAE, PACE, SARRH, ALMI, ILMI, QWAVENORM, SR
T-0064Usable0.91NORM, SRNORM, ABQRS, SR

Two pages were read wrongly

On T-0059, TraceRead turned the page a quarter turn, read it as 12 rows of one lead and found no calibration pulse. The hold rule still let it through, so its first read is wrong. On T-0053, part of lead II was misread, which put the QRS at 94 ms against 66 ms on the original recording. This is why a doctor checks the red rebuilt line against the paper before anything else.

Pattern codes are PTB-XL's own short names. How the 12 pages were drawn: Pages T-0001 to T-0070 of the print kit whose PTB-XL age is 18 or over. They are split into four groups by the dataset's own statements, never by what TraceRead AI says: a rhythm statement other than sinus rhythm, a conduction or hypertrophy statement, normal ECG, and the rest. A seeded draw (seed 7) takes 3 pages from each group, so the 12 runs do not stand for the dataset as a whole. Each page is rendered at 200 dpi and turned into one photo made by computer with TraceRead's own photo simulator (photo mode, frame 2400 by 1800, seed 7). Every run is listed, held ones included. From each of the three groups of pages (thickened muscle or conduction, normal, and rhythm), the home page shows the run where TraceRead AI agreed best with the dataset's cardiologists. The table lists all 12, including the ones it read wrongly.

What we measured

Every result, with how many ECGs and where they came from

AUROC is a score of how well TraceRead AI tells ECGs with a pattern from ECGs without it: 1.00 is perfect and 0.50 is a coin toss. Match is how closely a rebuilt trace follows the original recording, where 1.00 is a perfect match.

ResultWhat it measuresHow manyDataSource
0.908median match between the rebuilt trace and the original recording500photos made by computer of printed PTB-XL test ECGsTraceRead test S1
0.980the same match when the page position is known exactly500photos made by computer of printed PTB-XL test ECGsTraceRead test S1
99.0%page layouts read correctly500photos made by computer of printed PTB-XL test ECGsTraceRead test S1
7 of 500photos where the page was not found, so no first read was given500photos made by computer of printed PTB-XL test ECGsTraceRead test S1
0.902how well 71 patterns are told apart (AUROC, where 1.00 is perfect and 0.50 is a coin toss)2,198PTB-XL test ECGs (fold 10), original recordingsTraceRead test S2
0.931the same score for the 5 broad groups (normal, heart muscle damage, ST and T changes, conduction problems, thickened heart muscle); the published benchmark is 0.9282,198PTB-XL test ECGs (fold 10)TraceRead test S2
0.955the same score for 12 rhythm patterns; the published benchmark is 0.9572,198PTB-XL test ECGs (fold 10)TraceRead test S2
20 of 29patterns scoring 0.90 or more on ECGs from China that TraceRead AI never trained on45,152ECGs from Chapman Shaoxing Ningbo (China)TraceRead test S2
0.009drop in that score when TraceRead AI reads photos made by computer instead of the original recordings500PTB-XL test ECGs, photos made by computerTraceRead test S3
5.9%photos held for a retake because the rebuilt trace looked unreliable500photos made by computerTraceRead test S3
0.6average heart rate difference from a reference ECG program2,198PTB-XL test ECGs against PTB-XL+TraceRead test S4
16.8 msaverage QTc difference from a reference ECG program; two reference programs differ from each other by 10.4 ms2,198PTB-XL test ECGs against PTB-XL+TraceRead test S4
7.85 stime to read 95 in 100 ECGs on a 2 vCPU, 4 GB server in AWS Cape Town (median 7.6 s, slowest 27.8 s), no graphics card97photos made by computerTraceRead test S7
0 of 69good frames wrongly flagged by the photo check, while it flagged every frame with blur of half a millimetre or more, large glare, poor light or a page too small522frames of TraceRead test printouts with defects added on purposeTraceRead test S6

Limits we measured

ST elevation, a sign of a heart attack

TraceRead AI does not reliably find it. On 176 ECGs with ST elevation from China (Chapman Shaoxing Ningbo) its score was 0.61 to 0.63, where 0.50 is a coin toss. Measuring the ST segment with fixed code found 62% of them on 12 full leads and 50% on a 3x4 printout.

TraceRead tests S2 and S4

Fast, slow and long QT rhythms

Simple fixed rules on the measures found 80% of fast heart rates, 35% of slow heart rates and 3% of long QTc across 21,799 PTB-XL ECGs. They cannot be relied on to catch these.

TraceRead test S4

Photos

Every photo result on this site was measured on photos of printed public research ECGs made by TraceRead's photo simulator.

TraceRead tests S1, S3 and S7

Where the ECGs come from

Every ECG used comes from public research datasets recorded in Germany, China and Brazil. None was recorded in Nigeria.

PTB-XL, Chapman Shaoxing Ningbo, CODE-15%

How these limits shape what TraceRead may be used for is on the clinical safety page. The datasets and their licences are on the credits page.

See TraceRead read a paper ECG

We show you TraceRead reading public research ECGs, step by step, and talk through how your team prints, photographs and reads ECGs today.