Toward Improving Electrocardiogram (ECG) Biometric Verification using Mobile Sensors: A Two-Stage Classifier Approach

Electrocardiogram (ECG) signals sensed from mobile devices pertain the potential for biometric identity recognition applicable in remote access control systems where enhanced data security is demanding. In this study, we propose a new algorithm that consists of a two-stage classifier combining random forest and wavelet distance measure through a probabilistic threshold schema, to improve the effectiveness and robustness of a biometric recognition system using ECG data acquired from a biosensor integrated into mobile devices. The proposed algorithm is evaluated using a mixed dataset from 184 subjects under different health conditions. The proposed two-stage classifier achieves a total of 99.52% subject verification accuracy, better than the 98.33% accuracy from random forest alone and 96.31% accuracy from wavelet distance measure algorithm alone. These results demonstrate the superiority of the proposed algorithm for biometric identification, hence supporting its practicality in areas such as cloud data security, cyber-security or remote healthcare systems.


Introduction
Mobile devices are now indispensable in our daily lives in social networking, ecommerce, online banking, and remote healthcare. As a result, a large amount of personal data is stored in the cloud and can be accessed anywhere around the globe. This poses a major concern in data security and confidentiality [1,2]. Traditional biometric recognition systems based on fingerprints or iris exhibit certain limitations regarding robustness against falsified credentials or spoof attacks [3,4]. To overcome the existing challenges, electrocardiograms (ECGs) have been studied as an emerging biometric modality for subject verification because of their high distinctiveness, difficult replication, and intrinsic aliveness detection [5,6]. Conventionally, ECG tests rely on a set of 12 leads placed on a human body in a clinical environment. More recently, low-power and small-size biosensors are being integrated into mobile devices for real-time monitoring of people's physiological conditions during daily activities, including electrocardiograms. This makes mobile ECG data readily available for biometric recognition without added hardware cost.
The use of ECG for identity recognition dates back to the pioneer studies of Biel et al. [7], Irvine et al. [8], and Kyoso and Uchiyama [9], which revealed that ECG contains sufficiently detailed information to uniquely identify an individual. During the last decade, considerable efforts have been made to develop various algorithms using ECG for subject identification [10][11][12][13][14][15]. Generally speaking, the ECG identification systems are categorized based on the method of feature (also called template) extraction as well as the type of template matching for classification. The ECG feature extraction The ECG subject verification performance reported by the literature varies depending on databases, methods of ECG data recording, sample size, signal pre-processing techniques, types of feature extraction, and classification methods. Many studies were based on the clinical multi-or single-lead ECG data, such as MIT-Beth Israel Hospital (MIT-BIH) and Physikalisch-Technische Bundesanstalt (PTB) diagnostic databases hosted on the Physionet website [25][26][27][28][29][30][31][32]. A few other studies built the sensor design into a lab prototype to obtain "off-the-person" ECG data for analyzing the performance of ECG biometric identification. For instance, Shen et al. [6] implemented the identity verification using template matching and decision-based neural network (DBNN) for a group of 20 subjects from the MIT-BIH database, and reported the rate of correct identity verification as 95% for template matching and 80% for the DBNN, while combining the two methods produced a 100% correct rate. Wang et al. [33] developed a hierarchical architecture integrating human ECG fiducial features and appearance features for classification, and achieved 100% correct human identification when evaluated with 13 subjects. Shen et al. [11] applied a combined template matching and distance classification methods to the ECG signal recorded from the palms for biometric recognition for a group of 168 subjects, and achieved a 95.3% identification rate. Chan et al. [10] studied the biometric performance of one-channel ECG signals recorded from the pads of individuals' thumbs, from a group of 50 subjects during three data-recording sessions on different days, and achieved 89% classification accuracy using a wavelet distance measure classifier. For more details, we suggest the review paper of ECG biometric recognition by Odinaka et al. [34].
The latest advancement of integrating biosensors into mobile devices has facilitated the real-time measurement of ECG signal for monitoring human health conditions [3]. Taking advantage of the fact that mobile ECG data might be readily available, we aimed to develop a robust and effective mobile ECG biometric recognition system for reliable access control in different applications. Compared to the ECG data measured from a multi-lead clinical setup, the mobile ECG signals suffer from poorer signal-to-noise ratio and baseline drift due to human respiration or motion artifacts from finger to electrode pad contact, as well as power line interferences [35][36][37]. As a result, the detections of mobile ECG wave boundaries (i.e., onset and offset points) become less reliable as they are mostly The ECG subject verification performance reported by the literature varies depending on databases, methods of ECG data recording, sample size, signal pre-processing techniques, types of feature extraction, and classification methods. Many studies were based on the clinical multi-or single-lead ECG data, such as MIT-Beth Israel Hospital (MIT-BIH) and Physikalisch-Technische Bundesanstalt (PTB) diagnostic databases hosted on the Physionet website [25][26][27][28][29][30][31][32]. A few other studies built the sensor design into a lab prototype to obtain "off-the-person" ECG data for analyzing the performance of ECG biometric identification. For instance, Shen et al. [6] implemented the identity verification using template matching and decision-based neural network (DBNN) for a group of 20 subjects from the MIT-BIH database, and reported the rate of correct identity verification as 95% for template matching and 80% for the DBNN, while combining the two methods produced a 100% correct rate. Wang et al. [33] developed a hierarchical architecture integrating human ECG fiducial features and appearance features for classification, and achieved 100% correct human identification when evaluated with 13 subjects. Shen et al. [11] applied a combined template matching and distance classification methods to the ECG signal recorded from the palms for biometric recognition for a group of 168 subjects, and achieved a 95.3% identification rate. Chan et al. [10] studied the biometric performance of one-channel ECG signals recorded from the pads of individuals' thumbs, from a group of 50 subjects during three data-recording sessions on different days, and achieved 89% classification accuracy using a wavelet distance measure classifier. For more details, we suggest the review paper of ECG biometric recognition by Odinaka et al. [34].
The latest advancement of integrating biosensors into mobile devices has facilitated the real-time measurement of ECG signal for monitoring human health conditions [3]. Taking advantage of the fact that mobile ECG data might be readily available, we aimed to develop a robust and effective mobile ECG biometric recognition system for reliable access control in different applications. Compared to the ECG data measured from a multi-lead clinical setup, the mobile ECG signals suffer from poorer signal-to-noise ratio and baseline drift due to human respiration or motion artifacts from finger to electrode pad contact, as well as power line interferences [35][36][37]. As a result, the detections of mobile ECG wave boundaries (i.e., onset and offset points) become less reliable as they are mostly susceptible to noise and baseline wandering, leading to a sub-optimal performance using fiducial-based feature extraction methods. Alternatively, although non-fiducial-based feature extraction methods obviate the need for detecting ECG fiducial points, the subject verification accuracy varies depending on the ECG signal quality as well as the choice of classification method. Moreover, when the subject size magnifies, the performance tends to degrade and computational load increases significantly [34,38,39].
To overcome the mobile ECG limitations and improve the accuracy and robustness of a biometric recognition system using mobile ECG, a new two-stage subject verification system is proposed in this paper that takes the advantages of both fiducial and non-fiducial features and intelligently combines a probabilistic random forest classifier with a one-to-many template matching classifier based on wavelet coefficients. To objectively assess the performance of the proposed algorithm, a new ECG database is created by combining ECG data from four sources, including the ECG from a mobile phone, the ECG in the presence of arrhythmia, the ECG with normal sinus rhythm, and the ECG data measured over a 6-month span. To the best of our knowledge, our method is the first study to use a prototype system of industrial sensors integrated into mobile phones to obtain ECG data. An up/down sampling technique is utilized to re-sample the ECG signals at different sampling rates into a uniform one, to ensure the proper operation of the two-stage classification system.
The rest of this paper is organized as follows. The proposed ECG biometric verification system is presented in Section 2; Section 3 describes the ECG data sources as well as the generation of the new database using cubic spline interpolation; the methodology of the proposed algorithm is presented in detail in Section 4; the results and discussions are demonstrated in Section 5; finally, Section 6 concludes the paper. Figure 2 shows the framework of a typical biometric verification system using mobile ECG. The system operates in two stages: the enrollment stage and the verification stage. The ECG signal taken from an individual by a mobile device is transmitted to the biometric verification system in a remote center over wireless networks. At the time of enrollment, the system extracts a set of features from the ECG signal of each individual, and stores the feature template into the database. During the verification stage, when the ECG signal from an unknown subject is received, the system again extracts a set of features using the same methodology and applies them to a classifier for decision making. In this study, a new two-stage verification algorithm is proposed, as illustrated in Figure 3. susceptible to noise and baseline wandering, leading to a sub-optimal performance using fiducialbased feature extraction methods. Alternatively, although non-fiducial-based feature extraction methods obviate the need for detecting ECG fiducial points, the subject verification accuracy varies depending on the ECG signal quality as well as the choice of classification method. Moreover, when the subject size magnifies, the performance tends to degrade and computational load increases significantly [34,[38][39].

System Framework
To overcome the mobile ECG limitations and improve the accuracy and robustness of a biometric recognition system using mobile ECG, a new two-stage subject verification system is proposed in this paper that takes the advantages of both fiducial and non-fiducial features and intelligently combines a probabilistic random forest classifier with a one-to-many template matching classifier based on wavelet coefficients. To objectively assess the performance of the proposed algorithm, a new ECG database is created by combining ECG data from four sources, including the ECG from a mobile phone, the ECG in the presence of arrhythmia, the ECG with normal sinus rhythm, and the ECG data measured over a 6-month span. To the best of our knowledge, our method is the first study to use a prototype system of industrial sensors integrated into mobile phones to obtain ECG data. An up/down sampling technique is utilized to re-sample the ECG signals at different sampling rates into a uniform one, to ensure the proper operation of the two-stage classification system.
The rest of this paper is organized as follows. The proposed ECG biometric verification system is presented in Section 2; Section 3 describes the ECG data sources as well as the generation of the new database using cubic spline interpolation; the methodology of the proposed algorithm is presented in detail in Section 4; the results and discussions are demonstrated in Section 5; finally, Section 6 concludes the paper. Figure 2 shows the framework of a typical biometric verification system using mobile ECG. The system operates in two stages: the enrollment stage and the verification stage. The ECG signal taken from an individual by a mobile device is transmitted to the biometric verification system in a remote center over wireless networks. At the time of enrollment, the system extracts a set of features from the ECG signal of each individual, and stores the feature template into the database. During the verification stage, when the ECG signal from an unknown subject is received, the system again extracts a set of features using the same methodology and applies them to a classifier for decision making. In this study, a new two-stage verification algorithm is proposed, as illustrated in Figure 3.  From Figure 3, in the enrollment stage the ECG signal received from each individual i (i = 1, . . . N) is first pre-processed, where N is the total number of individuals registered in the system. The system then extracts the fiducial features X i e (l) based on limited ECG significant points (P, Q, R, S, T), as well as non-fiducial features X i e (w) based on significant wavelet coefficients, and next stores both feature sets into the database. When the ECG signal from an unknown subject j is received, the system once again extracts its fiducial features X j q (l) and non-fiducial features X j q (w). Next, the proposed two-stage subject verification system includes the following steps: (1) application of the

System Framework
(2) selection of K candidate subjects (K N) whose probabilities are higher than a pre-determined probability threshold P th and application of the data of those selected K subjects to the subsequent one-to-many template matching classifier; (3) use of a 1-to-K template matching classifier, based on significant wavelet coefficients, to calculate the wavelet distance D using the unknown identity feature X j q (w) against each of the selected candidate subjects X k e (w) (k = 1, . . . , K) as given in Equation (2): Here WDIST[·] is the function that calculates the distance between the test subject X j q (w) and each candidate X k e (w). Finally, a decision is made using the minimum D k which means that the candidate X k e (w) with the smallest distance to X j q (w) is selected. Compared to a conventional 1-to-N template matching classifier, the proposed two-stage classifier using 1-to-K template matching eliminates the concerns of significantly increased computational load and performance degradation as subject size N increases [34,38,39].  is first applied to the random forest classifier, to identify the limited potential candidates (usually 5). Next, the non-fiducial feature (wavelet coefficient) is applied to a 1-to-template matching classifier to make the final decision.
From Figure 3, in the enrollment stage the ECG signal received from each individual 1, … is first pre-processed, where is the total number of individuals registered in the system. The system then extracts the fiducial features based on limited ECG significant points (P, Q, R, S, T), as well as non-fiducial features based on significant wavelet coefficients, and next stores both feature sets into the database. When the ECG signal from an unknown subject j is received, the system once again extracts its fiducial features and non-fiducial features . Next, the proposed two-stage subject verification system includes the following steps: (1) application of the feature set to a random forest classifier with function • . The probabilities for the unknown subject being identified as the individual i in the database are then derived as given in Equation (1): (2) selection of candidate subjects ( ≪ ) whose probabilities are higher than a predetermined probability threshold and application of the data of those selected subjects to the subsequent one-to-many template matching classifier; (3) use of a 1-to-template matching classifier, based on significant wavelet coefficients, to calculate the wavelet distance using the unknown identity feature against each of the selected candidate subjects ( 1, … , ) as given in Equation (2): Figure 3. Proposed two-stage ECG biometric subject verification algorithm. The fiducial feature X j q (l) is first applied to the random forest classifier, to identify the limited K potential candidates (usually K < 5). Next, the non-fiducial feature X j q (w) (wavelet coefficient) is applied to a 1-to-K template matching classifier to make the final decision.

Data Sources
To support real-life practicality of biometric subject verification, the proposed algorithm is evaluated using multiple types of ECG data on subjects under different health conditions. Table 1 summarizes the database used, including a comparatively large database generated in this study. A majority of previously developed ECG biometric recognition systems utilize ECG data measured from the same device at the same sampling rate. However, in real applications, the ECG signals may be taken from different types of mobile devices with different sampling frequencies. The unmatched sampling rate may lead to an improper operation of a classification system. To resolve this problem, an up/down-sampling interpolation technique is introduced in this study to convert the ECG signals at different sampling rates into a uniformed sampling rate (360 Hz is selected in this study). A unified database is then created by integrating all four datasets together using cubic spline data interpolation method for data up/down-sampling. Figure 4 illustrates an example of up-sampling using the cubic spline interpolation method for ECG data from the MIT-BIH normal sinus rhythm. A majority of previously developed ECG biometric recognition systems utilize ECG data measured from the same device at the same sampling rate. However, in real applications, the ECG signals may be taken from different types of mobile devices with different sampling frequencies. The unmatched sampling rate may lead to an improper operation of a classification system. To resolve this problem, an up/down-sampling interpolation technique is introduced in this study to convert the ECG signals at different sampling rates into a uniformed sampling rate (360 Hz is selected in this study). A unified database is then created by integrating all four datasets together using cubic spline data interpolation method for data up/down-sampling. Figure 4 illustrates an example of up-sampling using the cubic spline interpolation method for ECG data from the MIT-BIH normal sinus rhythm.

Methodology
Following Section 2 on the framework of the proposed ECG biometric subject verification system using combined random forest and wavelet distance measure classifiers, this section describes the methodology in detail for identifying an unknown subject.

Data Pre-Processing
The raw ECG data is first applied to a bandpass filter using fast Fourier transform (FFT). The low frequency cutoff of the bandpass filter is set to 2 Hz to get rid of baseline wandering; the high frequency cutoff of the bandpass filter is set to 50 Hz to keep as much ECG signal energy as possible while removing the power line interference (60 Hz) and other high frequency noise.

R-Peak Detection
R-peak detection is the key to ensure each P-QRS-T complex is correctly delineated. The goal for R-peak detection is to locate the timing position for all true positive R-peaks while eliminating false positive R-peaks. In this study, a modified R-Peak detection is created. It combines the valley-peak detection algorithm with shifting windowing from [40] with an adaptive threshold algorithm as proposed by Pan and Tompkins [41]. The accuracy of this new R-peak detection algorithm is evaluated

Methodology
Following Section 2 on the framework of the proposed ECG biometric subject verification system using combined random forest and wavelet distance measure classifiers, this section describes the methodology in detail for identifying an unknown subject.

Data Pre-Processing
The raw ECG data is first applied to a bandpass filter using fast Fourier transform (FFT). The low frequency cutoff of the bandpass filter is set to 2 Hz to get rid of baseline wandering; the high frequency cutoff of the bandpass filter is set to 50 Hz to keep as much ECG signal energy as possible while removing the power line interference (60 Hz) and other high frequency noise.

R-Peak Detection
R-peak detection is the key to ensure each P-QRS-T complex is correctly delineated. The goal for R-peak detection is to locate the timing position for all true positive R-peaks while eliminating false positive R-peaks. In this study, a modified R-Peak detection is created. It combines the valley-peak detection algorithm with shifting windowing from [40] with an adaptive threshold algorithm as proposed by Pan and Tompkins [41]. The accuracy of this new R-peak detection algorithm is evaluated using the MIT-BIH arrhythmia database as the R-peak positions are accurately annotated by the medical staff. The proposed R-peak detection algorithm achieves a 99.46% true positive rate (TPR), which demonstrates the effectiveness of the modified R-peak detection algorithm. The computation time is 0.53 s, which is~1/5 of the time needed by the Pan-Tompkins algorithm under the same development environment (the same computer device, with dual CPU cores of Intel ® core™-i5 processor 3.6 GHz).

P-QRS-T Complex Delineation
After R-peak detection, the next step is to delineate the P-QRS-T complex through time windowing for ECG feature extraction. In this study, a time window of 800 ms centered on R-peak location is used to segment each P-QRS-T complex. The 3D array of the delineated ECG complex is illustrated in Figure 5. development environment (the same computer device, with dual CPU cores of Intel ® core™-i5 processor 3.6 GHz).

P-QRS-T Complex Delineation
After R-peak detection, the next step is to delineate the P-QRS-T complex through time windowing for ECG feature extraction. In this study, a time window of 800 ms centered on R-peak location is used to segment each P-QRS-T complex. The 3D array of the delineated ECG complex is illustrated in Figure 5. To further improve the feature extraction accuracy, some of the P-QRS-T outliers are removed as suggested by Chan et al. [10] by calculating the Pearson correlation coefficients for each P-QRS-T complex against the mean complex calculated from the 3D array. Figure 5 presents an example of 10 waveforms, and we define the mean complex as the mean of these waveforms. The distribution of the correlation coefficients is examined as follows. A threshold is determined as: 0.5 , where is the mean value of the correlation coefficient and is the standard deviation. If the correlation coefficient of a P-QRS-T complex falls below this pre-determined threshold, it is considered as an outlier and is removed.

Fiducial Feature Extraction
Once the R point is detected, the P, Q, S, T peaks and valleys are first detected using a local maximum/minimum searching algorithm within a defined physical region. In this study, the Q and S points are limited within the 150 ms width window, centered at the R point. The P point is within a 200 ms period advance from the R point. The T point is within a 400 ms period backward from the R point. Next, the onset and offset points for P wave (Pon, Poff) and T wave (Ton, Toff) are determined using the triangle optimization method (for details please refer to Singh et al. [14]). Once those ECG significant points are correctly identified, the fiducial features are then extracted based on their relative temporal interval, amplitude, as well as angles of the ECG wave, as illustrated in Figure 6. Prior to data processing by the proposed patient verification system, the QT temporal intervals are scaled according to the Framingham formula [42]: To further improve the feature extraction accuracy, some of the P-QRS-T outliers are removed as suggested by Chan et al. [10] by calculating the Pearson correlation coefficients for each P-QRS-T complex against the mean complex calculated from the 3D array. Figure 5 presents an example of 10 waveforms, and we define the mean complex as the mean of these waveforms. The distribution of the correlation coefficients is examined as follows. A threshold is determined as: µ − 0.5 × σ, where µ is the mean value of the correlation coefficient and σ is the standard deviation. If the correlation coefficient of a P-QRS-T complex falls below this pre-determined threshold, it is considered as an outlier and is removed.

Fiducial Feature Extraction
Once the R point is detected, the P, Q, S, T peaks and valleys are first detected using a local maximum/minimum searching algorithm within a defined physical region. In this study, the Q and S points are limited within the 150 ms width window, centered at the R point. The P point is within a 200 ms period advance from the R point. The T point is within a 400 ms period backward from the R point. Next, the onset and offset points for P wave (P on , P off ) and T wave (T on , T off ) are determined using the triangle optimization method (for details please refer to Singh et al. [14]). Once those ECG significant points are correctly identified, the fiducial features are then extracted based on their relative temporal interval, amplitude, as well as angles of the ECG wave, as illustrated in Figure 6. Prior to data processing by the proposed patient verification system, the QT temporal intervals T i are scaled according to the Framingham formula [42]: where T r−r is the time interval between the adjacent R peaks. To achieve an optimized performance, three combinations of ECG significant points are investigated for feature extraction. Table 2 shows a summary of the extracted fiducial features from the three combinations of ECG fiducial points. Since the mobile ECG signals suffer from a poorer signal-to-noise ratio and baseline drift due to human respiration or motion artifacts from finger-to-electrode pad contact, the detections of mobile ECG wave boundaries (i.e., onset and offset points) become less reliable as they are mostly susceptible to noise and baseline wandering. Therefore, the presented two-stage cascaded method allows for fiducial features extracted from only P, Q, R, S, T peaks and valleys to be sufficient for subject verification.
where is the time interval between the adjacent R peaks. To achieve an optimized performance, three combinations of ECG significant points are investigated for feature extraction. Table 2 shows a summary of the extracted fiducial features from the three combinations of ECG fiducial points. Since the mobile ECG signals suffer from a poorer signal-to-noise ratio and baseline drift due to human respiration or motion artifacts from finger-toelectrode pad contact, the detections of mobile ECG wave boundaries (i.e., onset and offset points) become less reliable as they are mostly susceptible to noise and baseline wandering. Therefore, the presented two-stage cascaded method allows for fiducial features extracted from only P, Q, R, S, T peaks and valleys to be sufficient for subject verification.

Non-Fiducial Feature Extraction
The ECG non-fiducial features are obtained based on DWT. The wavelet analysis provides a time-frequency representation of an analyzed signal in time domain, allowing a higher temporal resolution for high frequency components of and lower temporal resolution for its low-frequency components. This multi-scale time resolution is beneficial for ECG complex data processing, as the ECG waveform exhibits both high frequency data transitions (related to QRS) as well as low frequency waves (P, T) within a small P-QRS-T time window. Using the wavelet analysis algorithm, the original ECG data is hierarchically decomposed into -level sub-series at different frequency bands. This is done by processing the input ECG data with two complementary high pass and low pass filters in a tree-structured fashion and down-sampling by two at each stage in order to decompose into a set of orthogonal components (D1 to D5, A5), as shown in Figure 7. In Figure 7, D1 to D5 represent the detailed time series and A5 represents the approximate time series at different frequency sub-bands; is the Nyquist frequency [43] of the ECG data.

Non-Fiducial Feature Extraction
The ECG non-fiducial features are obtained based on DWT. The wavelet analysis provides a time-frequency representation of an analyzed signal x(t) in time domain, allowing a higher temporal resolution for high frequency components of x(t) and lower temporal resolution for its low-frequency components. This multi-scale time resolution is beneficial for ECG complex data processing, as the ECG waveform exhibits both high frequency data transitions (related to QRS) as well as low frequency waves (P, T) within a small P-QRS-T time window. Using the wavelet analysis algorithm, the original ECG data is hierarchically decomposed into N-level sub-series at different frequency bands. This is done by processing the input ECG data x(t) with two complementary high pass and low pass filters in a tree-structured fashion and down-sampling by two at each stage in order to decompose into a set of orthogonal components (D1 to D5, A5), as shown in Figure 7. In Figure 7, D1 to D5 represent the detailed time series and A5 represents the approximate time series at different frequency sub-bands; F n is the Nyquist frequency [43] of the ECG data.
The corresponding wavelet coefficients ω pr at each level of decomposition can be derived by Equation (4): where ϕ(t) is the selected mother wavelet, p is the scale parameter which represents the level of decomposition, and r is the shifting parameter which gives the number of wavelet coefficients at decomposition level p. In this study, the Daubechies (db) mother wavelet is used, which provides a family of wavelets called dbN, where N is the order of wavelets. For achieving the best overall patient verification accuracy, db3 is used to decompose each ECG P-QRS-T complex into sub-series D1 to D5 and A5, as illustrated in Figure 8. The corresponding wavelet coefficients at each level of decomposition can be derived by Equation (4): * √ * (4) where is the selected mother wavelet, p is the scale parameter which represents the level of decomposition, and r is the shifting parameter which gives the number of wavelet coefficients at decomposition level p. In this study, the Daubechies (db) mother wavelet is used, which provides a family of wavelets called , where is the order of wavelets. For achieving the best overall patient verification accuracy, 3 is used to decompose each ECG P-QRS-T complex into sub-series D1 to D5 and A5, as illustrated in Figure 8. For ECG data with sampling frequency , its Nyquist frequency /2. The relationship between the sampling frequency and the frequency bandwidth range at the p level wavelet decomposition is derived in Equation (5) as:  The corresponding wavelet coefficients at each level of decomposition can be derived by Equation (4): * √ * (4) where is the selected mother wavelet, p is the scale parameter which represents the level of decomposition, and r is the shifting parameter which gives the number of wavelet coefficients at decomposition level p. In this study, the Daubechies (db) mother wavelet is used, which provides a family of wavelets called , where is the order of wavelets. For achieving the best overall patient verification accuracy, 3 is used to decompose each ECG P-QRS-T complex into sub-series D1 to D5 and A5, as illustrated in Figure 8. For ECG data with sampling frequency , its Nyquist frequency /2. The relationship between the sampling frequency and the frequency bandwidth range at the p level wavelet decomposition is derived in Equation (5) as: For ECG data with sampling frequency F s , its Nyquist frequency F n = F s /2. The relationship between the sampling frequency F s and the frequency bandwidth range F p at the p level wavelet decomposition is derived in Equation (5) as: Taking the MIT-BIH arrhythmia database as an example (F s = 360 Hz), Table 3 shows the frequency sub-band range and the number of wavelet coefficients at each level of wavelet decomposition. Considering the fact that ECG signal is pre-processed by a bandpass filter from 2 Hz to 50 Hz, the ECG non-fiducial features will only take the wavelet coefficients at the significant level of decomposition, within the frequency range of interest.

Two-Stage Subject Verification System
To enhance the robustness of the biometric subject verification system using mobile ECG, a two-stage automatic subject verification algorithm is developed. The ECG fiducial features are first applied to a random forest ensemble learning classifier. A random forest operates by constructing a multitude of independent decision tree predictors. A bootstrapping technique is used to resample the training datasets such that each decision tree takes only a subset of input data. During the model training process, each leaf node of the decision tree produces estimates of several conditional class probabilities. When an input subject arrives at this leaf node, it gives the probability of being classified as any subject i (i = 1, . . . N) in the database. Figure 9 shows the decision-making process when an unknown subject j is applied to the random forest classifier.
frequency sub-band range and the number of wavelet coefficients at each level of wavelet decomposition. Considering the fact that ECG signal is pre-processed by a bandpass filter from 2 Hz to 50 Hz, the ECG non-fiducial features will only take the wavelet coefficients at the significant level of decomposition, within the frequency range of interest. 6.75 to 11.25 9 A5 0-6.75 9

Two-Stage Subject Verification System
To enhance the robustness of the biometric subject verification system using mobile ECG, a two-stage automatic subject verification algorithm is developed. The ECG fiducial features are first applied to a random forest ensemble learning classifier. A random forest operates by constructing a multitude of independent decision tree predictors. A bootstrapping technique is used to resample the training datasets such that each decision tree takes only a subset of input data. During the model training process, each leaf node of the decision tree produces estimates of several conditional class probabilities. When an input subject arrives at this leaf node, it gives the probability of being classified as any subject 1, … in the database. Figure 9 shows the decision-making process when an unknown subject j is applied to the random forest classifier. is the total number of decision trees used in the random forest algorithm; is the total number of subjects stored in the database; and is a probability vector with size , indicating as being classified as any subject 1, … in the database.
In Figure 9, is the total number of decision trees used in the random forest algorithm; is the total number of subjects stored in the database. The final classification probability of the random forest classifier is the average of the probabilities from the terminal nodes of all decision trees that a Figure 9. Random forest classifier for fiducial-based features. j represents an unknown subject; T is the total number of decision trees used in the random forest algorithm; N is the total number of subjects stored in the database; and P ji is a probability vector with size N, indicating j as being classified as any subject i (i = 1, . . . N) in the database.
In Figure 9, T is the total number of decision trees used in the random forest algorithm; N is the total number of subjects stored in the database. The final classification probability of the random forest classifier is the average of the probabilities from the terminal nodes of all decision trees that a test subject has reached. Only a few candidate subjects K whose probability is above an optimized probability threshold P th will be applied to the subsequent 1-to-K template matching classifier for further decision. The probability threshold P th is determined based on the overall subject verification accuracy. Unlike a conventional 1-to-N template matching classifier where the feature vector of an unknown subject is compared to that of all N elements of the subject database, the proposed algorithm only needs to implement 1-to-K template matching, as shown in Figure 10. test subject has reached. Only a few candidate subjects whose probability is above an optimized probability threshold will be applied to the subsequent 1-to-template matching classifier for further decision. The probability threshold is determined based on the overall subject verification accuracy. Unlike a conventional 1-to-template matching classifier where the feature vector of an unknown subject is compared to that of all elements of the subject database, the proposed algorithm only needs to implement 1-to-template matching, as shown in Figure 10. Assuming the stored wavelet coefficients vector for the subject i is represented as D , D … D , where is the decomposed level, a query subject has a feature vector D , D , … D . The template matching classifier calculates the distance between the wavelet coefficients by: The smallest wavelet distance WDIST(i) indicates the identified subject i. In summary, the proposed two-stage classifier offers two advantages. First, it eliminates the concern from previous studies in which the subject verification accuracy of a conventional 1-tomatching classifier tends to worsen when the subject size gets too large [34]. The proposed algorithm eliminates this performance degradation concern as only 1-to-template matching is needed, where ≪ . Second, the proposed algorithm significantly reduces the computation load.

Single Random Forest Classifier
The accuracy of machine learning classifier depends on the accurate detection of ECG fiducial points, as well as the features extracted from those fiducial points. For performance comparison purposes, we first assume that a single random forest algorithm is used and would be first independently evaluated in order to explore how the subject verification accuracy changes when the ECG features are extracted from different combinations of fiducial points. Following the above discussions, three cases listed in Table 2 are evaluated in this study to support our hypothesis that the local maximum/minimum fiducial points (P, Q, R, S, and T) are sufficient enough for the random forest classifier. Figure 11 shows the subject verification accuracy results for the three cases, where machine learning ML-3 represents the features extracted from the Q, R, and S points; ML-5 represents the features extracted from the P, Q, R, S, and T points; and ML-9 further includes the wave boundaries Pon, Poff, Ton, and Toff (according to Table 2).
The smallest wavelet distance WDIST(i) indicates the identified subject i. In summary, the proposed two-stage classifier offers two advantages. First, it eliminates the concern from previous studies in which the subject verification accuracy of a conventional 1-to-N matching classifier tends to worsen when the subject size N gets too large [34]. The proposed algorithm eliminates this performance degradation concern as only 1-to-K template matching is needed, where K N. Second, the proposed algorithm significantly reduces the computation load.

Single Random Forest Classifier
The accuracy of machine learning classifier depends on the accurate detection of ECG fiducial points, as well as the features extracted from those fiducial points. For performance comparison purposes, we first assume that a single random forest algorithm is used and would be first independently evaluated in order to explore how the subject verification accuracy changes when the ECG features are extracted from different combinations of fiducial points. Following the above discussions, three cases listed in Table 2 are evaluated in this study to support our hypothesis that the local maximum/minimum fiducial points (P, Q, R, S, and T) are sufficient enough for the random forest classifier. Figure 11 shows the subject verification accuracy results for the three cases, where machine learning ML-3 represents the features extracted from the Q, R, and S points; ML-5 represents the features extracted from the P, Q, R, S, and T points; and ML-9 further includes the wave boundaries P on , P off , T on , and T off (according to Table 2). Figure 11. ECG biometric patient verification accuracy using random forest classifier only. ML-3 represents the features extracted from the Q, R, and S points; ML-5 represents the features extracted from the P, Q, R, S, and T points; and ML-9 further includes the wave boundaries Pon, Poff, Ton, and Toff (according to Table 2).
Four individual datasets are evaluated independently. It is observed that three datasets, MITarrhythmia, MIT-normal, and mobile ECG show a high accuracy (>99%) for both ML-5 and ML-9 scenarios. ML-9 shows slightly better accuracy than ML-5 for MIT-normal dataset. For the other datasets (MIT-arrhythmia and mobile ECG), the ML-9 does not show improvement over the ML-5. This is possibly due to the unreliable detections of the wave boundaries. The PhysioNet Human-ID dataset shows a totally different performance. ML-3 gives the best accuracy, while the ML-5 and ML-9 results degrade in performance. Further investigation of the PhysioNet Human-ID dataset indicates that there are lots of irregular ECG shapes, resulting in unreliable fiducial point detection. Overall, it is concluded that ML-5 gives the best performance among the four datasets, which confirms our hypothesis and is therefore used for the final system solution.

Single Wavelet Distance Classifier
To obtain the best performance for the one-to-many template matching classifier based on wavelet coefficients while maintaining a low computational load, we investigate the subject verification accuracy of the template matching classifier using wavelet coefficients derived from three sets of decomposition levels, S1 = {D1, D2, D3, D4, D5}, S2 = {D2, D3, D4, D5}, and S3 = {D3, D4, D5} for all four individual ECG databases. Our hypothesis is that the optimized wavelet coefficients are obtained from those frequency sub-bands (see Table 3) within the ECG frequency range of 2-50 Hz, considering the fact that ECG signal is pre-processed by a bandpass filter from 2 to 50 Hz. Figure 12 presents the subject verification accuracy results using the 1-to-template matching wavelet distance (WDIST) classifier with the three sets S1, S2, and S3 defined above. For the PhysioNet Human-ID dataset, the sampling rate is 500 Hz. The set S3 contains the ECG frequency range (2-50 Hz) and therefore gives the best performance. For the MIT-normal dataset, the set S1 contains the ECG frequency range due to the sampling rate of 128 Hz. Therefore, the performance degrades when less wavelet coefficients (set S2, and set S3) are included. For other two datasets with sampling rates 360 Hz and 400 Hz, on average, the set S2 gives the best performance. Figure 11. ECG biometric patient verification accuracy using random forest classifier only. ML-3 represents the features extracted from the Q, R, and S points; ML-5 represents the features extracted from the P, Q, R, S, and T points; and ML-9 further includes the wave boundaries P on , P off , T on , and T off (according to Table 2).
Four individual datasets are evaluated independently. It is observed that three datasets, MIT-arrhythmia, MIT-normal, and mobile ECG show a high accuracy (>99%) for both ML-5 and ML-9 scenarios. ML-9 shows slightly better accuracy than ML-5 for MIT-normal dataset. For the other datasets (MIT-arrhythmia and mobile ECG), the ML-9 does not show improvement over the ML-5. This is possibly due to the unreliable detections of the wave boundaries. The PhysioNet Human-ID dataset shows a totally different performance. ML-3 gives the best accuracy, while the ML-5 and ML-9 results degrade in performance. Further investigation of the PhysioNet Human-ID dataset indicates that there are lots of irregular ECG shapes, resulting in unreliable fiducial point detection. Overall, it is concluded that ML-5 gives the best performance among the four datasets, which confirms our hypothesis and is therefore used for the final system solution.

Single Wavelet Distance Classifier
To obtain the best performance for the one-to-many template matching classifier based on wavelet coefficients while maintaining a low computational load, we investigate the subject verification accuracy of the template matching classifier using wavelet coefficients derived from three sets of decomposition levels, S1 = {D1, D2, D3, D4, D5}, S2 = {D2, D3, D4, D5}, and S3 = {D3, D4, D5} for all four individual ECG databases. Our hypothesis is that the optimized wavelet coefficients are obtained from those frequency sub-bands (see Table 3) within the ECG frequency range of 2-50 Hz, considering the fact that ECG signal is pre-processed by a bandpass filter from 2 to 50 Hz. Figure 12 presents the subject verification accuracy results using the 1-to-N template matching wavelet distance (WDIST) classifier with the three sets S1, S2, and S3 defined above. For the PhysioNet Human-ID dataset, the sampling rate is 500 Hz. The set S3 contains the ECG frequency range  and therefore gives the best performance. For the MIT-normal dataset, the set S1 contains the ECG frequency range due to the sampling rate of 128 Hz. Therefore, the performance degrades when less wavelet coefficients (set S2, and set S3) are included. For other two datasets with sampling rates 360 Hz and 400 Hz, on average, the set S2 gives the best performance.

Two-Stage Classifier
Based on the results from Figure 11 and Figure 12, further performance optimization is applied to utilize a probabilistic approach that combines the random forest method with the wavelet distance template matching classifier. The results are presented in Figure 13. The proposed two-stage cascaded algorithm is evaluated on the four individual datasets and also on the combined dataset to demonstrate its ability to support the real-life practicality of ECG biometric verification. The probability threshold value is optimized as 0.15 for pre-determining the candidate subjects to be applied to the 1-to-template matching classifier. The results in Figure 13 indicate that the two-stage cascaded classifier achieves an overall better accuracy than each individual classifier. For instance, for the combined dataset with 184 subjects, the WDIST2-5 and ML-5 achieves 96.31% and 98.33% subject verification accuracies respectively, while the cascaded twostage classifier achieves a 99.52% subject verification accuracy. It should be noted that the unified

Two-Stage Classifier
Based on the results from Figures 11 and 12, further performance optimization is applied to utilize a probabilistic approach that combines the random forest method with the wavelet distance template matching classifier. The results are presented in Figure 13.

Two-Stage Classifier
Based on the results from Figure 11 and Figure 12, further performance optimization is applied to utilize a probabilistic approach that combines the random forest method with the wavelet distance template matching classifier. The results are presented in Figure 13. The proposed two-stage cascaded algorithm is evaluated on the four individual datasets and also on the combined dataset to demonstrate its ability to support the real-life practicality of ECG biometric verification. The probability threshold value is optimized as 0.15 for pre-determining the candidate subjects to be applied to the 1-to-template matching classifier. The results in Figure 13 indicate that the two-stage cascaded classifier achieves an overall better accuracy than each individual classifier. For instance, for the combined dataset with 184 subjects, the WDIST2-5 and ML-5 achieves 96.31% and 98.33% subject verification accuracies respectively, while the cascaded twostage classifier achieves a 99.52% subject verification accuracy. It should be noted that the unified The proposed two-stage cascaded algorithm is evaluated on the four individual datasets and also on the combined dataset to demonstrate its ability to support the real-life practicality of ECG biometric verification. The probability threshold value is optimized as 0.15 for pre-determining the candidate subjects to be applied to the 1-to-K template matching classifier. The results in Figure 13 indicate that the two-stage cascaded classifier achieves an overall better accuracy than each individual classifier. For instance, for the combined dataset with 184 subjects, the WDIST2-5 and ML-5 achieves 96.31% and 98.33% subject verification accuracies respectively, while the cascaded two-stage classifier achieves a 99.52% subject verification accuracy. It should be noted that the unified dataset includes subject ECG measured from mobile phones, subject ECG measured in the presence of arrhythmia and subject ECG data measured 2-20 times over a 6-month period. Therefore, the high subject verification accuracy of 99.52% indicates the robustness of our proposed algorithm. In our study, the subject verification accuracy is defined as the number of subjects being correctly classified divided by the total number of subjects being tested. This leads to a small error rate of 0.48% where a subject is incorrectly classified. In our simulation, it is assumed that one subject is represented by only one ECG complex. In reality, the test subject could easily record more heartbeats (e.g., >10 heart beats) at a time to be used for subject verification. According to binomial theorem, using more than one heartbeat would further improve the subject verification rate over the results presented in this paper.
From Figure 13, it can also be seen that the achieved accuracy improvement by the two-stage classifier depends on the quality of ECG data acquired. For instances, when ECG data is taken multiple times over a 6-month period, the proposed two-stage classifier achieves a 98.79% accuracy, better than the 93.54% from random forest alone and 96.23% from 1-to-N template matching alone. However, for subject ECG data that were taken from a single time test, such as MIT-BIH arrhythmia, MIT-BIH normal sinus rhythm, and ECG data from mobile phones, a high verification accuracy of better than 99% can be achieved using the single random forest classifier or the single 1-to-N wavelet distance measure classifier. Therefore, it is understandable that the improvement from the two-stage classifier over each single stage classifier would not be very obvious.
Last, but not least, it is important to compare the performance of the proposed two-stage classifier to what was reported in literature. Due to the fact that many ECG studies use different datasets from different sources, and often, the data pre-processing technique, feature extraction and classification methods might all be different, a rigorous performance comparison might be impractical. However, the classification accuracy performance reported in literature can still be used as a benchmark and provide a relative reference for our study. Taking MIT-BIH ECG database as examples, Fatemian et al. [44] used the template matching approach for ECG subject identification, and reported an average of 99.61% verification accuracy when evaluated with MIT-BIH normal sinus rhythm database; Zokaee et al. [45] proposed using Mel-Frequency Cepstrum Coefficients (MFCC) for ECG feature extraction and k-Nearest Neighbors (KNN) for classification, and achieved 100% identification accuracy for MIT-BIH normal sinus rhythm database and 89% for ECG data gathered from 50 subjects in a hospital with three records of different times. Sasikala et al. [46] tested the feature extraction approach on ECG verification performance using the MIT-BIH arrhythmia database and achieved 99.0% accuracy; Zeng et al. [47] implemented the reduced binary pattern template matching on MIT-BIH arrhythmia and normal sinus rhythm databases and achieved a success rate of 95.79% and 90.19% separately. As a comparison, our proposed two-stage classification algorithm achieved a 99.43% accuracy for the MIT-BIH arrhythmia database and 99.98% for the MIT-BIH normal sinus rhythm database. These results further demonstrate the robustness and efficiency of the proposed two-stage classifier.

Conclusions
The main goal of this study is to facilitate the application of mobile ECG for biometric subject verification for applications where data security is demanding. Compared to the ECG data measured from a multi-lead clinical setup, the mobile ECG signals suffer from a poorer signal-to-noise ratio, baseline drift due to human respiration or motion artifacts from finger to electrode pad contact, as well as power line interferences. To overcome those challenges, a new two-stage ECG biometric verification system is proposed by combining probabilistic random forest method with wavelet distance measure. The motivation behind this approach is to decrease the environmental interference into a minimum effect on the verification accuracy. The proposed approach consists of two stages: (1) ECG fiducial features are first applied to a random forest ensemble learning classifier; (2) after the first stage classifier, only few candidates with probability higher than the threshold are applied to the template matching classifier. Compared with either the random forest classifier with ECG fiducial feature extraction, or the template matching classifier using wavelet distance measure only, the proposed hybrid approach is more robust against the environmental variations while still maintaining a low computational load.
The investigations of the robustness and effectiveness of the proposed two-stage algorithm are performed over four individual datasets. In addition, in order to simulate the real application environment where the sampling frequency of ECG signals might be different, a combined dataset is created using up/down sampling technique. Overall, for the combined 184 subjects, the proposed two-stage classifier achieves a total of 99.52% subject verification accuracy, better than the 98.33% accuracy from random forest alone and 96.31% accuracy from wavelet distance measure algorithm alone. It is also noted that the proposed two-stage algorithm is particularly effective when ECG data is acquired multiple times over a long time span. The evaluation results support that ECG signals can be potentially used for human biometric recognition using biosensors embedded into mobile devices. Furthermore, this algorithm can be adapted with dual ECG/fingerprint scanning to provide a highly reliable solution for a wide range of applications such as biosecurity and cybersecurity.