Abstract
This paper presents a prototype implementation of arrhythmia classification using Probabilistic neural network (PNN). Arrhythmia is an irregular heartbeat, resulting in severe heart problems if not diagnosed early. Therefore, accurate and robust arrhythmia classification is a vital task for cardiac patients. The classification of ECG has been performed using PNN into eight ECG classes using a unique combination of six ECG features: heart rate, spectral entropy, and 4th order of autoregressive coefficients. In addition, FPGA implementation has been proposed to prototype the complete system of arrhythmia classification. Artix-7 board has been used for the FPGA implementation for easy and fast execution of the proposed arrhythmia classification. As a result, the average accuracy for ECG classification is found to be 98.27%, and the time consumed in the classification is found to be 17 seconds.
1. Introduction
According to British Heart Foundation, more than 5 million people a year suffer from arrhythmias or heart rhythm problems worldwide. According to the latest survey, it has been estimated that 6–12 million people worldwide will suffer this condition in the US by 2050 and 17.9 million people in Europe by 2060 [1, 2]. Atrial fibrillation (AFib) is a kind of arrhythmia, and the estimated number of individuals with AFib in 2010 was 33.5 million, according to a 2013 study. That’s about 0.5 percent of the world’s population. Bradycardia, ventricular tachycardia, and ventricular fibrillation may also result in several other heart problems, which may require the implantation of cardiac devices such as pacemakers and defibrillators. Several life-threatening diseases such as heart attack, sudden cardiac arrest, and stroke can be avoided if arrhythmias are diagnosed early. Several classification algorithms are available to classify arrhythmias, such as support vector machine (SVM), artificial neural network (ANN), convolutional neural network, and neuro-fuzzy classifier. Some hardware has also been proposed [3–50]. For arrhythmia classification, feature selection is an unavoidable task to perform. Some literatures have selected morphological features, whereas some have frequency domain chosen features to classify the ECG. To achieve accurate classification, the best feature selection is the combination of time and frequency domain features of ECG. There are several classes of arrhythmia such as bradycardia, tachycardia, fibrillation, paced beat (PB), left bundle branch block (LBBB), and right bundle branch block (RBBB). In these arrhythmia classes, some may result in life-threatening situations for cardiac patients. FPGA implementation of neural network-based ECG classification has been proposed earlier using a system generator to classify the ECG into only two classes [15, 18]. Apart from FPGA, hardware implementation using some different processors has also been proposed for ECG analysis: features extraction and classification [5, 17, 30, 31, 44–55]. Jiahao et al. [31] have presented CNN-based ECG classification hardware implementation with 99.1% average accuracy. The average accuracy is perfect. However, they have classified the ECG only into five classes.
Despite a considerable number of software-based ECG classifiers available, prototype chips are still required at the user level to classify ECG, as all of them will not be familiar with the software classifiers. Furthermore, a trade-off has been seen between accuracy and the number of arrhythmia classes in all these existing works. To overcome the limitation of the current results, a fast and straightforward classification and the corresponding hardware implementation have been proposed to classify the ECG into eight classes with 98.27% average accuracy using a unique combination of ECG features. The block diagram of the proposed classification is shown in Figure 1.

Figure 1 shows various steps for FPGA implementation of ANN-based arrhythmia classification. In the first block, ECG has been extracted from the MIT-BIH database in raw form. Then, the ECG is preprocessed using a low pass filter, notch filter, and high pass filter to remove muscle noise, powerline interference, and baseline wander, respectively. After the preprocessing, ECG features heart rate, spectral entropy, and 4th order autoregressive coefficient are extracted. These features are used to train artificial neural network (ANN) to classify the ECG into eight classes: normal sinus rhythm (NSR), atrial paced beat (APB), paced beat (PB), ventricular tachycardia (VT), ventricular fibrillation (VF), right bundle branch block (RBBB), Left bundle branch block (LBBB) and preventricular contraction (PVC), as shown in Figure 2. After training of ANN, FPGA implementation of pretrained ANN has been executed using Xilinx System Generator (XSG); an average classification accuracy of 98.27% has been achieved. The main contributions of the proposed arrhythmia classification are as follows:(i)The ECG has been classified into eight classes: NSR, APB, PB, VT, VF, RBBB, LBBB, and PVC.(ii)A unique combination of ECG features: spectral entropy, 4th order autoregressive coefficients, and heart rate have been used for feature selection.(iii)PNN-based classifier has been used to achieve an average classification accuracy of 98.27%.(iv)An FPGA-based hardware implementation has also been presented and implemented on the Artix-7 board. The proposed hardware comprises fewer components, and thus, the power and time consumption in arrhythmia classification is significantly less.

The rest of the paper has been organized as follows: Section 2 presents a hardware implementation of ECG preprocessing and features extraction. Training and hardware implementation of ANN has been discussed in Section 3. Section 4 presents classification results and analysis. Conclusion and future scope have been presented in Section 5.
2. ECG Preprocessing and Features Extraction
For the classification of arrhythmia, an ECG database is required. For ECG classification, several databases are available: MIT-BIH database, Massachusetts General Hospital/Marquette Foundation (MGH/MF) database, European ST-T database, Apnea-ECG database, etc. Among all these databases, the MIT-BIH database provides ECG data compatible with MATLAB. Therefore, in this work, arrhythmia databases are accessed in MATLAB from the MIT-BIH database, and preprocessing has been performed as it is known that ECG is a low-frequency signal and in the range of 0.05 Hz to 100 Hz. However, it is initially in raw form and includes various noises. Therefore, high pass filter, low pass filter, and notch filter are used to remove the noise. In addition, the analog ECG signals were sampled at a frequency of 360 Hz to use a notch filter with a notch frequency of 60 Hz for removing powerline interference and bandpass filtering at 0.1–100 Hz to avoid antialiasing saturation in analog to digital conversion. After the preprocessing, heart rate can easily be obtained. The original ECG, filtered ECG, and extracted heart rate have been processed using XSG, and the corresponding waveforms are shown in Figure 3.

In the above figures, a bradycardia database has been accessed, as shown in Figure 3. In the first waveform, raw ECG is shown, which is preprocessed for the further classification process. The second waveform is the filtered or preprocessed ECG. After R-peak detection, heart rate is extracted, which is shown in the third waveform. It can be seen the extracted heart rate is below 60 beats per minute (bpm). After preprocessing of the ECG, features extraction is performed. In general, ECG waveform in the time domain is presented by six segments P-QRS-T-U, for ease in the processing as shown in Figure 4.

The features extracted in the time domain are known as morphological features, whereas sometimes features are extracted in the frequency domain known as frequency domain features. Most of the information for arrhythmia is obtained from the QRS segment of ECG. To obtain accurate classification, features from both domains, time and frequency, should be considered. The proposed work’s unique combination of six features: heart rate, spectral entropy, and 4th order autoregressive coefficient are considered. Heart rate is a morphological feature obtained by detecting R-peaks followed by an R-R interval of two consecutive P-QRS-T-U waves of ECG. After extraction of heart rate, autoregressive (AR) modeling of ECG is performed. As ECG is a time series signal, it is required to measure the correlation between its samples. AR modeling is basically used to predict the correlation between the present sample and the samples that precede/succeed the current value. In other words, it can be said that AR modeling provides the past and future behavior of ECG signals. An autoregressive (AR) model of order N can be expressed as
The autoregression name is derived from the fact that the variable y is regressed on its previous value. In the proposed work, 4th order autoregressive coefficients are obtained using Burg’s method to classify PVC, VT, VF, etc., accurately. In MATLAB, commands are available to obtain AR coefficients. After extraction of these five time-domain features, a frequency domain feature, spectral entropy, is obtained. To measure spectral power distribution, spectral entropy (SE) is estimated by Shannon’s channel entropy using the following equation:where H(x) presents spectral entropy, P(xi) presents probability distribution function, and i = 1 to n is n-point discrete Fourier transform (DFT) of the sampled discrete-time ECG. It is used to measure the power distribution of ECG at different frequencies. The block diagram of feature extraction is presented in Figure 5.

XSG is used to transfer the extracted ECG features to the Xilinx. The extracted features and Simulink output for the corresponding values are shown in Figures 6 and 7, respectively.


After extraction of ECG features, training of ANN, classification, and FPGA implementation of the complete system are performed.
3. FPGA Implementation of ECG Classification Using ANN
Heart rate, spectral entropy, and AR coefficients are used for the training of ANN. Implementing a neural network on Simulink is a difficult task to perform; however, for processing in XSG, it is a mandatory process to implement NN on Simulink. An ECG with 10 seconds duration is considered for the proposed method; therefore, a total of 3600 samples was used to train ANN as ECG was initially sampled at 360 Hz. A probabilistic neural network (PNN) with two hidden layers is used for fast training and better performance advantages. In the proposed work, the first layer of PNN consists of six features. Then, two hidden layers are used to classify the ECG. Finally, the output layer consists of an eight-bit target vector to discriminate the particular arrhythmia class. The Simulink block diagram of PNN is shown in Figure 8.

As six ECG features are selected in this proposed work for arrhythmia classification, and 1050 samples are taken for each feature, therefore in NN, Layer 1 will consist of 6 × 1050 neurons. In contrast, Layer 2 consists of 6 × 1050 × 8 neurons, where 8 is the number of outputs. Finally, the output layer has eight classes. The internal structures of hidden Layer 1 and hidden Layer 2 are shown in Figure 9.

In various software, direct commands are available to execute NN, which do not provide any information about the hidden layers. In contrast, Simulink provides the facility to have detailed information about the hidden layer architecture and neurons. From Figure 10, it can be easily seen that where weights and bias are added. The detail of internal circuitry can also be seen when we implement neural network on Simulink. For classification, two activation functions: Tansig and Softmax are used. Tansig is used for calculating output from the net input, whereas Softmax is used to convert a vector of numbers into a vector of probabilities. In the proposed method, PNN has an output of eight bits, known as a target vector, to discriminate a particular class of arrhythmia. The arrhythmia classes and their corresponding target vectors are shown in Table 1.

After training, validation, and testing, accuracy for various arrhythmia classes is obtained, and it is found that the average accuracy of overall arrhythmia classification is found to be 98.27%. Accuracy for various classes of arrhythmia is shown in Figure 10.
From the above figure, it can be seen that among eight classes of ECG, most of the classes have a classification accuracy of more than 96%, except ventricular fibrillation (VF). This amount of accuracy is the lesser number of training data for VF. It can be improved by increasing the training data for VF. After validation and testing, FPGA implementation of the complete classification system is obtained using XSG. The block diagram of neural network-based ECG classification is shown in Figure 11.

Register transfer logic (RTL) for the ANN having eight arrhythmia classes at the output is presented in Figure 12. The RTL of NN hardware comprises mainly two blocks: NN hardware and clock_driver. The ‘NN hardware’ block has a neural network algorithm, whereas ‘clock_driver’ provides a clock of 100 Hz for parallel processing. Block NN hardware provides the eight classes of arrhythmia: APB, LBBB, NSR, PB, PVC, RBBB, VF, and VT. Device utilization and timing analysis for the proposed NN-based ECG classification are discussed in the next section.

4. Results and Analysis
The ECG has been classified into eight classes with an adequate average accuracy of 98.27%, and the proposed ANN-based classifier has been implemented on Artix-7 using XSG. Furthermore, for validation of the proposed classifier, the complete system generator block for PNN-based ECG classifier has been successfully implemented on the Artix-7 FPGA board, as shown in Figure 13.

The device utilization analysis of the corresponding hardware is presented in Table 2.
Table 2 indicates that the components used in the design of NN-based arrhythmia classification are very less and the implementation consumes less time and power. Therefore, the proposed design will have less computational complexity, a notable achievement for a neural network hardware implementation. As mentioned above, the overall accuracy achieved for arrhythmia classification into eight classes is 98.27%. The comparative analysis of the proposed work with some existing work is shown in Table 3.
It has been seen from Table 3 that among all the mentioned existing works, the proposed hardware has better performance as compared to the other reported works. All of them have fewer arrhythmia classes at the output and a large number of components used for the hardware implementation. The unique set of features are used in the proposed work. Most of the parameters are better as compared to the other existing works. Bonded IOBs are higher than the other existing works which is the only limitation of the proposed hardware implementation which is due to use of ECG features of different domain. The works reported in [7, 22] have more considerable accuracy of classification. However, they classified the arrhythmia only into two classes. The total time consumption for classification of ECG is reported 17 sec, which is the minimum time consumption reported till now.
5. Conclusions and Future Works
Probabilistic neural network-based arrhythmia classification and its hardware implementation had been discussed in this paper. ECG was preprocessed, and a unique combination of ECG features, spectral entropy, 4th order autoregressive coefficient, and heart rate, had been extracted to classify the arrhythmia accurately. PNN classification of arrhythmia was performed first on MATLAB and then on FPGA using Xilinx System Generator with an impressive average accuracy of 98.27% for eight classes of ECG. The implementation was performed on the Artix-7 FPGA board using Verilog inbuilt simulator. Device utility analysis of the proposed classification described that the components used in this algorithm are very low and consume less time and power, i.e., 17 sec and 25 mW. Vivado inbuilt simulator can also be used in the extended work for arrhythmia detector which may replace the use of two software. Several FPGA boards are now available that can directly access multiple of sensors. Thus, in future, real-time ECG classification can be performed using ECG sensors integrated with the Artix-7 FPGA board. 10-lead ECG sensors are more accurate than the 3-lead sensor; however, the placement of leads is a challenging task. Therefore, it would be better to use 3-lead ECG sensor for real-time arrhythmia classification.
Data Availability
The datasets used to support this study are available from the authors on request.
Conflicts of Interest
The authors declare that they have no conflicts of Interest related to this work.