
Citation: Chee, K.J.; Ramli, D.A.
Electrocardiogram Biometrics Using
Transformer’s Self-Attention
Mechanism for Sequence Pair Feature
Extractor and Flexible Enrollment
Scope Identification. Sensors 2022, 22,
3446. https://doi.org/10.3390/
s22093446
Academic Editors: Yangquan Chen,
Nunzio Cennamo, M. Jamal Deen,
Subhas Mukhopadhyay, Simone
Morais and Junseop Lee
Received: 8 February 2022
Accepted: 26 April 2022
Published: 30 April 2022
Publisher’s Note: MDPI stays neutral
with regard to jurisdictional claims in
published maps and institutional affil-
iations.
Copyright: © 2022 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article
distributed under the terms and
conditions of the Creative Commons
Attribution (CC BY) license (https://
creativecommons.org/licenses/by/
4.0/).
Article
Electrocardiogram Biometrics Using Transformer’s
Self-Attention Mechanism for Sequence Pair Feature Extractor
and Flexible Enrollment Scope Identification
Kai Jye Chee and Dzati Athiar Ramli *
School of Electrical and Electronic Engineering, USM Engineering Campus, Universiti Sains Malaysia,
Nibong Tebal 14300, Malaysia; kai_jye@student.usm.my
* Correspondence: dzati@usm.my
Abstract:
The existing electrocardiogram (ECG) biometrics do not perform well when ECG changes
after the enrollment phase because the feature extraction is not able to relate ECG collected during
enrollment and ECG collected during classification. In this research, we propose the sequence pair
feature extractor, inspired by Bidirectional Encoder Representations from Transformers (BERT)’s
sentence pair task, to obtain a dynamic representation of a pair of ECGs. We also propose using the
self-attention mechanism of the transformer to draw an inter-identity relationship when performing
ECG identification tasks. The model was trained once with datasets built from 10 ECG databases, and
then, it was applied to six other ECG databases without retraining. We emphasize the significance of
the time separation between enrollment and classification when presenting the results. The model
scored 96.20%, 100.0%, 99.91%, 96.09%, 96.35%, and 98.10% identification accuracy on MIT-BIH Atrial
Fibrillation Database (AFDB), Combined measurement of ECG, Breathing and Seismocardiograms
(CEBSDB), MIT-BIH Normal Sinus Rhythm Database (NSRDB), MIT-BIH ST Change Database (STDB),
ECG-ID Database (ECGIDDB), and PTB Diagnostic ECG Database (PTBDB), respectively, over a short
time separation. The model scored 92.70% and 64.16% identification accuracy on ECGIDDB and
PTBDB, respectively, over a long time separation, which is a significant improvement compared to
state-of-the-art methods.
Keywords:
transformer; BERT; ECG biometrics; self-attention mechanism; deep learning; multi-class
classification; convolutional neural network; feature extraction; blind segmentation; artificial neural
network
1. Introduction
Identification and verification are very important concepts in surveillance and security
systems [
1
]. Conventional approaches, whether they are knowledge-based, or token-based,
are susceptible to loss and transfer [
2
–
4
]. Biometrics-based methods aim to sidestep these
problems by using the intrinsic characteristics of the human body, such as the finger-
print, iris, voice, face, keystroke, and gait [
5
,
6
]. Despite having their own strengths and
weaknesses [
7
,
8
], some of them have made it to real-world applications [
3
]. The elec-
trocardiogram (ECG) has enough interperson variability (intervariability) to be used as
biometrics [9]. As a bonus, liveness information is inherent to the ECG signal [3,4].
1.1. Electrocardiogram
The ECG is a representation of the electrical activities of the heart [
10
]. Electrical signals
generated by the polarization and depolarization of the cardiac tissue can be detected by
electrodes, called leads, attached to the skin surface of various body parts [
8
,
11
]. Plotting
the data against time reveals the ECG.
The obvious features in the ECG are the P wave, the QRS complex, and the T wave.
The P wave is formed from the combination of the depolarizations of the right atrium
Sensors 2022, 22, 3446. https://doi.org/10.3390/s22093446 https://www.mdpi.com/journal/sensors