  The Ear-ECG provides a continuous Lead I electrocardiogram (ECG) by measuring
the potential difference related to heart activity using electrodes that can be
embedded within earphones. The significant increase in wearability and comfort
afforded by Ear-ECG is often accompanied by a corresponding degradation in
signal quality - a common obstacle that is shared by most wearable
technologies. We aim to resolve this issue by introducing a Deep Matched Filter
(Deep-MF) for the highly accurate detection of R-peaks in wearable ECG, thus
enhancing the utility of Ear-ECG in real-world scenarios. The Deep-MF consists
of an encoder stage (trained as part of an encoder-decoder module to reproduce
ground truth ECG), and an R-peak classifier stage. Through its operation as a
Matched Filter, the encoder searches for matches with an ECG template pattern
in the input signal, prior to filtering the matches with the subsequent
convolutional layers and selecting peaks corresponding to true ECG matches. The
so condensed latent representation of R-peak information is then fed into a
simple R-peak classifier, of which the output provides precise R-peak
locations. The proposed Deep Matched Filter is evaluated using
leave-one-subject-out cross validation over 36 subjects with an age range of
18-75, with the Deep-MF outperforming existing algorithms for R-peak detection
in noisy ECG. The Deep-MF achieves a median R-peak recall of 94.9\%, a median
precision of 91.2\% and an (AUC) value of 0.97. Furthermore, we demonstrate
that the Deep Matched Filter algorithm not only retains the initialised ECG
kernel structure during the training process, but also amplifies portions of
the ECG which it deems most valuable. Overall, the Deep Matched Filter serves
as a valuable step forward for the real-world functionality of Ear-ECG and,
through its explainable operation, the acceptance of deep learning models in
e-health.
