ecg_id int64 697 21.5k | condition stringclasses 2
values | question stringclasses 5
values | answer stringclasses 10
values | truth_lead stringclasses 3
values | truth_qrs int64 7 18 | truth_irregular bool 2
classes |
|---|---|---|---|---|---|---|
15,918 | A | rhythm_lead | II | II | 11 | false |
15,918 | A | qrs_count | 12 | II | 11 | false |
15,918 | A | regularity | regular | II | 11 | false |
15,918 | A | calibration | 25 mm/s 10 mm/mV | II | 11 | false |
15,918 | A | topleft | I | II | 11 | false |
15,918 | C | rhythm_lead | II | II | 11 | false |
15,918 | C | qrs_count | 10 | II | 11 | false |
15,918 | C | regularity | regular | II | 11 | false |
15,918 | C | calibration | 25 mm/s 10 mm/mV | II | 11 | false |
15,918 | C | topleft | aVR | II | 11 | false |
3,953 | A | rhythm_lead | V5 | V5 | 9 | false |
3,953 | A | qrs_count | 12 | V5 | 9 | false |
3,953 | A | regularity | regular | V5 | 9 | false |
3,953 | A | calibration | 25 mm/s 10 mm/mV | V5 | 9 | false |
3,953 | A | topleft | I | V5 | 9 | false |
3,953 | C | rhythm_lead | V5 | V5 | 9 | false |
3,953 | C | qrs_count | 10 | V5 | 9 | false |
3,953 | C | regularity | regular | V5 | 9 | false |
3,953 | C | calibration | 25 mm/s 10 mm/mV | V5 | 9 | false |
3,953 | C | topleft | I | V5 | 9 | false |
2,620 | A | rhythm_lead | V5 | V5 | 18 | false |
2,620 | A | qrs_count | 12 | V5 | 18 | false |
2,620 | A | regularity | regular | V5 | 18 | false |
2,620 | A | calibration | 25 mm/s 10 mm/mV | V5 | 18 | false |
2,620 | A | topleft | I | V5 | 18 | false |
2,620 | C | rhythm_lead | V5 | V5 | 18 | false |
2,620 | C | qrs_count | 10 | V5 | 18 | false |
2,620 | C | regularity | regular | V5 | 18 | false |
2,620 | C | calibration | 25 mm/s 10 mm/mV | V5 | 18 | false |
2,620 | C | topleft | I | V5 | 18 | false |
14,819 | A | rhythm_lead | V1 | V1 | 12 | false |
14,819 | A | qrs_count | 12 | V1 | 12 | false |
14,819 | A | regularity | regular | V1 | 12 | false |
14,819 | A | calibration | 25 mm/s 10 mm/mV | V1 | 12 | false |
14,819 | A | topleft | I | V1 | 12 | false |
14,819 | C | rhythm_lead | V1 | V1 | 12 | false |
14,819 | C | qrs_count | 10 | V1 | 12 | false |
14,819 | C | regularity | regular | V1 | 12 | false |
14,819 | C | calibration | 25 mm/s 10 mm/mV | V1 | 12 | false |
14,819 | C | topleft | I | V1 | 12 | false |
17,365 | A | rhythm_lead | V1 | V1 | 18 | true |
17,365 | A | qrs_count | 12 | V1 | 18 | true |
17,365 | A | regularity | regular | V1 | 18 | true |
17,365 | A | calibration | 25 mm/s 10 mm/mV | V1 | 18 | true |
17,365 | A | topleft | I | V1 | 18 | true |
17,365 | C | rhythm_lead | V1 | V1 | 18 | true |
17,365 | C | qrs_count | 10 | V1 | 18 | true |
17,365 | C | regularity | regular | V1 | 18 | true |
17,365 | C | calibration | 25 mm/s 10 mm/mV | V1 | 18 | true |
17,365 | C | topleft | I | V1 | 18 | true |
8,018 | A | rhythm_lead | II | II | 14 | true |
8,018 | A | qrs_count | 10 | II | 14 | true |
8,018 | A | regularity | regular | II | 14 | true |
8,018 | A | calibration | 25 mm/s 10 mm/mV | II | 14 | true |
8,018 | A | topleft | I | II | 14 | true |
8,018 | C | rhythm_lead | II | II | 14 | true |
8,018 | C | qrs_count | 10 | II | 14 | true |
8,018 | C | regularity | regular | II | 14 | true |
8,018 | C | calibration | 25 mm/s 10 mm/mV | II | 14 | true |
8,018 | C | topleft | aVR | II | 14 | true |
18,003 | A | rhythm_lead | II | II | 11 | true |
18,003 | A | qrs_count | 10 | II | 11 | true |
18,003 | A | regularity | regular | II | 11 | true |
18,003 | A | calibration | 25 mm/s 10 mm/mV | II | 11 | true |
18,003 | A | topleft | I | II | 11 | true |
18,003 | C | rhythm_lead | V1 | II | 11 | true |
18,003 | C | qrs_count | 10 | II | 11 | true |
18,003 | C | regularity | regular | II | 11 | true |
18,003 | C | calibration | 25 mm/s 10 mm/mV | II | 11 | true |
18,003 | C | topleft | aVR | II | 11 | true |
1,053 | A | rhythm_lead | V5 | V5 | 10 | true |
1,053 | A | qrs_count | 12 | V5 | 10 | true |
1,053 | A | regularity | regular | V5 | 10 | true |
1,053 | A | calibration | 25 mm/s 10 mm/mV | V5 | 10 | true |
1,053 | A | topleft | I | V5 | 10 | true |
1,053 | C | rhythm_lead | V3 | V5 | 10 | true |
1,053 | C | qrs_count | 10 | V5 | 10 | true |
1,053 | C | regularity | regular | V5 | 10 | true |
1,053 | C | calibration | 25 mm/s 10 mm/mV | V5 | 10 | true |
1,053 | C | topleft | I | V5 | 10 | true |
2,289 | A | rhythm_lead | II | II | 13 | false |
2,289 | A | qrs_count | 12 | II | 13 | false |
2,289 | A | regularity | regular | II | 13 | false |
2,289 | A | calibration | 25 mm/s 10 mm/mV | II | 13 | false |
2,289 | A | topleft | I | II | 13 | false |
2,289 | C | rhythm_lead | II | II | 13 | false |
2,289 | C | qrs_count | 10 | II | 13 | false |
2,289 | C | regularity | regular | II | 13 | false |
2,289 | C | calibration | 25 mm/s 10 mm/mV | II | 13 | false |
2,289 | C | topleft | aVR | II | 13 | false |
2,763 | A | rhythm_lead | V1 | V1 | 11 | false |
2,763 | A | qrs_count | 12 | V1 | 11 | false |
2,763 | A | regularity | regular | V1 | 11 | false |
2,763 | A | calibration | 25 mm/s 10 mm/mV | V1 | 11 | false |
2,763 | A | topleft | I | V1 | 11 | false |
2,763 | C | rhythm_lead | V1 | V1 | 11 | false |
2,763 | C | qrs_count | 10 | V1 | 11 | false |
2,763 | C | regularity | regular | V1 | 11 | false |
2,763 | C | calibration | 25 mm/s 10 mm/mV | V1 | 11 | false |
2,763 | C | topleft | I | V1 | 11 | false |
Paper ECG: what a VLM reads, and what it doesn't
A small evaluation of Qwen2-VL-2B on 12-lead paper ECGs, in two conditions: a clean digital render, and a phone photo of the same page after printing. 40 ECGs, 5 questions each, 400 answers.
1. The blind spot
I worked for nine months on a CVD classifier that uses smartphone photos of paper ECGs. The data came from a hospital in Savar, Bangladesh. The hospital does not give soft copies. That is their policy. So I had to use hard copies.
In Bangladesh an ECG printout has two pages side by side. One page has the waveform. The other page has the cardiologist's remarks, handwritten. I collected both. The remarks page became my ground truth.
I removed all patient information from the images by cropping. Then I gave each one a number, ECG_001, ECG_002, and so on. That number connects the image to its remarks and to the vitals. I typed the vitals into Excel by hand, one patient at a time — 1,191 patients, about 37 ECG parameters and lab values each. That is roughly 44,000 numbers.
I took the photos in the wards with my own phone. I had to be fast. So the photos came out tilted. Sometimes the ward light fell on the paper and washed out part of it. Sometimes there were shadows. The paper was not always the same type. At the time these did not look like problems. They became problems later, when I started training.
Nobody had done this before — phone photos of paper ECGs, multi-class and multi-label. There was no paper to follow. So I had to decide everything myself.
Here is the thing I noticed only later. During that whole year I was using vision-language models on these same photos. But I only used them to read the cardiologist's handwriting. The writing is not always clear, and there are many short forms — sinus bradycardia, tachycardia, and others. I used the models to understand those. I was using them to read text.
I never asked a model to look at the waveform and tell me the rhythm. Not once. I did not decide against it. I just never thought it would work.
Later I realised that instinct was telling me something, and I could not find anyone who had tested it. Document and OCR benchmarks use clean scans, and they measure text extraction. Neither one asks the real question: can a general VLM read a paper ECG as a signal, and what happens when the page goes through a printer and a phone camera?
2. Method
All the data here is from PTB-XL, which is public. The patient data from my own thesis is not used anywhere in this repo and is not released.
I picked 40 records from PTB-XL's 21,799. I balanced them two ways: 8 records from each of the 5 diagnostic superclasses, and 20 with regular rhythm against 20 with irregular rhythm. So no answer can be guessed from the class balance.
Condition A is a clean PNG. I rendered each record in Python in the standard 3×4 layout with a rhythm strip at the bottom, with the pink grid, at 25 mm/s and 10 mm/mV, like a real printout.
Condition C is the same page, printed greyscale on A4 on a laser printer, then photographed by hand with my phone at 4096×3072. I did not use the phone's document scan mode, and I did not crop or edit the photos. Some are tilted, some have shadows, some have glare from the room light. That is how these photos really look.
The important part is that A and C are the same signal. Only the capture changed. So any difference between them comes from printing and photographing, not from different patients.
I asked 5 questions per image. For the rhythm strip I did not always use lead II — I picked between II, V1 and V5 based on which had the clearest signal, so the model has to actually read the label instead of guessing.
Ground truth comes from the signal itself. QRS counts were detected automatically after a 0.5 Hz high-pass filter, then I checked them by eye and corrected three by hand.
3. Results
| Question | A (clean) | C (photo) | Drop |
|---|---|---|---|
| Lead in top-left panel | 100% | 72.5% | −27.5 |
| Rhythm-strip lead label | 100% | 90% | −10 |
| Paper speed & gain | 100% | 100% | 0 |
| QRS count (exact) | 12.5% | 10% | −2.5 |
| Rhythm regular / irregular | 50% | 50% | 0 |
Reading text degrades. The two questions that need the model to read small printed letters both drop. The top-left lead label falls from perfect to 72.5%. That is 11 wrong answers out of 40.
Three of these numbers mean nothing, and I want to say that clearly.
The model answered "regular" 80 times out of 80, in both conditions, no matter what the truth was. The 50% is only because my dataset is balanced 20/20. It is not reading the rhythm at all.
The 100% on paper speed and gain is memorised, not read. Every ECG in the world says 25 mm/s and 10 mm/mV.
QRS count is already 12.5% on the clean image, with a mean error of 2.45 beats. There is no ability there to lose, so the drop to 10% means nothing either.
So the real finding is two separate things, not one. The model reads a paper ECG as a document, not as a signal. It does OCR. It does not do cardiology. And when
- Downloads last month
- 68
