ECG Signal Processing and Human State Detection Based on Wearable Electrodes

Detection and Recognition of a human’s continuous states in real time plays an important role in wearable devices. We present an approach for heart rhythm recognition and human status detection through the analysis of ECG signal. The algorithm is comprised of four components, including noise removal, QRS-P-T wave detection, features extraction and human states classification. Discrete wavelet transform (DWT) is applied for random background noise removal. “Moving Integral – Changing Slope” method is used to determine the location of QRS complex waves and other characteristic waves of ECG signal. Time interval, location, amplitude, area of characteristic waves and coefficients of the transform as the features of each ECG segment are input into support vector machine (SVM) so that the machine can judge the states of the human body. Finally, we develop a single-lead ECG delineation wearable system to collect data from 30 users of different ages and human body states for experimental verification. Our evaluation shows that this method can accurately detect different states of the human body in real time. In the future, it can be implemented on wearable devices to assist real-time physiological status monitoring or customized health planning.


Introduction
Electrocardiogram (ECG), caused by depolarization and repolarization of the atria and ventricles, is an essential signal used by physicians in physical checkups to diagnose cardiac diseases [1]. By observing specific characteristics of various waves (QRS complex waves, P wave and T wave) in heart activities, physicians can know about the physical conditions of patients. In most cases, the measurement of ECG in hospital will cost a lot of human and material resources because of the complex waveforms and huge amount of data. Therefore, people often choose to go to the hospital to do the extraction of ECG signal only in the case of abnormal body, unable to achieve real-time monitoring of health status. At present, the characteristics of high measurement accuracy, good portability, convenient operation of wearable devices allow people to detect their health status not only in hospitals but also in home or at work, anytime and anywhere. To top of that, they are widely applicable to the detection of human physiological indicators in various states.
In this paper, we propose an algorithm which can be implemented on a single-lead ECG delineation wearable system to detect states of human body. The algorithm consists of noise removal, QRS-P-T wave detection, feature extraction and finally classification. This model is evaluated in the MIT-BIH Arrhythmia Database and the overall accuracy of classification for recognition of 5 heart rhythm types reaches 98.06%. Then we develop a single-lead ECG signal collection wearable system with fabric flexible dry electrodes to collect data from 30 subjects of different gender, ages and physiological status, to detect and classify 12 different human states and get a high accuracy of classification (90.06%).
2. Theoretical verification of the algorithm ECG signal in the acquisition process can easily be contaminated with noise signal, such as power-line (PLI), electrode motion artifact (MA) and baseline wander (BW). In order to detect characteristic wave accurately and extract useful information, the raw ECG signal should be processed and the noise should be removed. The signal denoising can be done by Discrete Wavelet Transforms (DWT) due to its advantage in analyzing nonstationary signals [2].

ECG signal collected with portable double electrode signal acquisition circuit
The electrocardiogram (ECG) is collected through the electrode cap, and then transmitted to the computer after pre-processing such as amplification and analog-to-digital (A/D) conversion, and stored in the memory in the form of signal voltage amplitude [4]. Assuming that ( , ) f x i j is the j ECG data of the ith experiment.

Determination of the number of layers of the wavelet transform and the Wavelet bases
The paper uses ( ) t  and ( ) t  to denote the scale function and the wavelet mother function of the wavelet transform respectively, and let 0 ( ) Then according to the two-scale equation, the following wavelet packet basis can be constructed: Among them, the node number, j is the decomposition level, h(n) and Without loss of generality, assuming that the length of the ECG data segment used to extract features is 2 N m  , the reconstructed signal can be expressed as:  Figure 1 shows the wavelet packet binary tree structure we drew by taking the three-layer wavelet packet decomposition as an example. The decomposition results at each level are { 0 ( ) s n , 1 ( ) s n }, { 00 ( ) s n , 01 ( ) s n , 10 ( ) s n , 11 ( ) s n }etc. For the convenience of analysis, specify ( ) bm s n to represent a certain component of a certain layer after decomposition, bm is a binary number with m digits, which means that the corresponding decomposition is mth Floor [4]. The original signal s(n) can be restored from the decomposed components through the inverse operation, that is, the components of the mth layer can be restored from the components of the m+1th layer, namely: In the formula:  The number of decomposition layers (N) is a key factor affecting the final de-noising effect. If there are too many layers, the original signal will lose a large amount of information after threshold processing of the wavelet coefficients, so the reconstructed signal will be seriously distorted. However, too few layers are not conductive to the separation of noise and signals. According to the Nyquist theorem, the maximum frequency of the ECG signal we processed can be assumed as 512Hz, where the sampling rate is 1024Hz, so the maximum layers that we can use is 9. In this paper, we use 4 layers. In this case, the ECG signals are decomposed into the details d1-d4 and one approximation a4. For each segment, the detail wavelet coefficiets of d1 are noise signals that should be eliminated and the coefficients of d2,d3,d4 represent high frequency parts of the ECG signal.  4 We compare the denoising effect of 10 types of wavelet basis functions in MATLAB that support DWT.

Fig. 2. The de-noise results of ECG with different wavelet basis
We choose symlets wavelets (sym3) as the wavelet function to decompose the ECG signals and the thresholding method is employed to remove the noise. The minimum frequency resolution can be estimated by equation (8) Figure 3 is the original signal, and Figure 4 is the processed ECG signal after reconstruction.

Features Extraction and Heart Rhythm Classification
The ECG features can be extracted in time domain and frequency domain [9], which play a significant role in diagnosing the cardiac disease. The features we select are composed of two parts: statistical data of ECG characteristic waves and wavelet coefficients.
Statistical data of ECG characteristic waves can be divided into four categories: The location, time interval, amplitude of characteristic waves(i.e. the relative position of S waves, Q-T interval and the amplitude of R peak) and integral area of QRS complex. One cardiac cycle of an ECG signal consists of the P-QRS-T waves [7], whose amplitudes and interval value are significant indicatiors of human physiological status. The coefficients of the wavelet transform contain the information of the energy distribution of the signal in time and frequency. We choose approximation coefficients a4 as our feature vectors.
In the numerical experiments, we have used ECG segments form MIT-BIH Arrhythmia Database corresponding to the normal beats (N) and 4 types of arrhymias, including left bundle branch block (LBBB), right bundle branch block (RBBB), and ventricular premature beats (VPC) and atrial premature contraction (APC). N, RBBB, LBBB, VPC, APC are extracted respectively from the record 100, 118, 109,136 and 208.

Fig.7 Average of RR interval characteristics
Based on these features of the ECG segments, we use an SVM-based classifier to detect and classify 5 types of heart rhythms. An SVM with a Gaussian kernel is trained with the signal segments we extracted from MIT-BIH Arrhythmia Database. The accuracy of the model is acceptable, which is shown as follows: 36-50 years old, and 5 males and 5 females over 51 years old are selected to verify the universality of this method. They are divided into static state, walking state, running state and jumping state. Given that people with different ages have different physical conditions, the running pace is set at 12km/h for the 15-35 years old group, 10km/h for the 36-50-year-old group, and 8km/h for the 51+ group. Each state lasts for 3 minutes, during which data is obtained by reading and recording the real-time human body signal every 10s, and then taking the average. In order to reflect different physiological states of the human body objectively, each person completes only one set of tests every day for a total of 10 days, during which they need to change their states.

Experimental results and analysis
We finally collected 1560 segments from 30 participants (350 in jumping state, 410 in static state, 395 in running state 405 in walking state). We extracted several time domain features that are useful to distinguish the human states. The experimental data of Q-T interval is shown in Table 2. From the experimental results, it can be seen that the low-age group has a slightly longer Q-T interval, which corresponds to the faster human body signal, and the high-age group has the slowest Q-T interval and the slowest human body signal, and the middle-age group is moderate. At this time, the low-age group is due to Physical indicators are better than those of middle-aged and high-age people, whose human body signal rises significantly when walking slowly, while those of middle-age and high-age people walk slowly and steadily, so their human body signal is relatively low. We used the wavelet transform model and selected some of the features deacribed in THEORETICAL VERIFICATION OF THE ALGORITHM section. We trained a SVM model and the precision and recall were 89.41% and 92.36%, and the average accuracy was 90.06%. The classification result shows that our single-lead ECG delineation wearable system can be used to collect and pre-process the ECG signal of human body and the algorithm which consists of noise removal, QRS-P-T characteristic wave detection, feature extraction and classification, is effective in distinguishing some human states or motion in daily life (static, walking, jumping and running states of different genders and ages).

DISCUSSION
In this paper, we develop a single-lead ECG delineation wearable system, propose a method for detecting and judging the health states of the subject is given, evaluate the user experience and recognition performance through user studies. Based on the results, we discuss the scenarios that this device can be applicable to, limitation and future work of this technique. This system can be applied to other medical diagnostic equipment or computing devices including Smart Sports Bracelets which are equipped with multiple microsensors and signal processors. It can be used to monitor heart rate, exercise status in the real time and provide support for users of different ages and genders to specify personalized fitness programs.
We discuss several limitations of this system, which is mainly due to the signal acquisition and preprocessing circuit with relativelt low precision. The single-lead ECG delineation wearable system provides only some basic ECG data processing functions (e.g.filters and FFT with adjustable sampling window sizes and window functions). For example, we cannot distinguish different heart rhythm types or more types of human states with the ECG signal collected by this system because of some non-ideal effects in the actual user experiment, like high frequency interferences and motion artifact distributed in ECG. To overcome this, a more sophisticated circuit with more powerful signal pre-processing functions should be applied. We expect this to be technically solved in the future so that this system can be used to allow for a larger set of human status or health states by adapting our current algorithm.

Conclusion
This paper presents a method for detecting human health by detecting wearable devices. By extracting the sensor signal of the wearable device, the human body motion state can be distinguished. The body signal is input into the machine learning model as a feature vector, so that the machine learns the features, and according to the different states of the human body, a method for detecting and judging the health state of the subject is given. The results show that the wearable device health check method can accurately estimate the human body signal in real time and can effectively improve the accuracy of health detection.