한국센서학회 학술지영문홈페이지
[ Article ]
JOURNAL OF SENSOR SCIENCE AND TECHNOLOGY - Vol. 30, No. 1, pp.20-24
ISSN: 1225-5475 (Print) 2093-7563 (Online)
Print publication date 31 Jan 2021
Received 21 Jan 2021 Revised 28 Jan 2021 Accepted 30 Jan 2021
DOI: https://doi.org/10.46670/JSST.2021.30.1.20

A Novel Spiking Neural Network for ECG signal Classification

Amrita Rana1 ; Kyung Ki Kim2, +
1Department of Electronic Engineering, Daegu Universtiy Daegudaero 201, Gyeongsan, Gyeongbuk 38543, Korea
2Department of Electronic Engineering, Daegu Universtiy Daegudaero 201, Gyeongsan, Gyeongbuk 38543, Korea

Correspondence to: + kkkim@daegu.ac.kr

This is an Open Access article distributed under the terms of the Creative Commons Attribution Non-Commercial License(https://creativecommons.org/licenses/by-nc/3.0/) which permits unrestricted non-commercial use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract

The electrocardiogram (ECG) is one of the most extensively employed signals used to diagnose and predict cardiovascular diseases (CVDs). In recent years, several deep learning (DL) models have been proposed to improve detection accuracy. Among these, deep neural networks (DNNs) are the most popular, wherein the features are extracted automatically. Despite the increment in classification accuracy, DL models require exorbitant computational resources and power. This causes the mapping of DNNs to be slow; in addition, the mapping is challenging for a wearable device. Embedded systems have constrained power and memory resources. Therefore full-precision DNNs are not easily deployable on devices. To make the neural network faster and more power-efficient, spiking neural networks (SNNs) have been introduced for fewer operations and less complex hardware resources. However, the conventional SNN has low accuracy and high computational cost. Therefore, this paper proposes a new binarized SNN which modifies the synaptic weights of SNN constraining it to be binary (+1 and -1). In the simulation results, this paper compares the DL models and SNNs and evaluates which model is optimal for ECG classification. Although there is a slight compromise in accuracy, the latter proves to be energy-efficient.

Keywords:

Deep neural network, Spiking neural network, Binarized SNN, Electrocardiogram(ECG) classification

1. INTRODUCTION

Cardiovascular Disease (CVD) is the leading cause of human death and was responsible for 31% of deaths worldwide in 2016 [1]. An electrocardiogram (ECG) is widely used in the medical field to diagnose heart diseases. Usually, ECG is obtained by electrodes placed on the skin of the patient, which record the electrical changes during the cardiac cycles, from cardiac muscle depolarization to repolarization. A typical ECG signal, as illustrated in Fig. 1, consists of a P wave, QRS complex, T wave, and U wave; the size and shape of this signal contains useful information about the nature of the disease or abnormality afflicting the heart.

Fig. 1.

The typical ECG waveform.

In most cases, the existing examination methods are inefficient owing to a considerable amount of heterogeneous data, which must be rigorously analyzed to obtain high accuracy in diagnosis. Deep learning (DL) refers to the study of knowledge extraction, predictions, intelligent decision making, or recognizing patterns with the help of a set of training data. Compared with the conventional learning techniques, deep neural networks (DNNs) are more scalable because higher accuracy is achieved by increasing the size of the network or the training dataset. In particular, DNNs are extensively used for classification purposes in different domains. The majority of DL based algorithms have developed for image (2-D) classification.

In [2], a convolutional neural network (CNN) was proposed, which is the most popular DNN architecture usually trained with the gradient-based optimization algorithm. In general, a CNN consists of multiple back-to-back layers connected in a feed-forward manner. The main layers include the convolutional, normalization, pooling, and fully-connected layers. The layers at the beginning are responsible for extracting features, whereas the fully-connected layers at the end are in charge of classification. A CNN architecture has exhibited 98.1% accuracy for classifying five arrhythmias [2]. In [3], the authors proposed an ECG classification system based on long short term memory and a CNN; their classifier achieved 88.33% accuracy. In [4], recurrent neural network based arrhythmia classification was conducted, and an accuracy of 88.1% was achieved. Also, Ref. [5,6,7] showed the recent works based on Deep CNN and RNN for accurate arrhythmia detection. These algorithms automatically extract the features from the given data and hence showed high accuracy. These works demonstrated high accuracy; however, the DL architecture was deep, which resulted in a high computational cost. This poses a challenge for low power devices. In order to reduce the computational cost in a DL architecture, spiking neural networks (SNNs) were introduced. In this type of network, the information is processed based on the propagation of spikes through the network as well as the timing of the spikes. It provides the opportunity for low-power operation [8,9].

In Ref. [10], a wearable device for ECG classification system was developed, which achieved an accuracy of 97.9%. The paper employed spike-timing-dependent plasticity (STDP), in which the model weights are trained according to spike signal timing and reward or punishment signals. In Ref. [11], an energy-efficient ECG classification method was designed with an SNN, and 77.49% accuracy was achieved. The conventional SNN has low accuracy or high computational cost. Therefore, this paper proposes a new binarized SNN which modifies the synaptic weights of SNN constraining it to be binary (+1 and -1), compares the traditional DL models, the conventional SNN, and the proposed Binarized SNN in terms of accuracy and power.


2. BACKGROUND

2.1 Deep Neural Networks (DNNs)

Ref. [12,13] proved that DNNs could be trained for ECG signal analysis with excellent classification accuracy. However, most studies in the literature use machine learning algorithms for preprocessing. Fig. 2 illustrates the difference between machine learning and DL.

Fig. 2.

Machine learning vs deep learning [14].

Machine learning methods require feature extraction from the original data to conduct accurate classification and detection. The modified version of machine learning called DL excludes the manual feature extraction step.

Fig. 3 presents the CNN architecture for ECG image classification. It is an 11-layered architecture.

Fig. 3.

The architecture of 11-layered CNN [13].

2.2 Spiking Neural Network (SNN)

The third generation of neural networks, referred to as SNNs, provides a low-power operation [15,16]. In this type of network, the information is processed based on the propagation of spike signals through the network and the timing of the spikes. Fig. 4 shows the basic SNN architecture. The dense network of neurons is interconnected by synapses. In an SNN, a synapse is a weighted path for generated spikes from one neuron to the other connected neurons. Each neuron in the first layer is connected to all neurons in the second layer via a synapse. The inputs to the SNN are given with spike trains, which represent the stimulus caused by its receptive field. Spike-time dependent plasticity (STDP) is the most common learning algorithm used to train an SNN [17]. Previous SNN algorithms that process ECG signals employed non-SNN algorithms for pattern extraction.

Fig. 4.

SNN architecture.

The STDP rule uses an exponential weight dependence to compare the weight change and is given as

w=ηpostxpreexp-βw-xtarexp-βwmax-w(1) 

where β determines the strength of weight dependence.

SNNs exhibit exceptional results when applied to computer vision tasks such as digit recognition [18]. This is mainly because the spiking neuron models are inspired by neuroscience studies. SNNs are also applied to the classification task of EEG data. Despite the success of SNNs in hardware, the algorithm still needs to compromise on accuracy. The existing SNN algorithms can be optimized for reducing computation. However, it is difficult to scale up the operation of SNNs to large machine learning tasks. Another issue is the complex training algorithm, which increases computational cost. To address this issue, we propose a 3-layer binarized SNN architecture in section 3. The idea is motivated by the binarized neural network, where the parameter values are constrained to -1 and +1 [19].


3. PROPOSED BINARIZED SNN

Binarized SNN converts the high-precision weights into binary weights, i.e., -1 and 1. The mathematical formulation is given by

xb=Sign x=+1if x0-1otherwise(2) 

where x is the real value of the weight and xb is the binarized output weight.

Usually, in full-precision networks, a large number of calculations is spent on calculating dot products of matrices as needed by fully connected and convolutional layers. The method was motivated by the binarized neural network in which all the network parameters are constrained to be binary. This conversion technique can reduce the overall training time and cost of the SNN architecture.


4. RESULTS AND DISCUSSIONS

This section discusses the parameters of different DL architectures and evaluates them based on resource utilization, accuracy, and power.

The training dataset in the case of CNN are 15,000 samples per Normal/Abnormal ECG. The network parameters shown in Table 1 are used from Ref. [8] for ECG classification. The CNN model is tested only on the software layer because of more number of layers, which will consume more resources as compared to other networks.

Network parameters of CNN.

The probabilistic encoding method converts the pixel value of the input image to spike trains and feeds it into the SNN. In addition, the same encoding method is adopted in conventional and binarized SNN in Table 2, 3 respectively for ECG classification.

Network parameters of SNN

Network parameters of Binarized SNN

The number of training samples for both the SNN architectures is 2000, where 1000 samples are of Normal ECG and 1000 are of abnormal ECG taken from Physionet’s PTB Diagnostic ECG Database [20].

All simulations were performed on PyCharm IDE. Then the accuracy is obtained and deployed the algorithms on PYNQ-Z2 FPGA synthesize the resource utilization by the respective algorithms. Table 4 compares various evaluation factors of the algorithms.

Comparison of DNNs.

As shown in Table 4, the CNN utilized the highest amount of memory during the synthesis process; however, the power for the CNN was not measured. In addition, the CNN gained a higher accuracy; however, it is inferior in resource utilization. In contrast, from a hardware perspective, the SNN performed well. The performance is tested on static 2D ECG images. Because of the term binarization, the SNN network has to compromise with the accuracy and only an improvement of 3% was achieved. As a whole, from Table 4, the proposed binarized SNN proves to be the optimal architecture for normal and abnormal ECG classification.


5. CONCLUSION

This study compared DL models to the energy-efficient SNN model in terms of accuracy, power, and memory. Among the architectures described here, binarized SNN consumed the least power (approximately 0.176 W). The CNN was more accurate than the other two models. However, we conclude that to constrain the power of embedded devices, the accuracy needs to be compromised. The algorithm successfully classified ECG images as Normal and Abnormal with a 2× performance improvement in a binarized SNN.

Future studies will aim to extend the number of arrhythmias to be classified and make the network hardware friendly. There is a growing belief that an SNN can potentially overcome the limitations of DNNs. Moreover, it can potentially enable low-power hardware evaluation.

REFERENCES

  • E. J. Benjamin, S. S. Virani, C. W. Callaway, A.M. Chamberlain, A. R. Chang, S. Cheng, et al., Heart disease and stroke statistics-2018 update: A report from the American heart association. Circulation, Vol. 137, No. 12, pp. 67, Jan. 2018. [https://doi.org/10.1161/CIR.0000000000000573]
  • R. Avanzato, F. Beritelli, “Automatic ECG Diagnosis Using Convolutional Neural Network”, Electronics, Vol. 9, No. 6, pp. 1-14, Jun. 2020. [https://doi.org/10.3390/electronics9060951]
  • P. Zhang, J. Cheng, Y. Zhao, “Classification of ECG Signals Based on LSTM and CNN”, Artificial Intelligence and Security, 6th International Conference (ICAIS), pp. 278-289, Sep. 2020. [https://doi.org/10.1007/978-981-15-8101-4_26]
  • S. Singh, S. K. Pandey, U. Pawar, R. R. Janghel, “Classification of ECG Arrhythmia using Recurrent Neural Networks”, International Conference on Computational Intelligence and Data Science (ICCIDS ), pp. 1290-1297, May. 2018. [https://doi.org/10.1016/j.procs.2018.05.045]
  • S. Kiranyaz, T. Ince, and M. Gabbouj, “Real-time patient-specific ECG classification by 1-d convolutional neural networks,” IEEE Trans. Biomed. Eng., Vol. 63, No. 3, pp. 664-675, Aug. 2016. [https://doi.org/10.1109/TBME.2015.2468589]
  • Y. H. Hu, S. Palreddy, and W. J. Tompkins, “A patient-adaptable ECG beat classifier using a mixture of experts approach,” IEEE Trans. Biomed. Eng., Vol. 44, No. 9, pp. 891-900, 1997. [https://doi.org/10.1109/10.623058]
  • T. Ince, S. Kiranyaz, and M. Gabbouj, “A generic and robust system for automated patient-specific classification of electrocardiogram signals,” IEEE Trans. Biomed. Eng., Vol. 56, No. 5, pp. 1415-1426, May. 2009. [https://doi.org/10.1109/TBME.2009.2013934]
  • M. R. Azghadi, N. Iannella, S. F. Al-Sarawi, G. Indiveri, et al., “Spike-based synaptic plasticity in silicon: Design, implementation, application, and challenges,” Proc. IEEE, Vol. 102, No. 5, pp. 717-737, May 2014. [https://doi.org/10.1109/JPROC.2014.2314454]
  • N. Qiao and G. Indiveri, “Scaling mixed-signal neuromorphic processors to 28 nm FD-SOI technologies,” Proceedings of IEEE Biomed. Circuits and Systems Conference (BioCAS), pp. 552-555, Aug. 2016. [https://doi.org/10.1109/BioCAS.2016.7833854]
  • A. Amirshahi and M. Hashemi, “Ultra Low-Power and Real-time ECG Classification Based on STDP and R-STDP Neural Networks for Wearable Devices”, IEEE Trans Biomed Circuits Syst (TBioCAS), pp. 1-8, Dec. 2019.
  • Z. Yan, J. Zhou, W.Wong, “Energy efficient ECG classification with spiking neural network”, Biomed Signal Process Control, Vol. 63, pp. 1-7, Aug. 2020. [https://doi.org/10.1016/j.bspc.2020.102170]
  • M. Kachuee, S. Fazeli, and M. Sarrafzadeh. ECG heartbeat classification: A deep transferable representation. Proceedings - IEEE International Conference on Healthcare Informatics,( ICHI), pp. 443-444, Apr. 2018. [https://doi.org/10.1109/ICHI.2018.00092]
  • A. Y. Hannun, P. Rajpurkar, M. Haghpanahi, et. al., Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network. Nature medicine, Vol. 25, No. 1, pp. 65, Jan. 2019. [https://doi.org/10.1038/s41591-018-0268-3]
  • B. Grossfeld, Article: “Deep learning vs machine learning: a simple way to understand the difference”, Jan. 2020.
  • D. Soni, “Spiking Neural Networks, the Next Generation of Machine Learning”, Towards Data Science Blog, Jan. 2018.
  • C. Nicholson, “Spiking Neural Networks”, Pathmind, A.I.Wiki.
  • P. U. Diehl and M. Cook, “Unsupervised learning of digit recognition using spike-timing-dependent plastcity”, Frontier in Computational Neuroscience, Aug. 2015. [https://doi.org/10.3389/fncom.2015.00099]
  • S. R. Kulkarni, B. Rajendran, “Spiking Neural networks for handwritten digit recognition-Supervised learning an network optimization”, ELSEVIER: Neural Networks, Vol. 103, pp. 118-127, Jul. 2018. [https://doi.org/10.1016/j.neunet.2018.03.019]
  • M. Courbariaux, et al., “Binarized Neural Network: Training Neural Networks with Weights and Activations Constrained to +1 or -1”, Machine Learning, pp. 1-11, Mar. 2016.
  • ECG Dataset : www.physionet.org, (retrieved on Dec.17, 2020

Fig. 1.

Fig. 1.
The typical ECG waveform.

Fig. 2.

Fig. 2.
Machine learning vs deep learning [14].

Fig. 3.

Fig. 3.
The architecture of 11-layered CNN [13].

Fig. 4.

Fig. 4.
SNN architecture.

Table 1.

Network parameters of CNN.

Definition Values
Number of layers 11
Input layer neurons 16384
Kernel size 3 × 3
Learning rate 0.001
Learning algorithm Gradient Descent
Max-pool 2 × 2
Epochs 100

Table 2.

Network parameters of SNN

Definition Values
Number of layers 2
Input layer neurons 784
Output layer neurons 3
Total timestep 200
Type of neuron interconnection Fully connected
Neural encoding method Probabilistic encoding
Learning method STDP

Table 3.

Network parameters of Binarized SNN

Definition Values
Number of layers 3
Input layer neurons 784
Hidden layer neurons 64
Output layer neurons 3
Total timestep 200
Type of neuron interconnection Fully-connected binarized weights
Neural encoding Probabilistic

Table 4.

Comparison of DNNs.

Algorithms Accuracy (%) Power (W) Memory (%)
CNN [8] 98.1 - 350
SNN [17] 82.3 1.55 98
Binarized SNN 85.0 0.17 48