Deep Learning Image Segmentation for Time-Series Reconstruction from ECG Images

Samer Jammoul1, Abdullatif Hassan1, Emily Zhang1, Philip Warrick2, Jonathan Afilalo1
1McGill University, 2PeriGen Canada, McGill University


Abstract

Aims: Many models have been developed to analyze ECG time-series signals to predict parameters of cardiac function and arrhythmias. However, a large body of ECGs are routinely stored and exchanged as images rather than time-series. Converting ECG images to time-series waveforms would render them accessible to models relying on time-series format.

Methods: We developed a novel automated pipeline to extract the underlying time-series waveforms from images of standard 12-lead ECGs. Our algorithm consists of successive steps including image de-skewing and reshaping, resolution estimation in dots per inch, and signal isolation to remove noise, distortion and gridlines (image segmentation task). Finally, we convert the pixel coordinates of the isolated signal on the image into a time-series waveform and assign it to the correct lead. For the segmentation task, we trained a U-Net neural network model using synthetically generated images of standard 12-lead ECGs. To render our segmentation model robust to noise and distortions, we augmented the images with random distortions such as handwriting, paper wrinkles, image cropping and noise.

For training, we used a total of 3000 ECGs from the PTB-XL ECG database with 5-fold cross-validation. To evaluate the fidelity of the extracted time-series waveforms, we compared the extracted waveforms to the ground-truth waveforms and computed the average signal-to-noise ratio (SNR) of all 12 leads expressed on a logarithmic decibel scale.

Results: In local cross-validation, the channel-average SNRs for training and validation data were 6.88±0.64 and 6.27±0.85, respectively (mean±std).. Our preliminary entry for the George B. Moody PhysioNet Challenge achieved an SNR of 6.11 on the hidden validation set.

Conclusions: These are encouraging preliminary results. We will evaluate the model's performance on photographs of real ECGs and the reliability of the reconstructed time-series data for subsequent ECG analysis and interpretation.