The Effects of Compression on the Detection of Atrial Fibrillation in ECG Signals

: Although Atrial Fibrillation (AF) is the most frequent cause of cardioembolic stroke, the arrhythmia remains underdiagnosed, as it is often asymptomatic or intermittent. Automated detection of AF in ECG signals is important for patients with implantable cardiac devices, pacemakers or Holter systems. Such resource-constrained systems often operate by transmitting signals to a central server where diagnostic decisions are made. In this context, ECG signal compression is being increasingly investigated and employed to increase battery life, and hence the storage and transmission efﬁciency of these devices. At the same time, the diagnostic accuracy of AF detection must be preserved. This paper investigates the effects of ECG signal compression on an entropy-based AF detection algorithm that monitors R-R interval regularity. The compression and AF detection algorithms were applied to signals from the MIT-BIH AF database. The accuracy of AF detection on reconstructed signals is evaluated under varying degrees of compression using the state-of-the-art Set Partitioning In Hierarchical Trees (SPIHT) compression algorithm. Results demonstrate that compression ratios (CR) of up to 90 can be obtained while maintaining a detection accuracy, expressed in terms of the area under the receiver operating characteristic curve, of at least 0.9. This highlights the potential for signiﬁcant energy savings on devices that transmit/store ECG signals for AF detection applications, while preserving the diagnostic integrity of the signals, and hence the detection performance.


Introduction
Atrial fibrillation(AF) is the most common sustained cardiac arrhythmia in clinical practice. Patients are at increased risk for death, heart failure, hospitalization, and thromboembolic events due to AF [1][2][3].
AF is a global health care problem with evidence suggesting increasing prevalence and incidence worldwide [4][5][6]. The prevalence of AF has almost doubled in the last decade, being currently 2% in unselected patient populations. Its occurrence varies with age (present in almost 20% of octogenarians) and concomitant diseases [7,8]. Moreover, AF can increase the risk of strokes, heart failure and other heart-related complications and it indicates a high probability of coexisting cardiovascular or systemic diseases [9]. Many approaches have been employed to detect AF episodes based on electrocardiogram (ECG) signal analysis [10]. Nevertheless, the occurrence of this arrhythmia is intermittent (so-called paroxysmal AF (PAF)) and it is frequently misdiagnosed. However, it is necessary to improve PAF detection to enable appropriate strategies to be appropriately implemented to prevent or reduce the risk of stroke, the most severe consequence of AF. Ambulatory systems represent a suitable approach for continuous monitoring of cardiac patients outside the clinical environment. Ambulatory monitors are small, portable electrocardiograph machines. Each type of monitor has unique features related to limitation in length of recording time and ability to send the recordings over wireless data networks to centralized servers.
The ECG signal is normally measured on the body surface, so the signal acquisition is a non-invasive; this approach is widely used for heart disease diagnoses and healthcare [11,12]. The compressibility of ECG data is based on the analysis of the important components of the signal; that is, P wave, QRS wave, T wave, and ST interval. AF can be characterized in an ECG signal by the absence of discrete P-waves which are replaced by rapid deflections of relatively low amplitude and of varying timing and morphology known as fibrillatory waves (f-waves), as well as unpredictable depolarisation of the ventricles (no pattern to R wave occurrence in the ECG). Fibrillation of the atria may result in a chaotic disturbance of the isoelectric line, however, this finding in an ECG can be misleading as muscular activity or other agitation can have a similar effect [13]. Equally, it can often be difficult to tell if P waves are present or not in an ECG.
In recent years, there has been increasing interest in the development of computeraided diagnostic approaches for many common chronic illnesses, particularly cardiovascular conditions such as AF. Several approaches have been developed for automated computer-based diagnosis of AF from ECG waveforms. Asgari et al. recently proposed a stationary wavelet transform and support vector machine combination to detect AF [14], while other approaches have employed P-wave absence, f-wave presence, and noise level to achieve substantial improvement in detecting brief AF episodes. Due to the difficulty of detecting atrial activity from surface ECG and the relative success of QRS detection algorithms, methods focusing on measures such as R-R interval sequences, R-R variation and density histograms of R-R intervals [15] are typically employed for AF detection.
Ambulatory monitoring systems such as Holter monitors record ECG signals continuously, generally for a period of between 24 to 48 h. Given the sampling frequencies involved and the potentially long monitoring duration required, such an architecture involves the acquisition of large amounts of ECG data [16][17][18][19][20].
Coupled with this is the fact that truly ambulatory devices are of necessity batteryoperated; as a result, one of the most important requirements for such ambulatory monitoring systems is low-energy operation. This often results in a system architecture whereby processing is not carried out on the device itself, rather, storage of the data for later processing, or wireless transmission of data to a centrally-located server for centralized processing, is required. Minimizing the data storage and/or wireless transmission costs is essential for reducing the total system energy consumption and to extend the battery life of these devices; this is a paramount design challenge in such systems.
Data compression can significantly reduce storage and transmission requirements, thus positively impacting battery life, device size and portability. Lossless compression algorithms do not involve any loss in signal information and the original signal waveform can be recovered exactly; lossy compression, on the other hand, does involve loss of signal fidelity, however, much greater compression performance can be achieved with lossy compression algorithms. Most previous research on the compression of bioelectric signals has focused on maintaining signal fidelity with the aim of carrying out visual inspection on the signal, with comparatively less research focusing on the actual diagnostic content of the compressed signal as a performance criterion. However, in diagnostic or other detection applications, it may not be necessary to exactly reproduce the original signal morphology; what is of most importance is that the diagnostic information in the signal is retained. Therefore, the primary goal of effective lossy compression is maximizing the reduction in data storage and wireless transmission costs, whilst retaining the most important information in the signal. It is also important that the compression process is efficiently performed to ensure it does not significantly add to the overall power consumption of the system, for example, previous work in [21] showed the potential benefit of signal compression in wearable healthcare applications, in terms of reduced wireless transmission power requirements, even with an additional energy cost due to the compression algorithm.
Compression algorithms reduce the data size by removing redundancies present in the data and have been widely used in audio, video, and speech applications. Most highperformance ECG compression methods are not suitable for wireless biosensors because of their computational complexity, which means battery life may be compromised [22]; furthermore, where fidelity must be preserved (depending on the clinical requirements), lossless compression methods are often applied, which reduces the achievable compression ratio and hence the potential energy savings [22]. Suitable lossy compression methods usually involve a trade-off between compression rate and energy consumption [23]. Among the most effective biomedical data compression approaches [24][25][26][27][28] are those classified as transform-domain methods, and methods based on other sparse signals representations such as compressed sensing. Wavelet transform approaches have attracted particular attention due to their excellent compression performance. The use of transform-domain methods results in a representation of the signal in which the important information can be more effectively identified and represented in a compact manner, thus permitting more effective compression (less important information can be more readily discarded). In [26] a wavelet-based compression scheme with explicit control of wavelet coefficient quantization was proposed using signal distortion as a performance metric. Compression ratios (the ratio of the original bitrate to the compressed bitrate) of up to 20:1 were obtained with little signal distortion, when tested on signal samples from the MIT-BIH arrhythmia database.
The compression approach used in this paper is Set Partitioning in Hierarchical Trees (SPIHT) [29]. SPIHT operates by encoding the output of the Discrete Wavelet Transform (DWT) into a binary stream for storage and wireless transmission, and has been widely used for biomedical signal compression including with ECG. Since wavelet coefficients allow for effective compaction of energy in the signal, this property can be exploited by the SPIHT scheme. For example, in [25], SPIHT was used to compress ECG signals and it was shown that good performance in fundamental ECG parameter extraction (such as QRS detection and HRV parameter estimation) was possible at high levels of compression, with sensitivity and specificity remaining above 90% for compression ratios above 50. The system proposed in [30] used SPIHT-based decomposition, augmented with a ratedistortion curve to control the bit rate. The performance criterion was distortion of the signal, rather than performance in a diagnostic application.
The main contribution of this paper is to analyze the effects of compression on automated atrial fibrillation detection, where the primary performance criterion is diagnostic performance. In particular, the paper aims to demonstrate that a high level of diagnostic information is retained in the compressed signal even at high levels of signal compression that introduce significant distortion in the signal, and this diagnostic information can be used for automated AF detection with a high degree of accuracy. Signals are first compressed using SPIHT, the signal is then reconstructed, and QRS detection and entropy measures are used to automatically detect AF in the reconstructed signals.
Classification results are presented in terms of sensitivity and specificity. Standard measures of signal distortion (percent RMS distortion) are also employed to demonstrate that AF can be detected with high reliability even with very large amounts of signal morphology distortion. The results demonstrate that SPIHT can achieve high accuracy for AF detection, at high compression levels of the ECG signal. The remainder of the paper is structured as follows. Section 2 outlines the database used for evaluation, the compression algorithm employed, the AF detection method, and the performance metrics used for evaluation. Section 3 presents results, while Section 4 contains a discussion of the results, and conclusions.

ECG Database
The ECG database employed for these experiments is the MIT-BIH AF database (AFDB) [31,32]. This database includes 25 long-term ECG recordings of human subjects with atrial fibrillation (mostly paroxysmal). Of these, 23 records include two ECG signal channels. The individual recordings are each 10 h in duration, sampled at 250 Hz with 12 bit resolution, with accompanying expert beat annotations. The original analog recordings were made using ambulatory ECG recorders with a typical recording bandwidth of approximately 0.1 Hz to 40 Hz. The rhythm annotation files were prepared manually and contain rhythm annotations of AF, atrial flutter, atrio-ventricular functional rhythm and all other rhythms. The RR interval series corresponds to both AF and non-AF rhythm types. Non-AF rhythm includes three rhythm types (atrial flutter, atrio-ventricular functional rhythm, and all other rhythms). This database includes recordings with 1,282,369 annotated QRS complexes of which 532,276 (42.5%) are labelled as AF with a duration of 94.99 h and 319 episodes of AF.

Compression Method
Set Partitioning in Hierarchical Trees (SPIHT) is a wavelet-based lossless compression algorithm originally proposed by Said and Pearlman [29]. SPIHT is an embedded coding technique, wherein the signal is encoded such that a bit stream is created with information presented in order of priority (according to some criterion), with highest priority information encoded first. This allows the bit stream to be truncated at any desired point to achieve a target encoded bit rate, in the knowledge that the most significant bits are included. SPIHT is typically used along with a pre-processing transformation of the signal that produces a form of signal with characteristics that can be exploited by the subsequent prioritization carried out by the algorithm. While in principle, any transform can be used, a discrete Wavelet transform (DWT) is very commonly used. The DWT arranges coefficients into groups of sub-bands where later sub-bands are derived from previous sub-bands by means of filtering and down-sampling by a factor of 2, where the sub-band outputs are referred to as the wavelet coefficients. This produces a tree structure where the sub-bands produced by filtering form the "branches" of the tree, which allows good localization of the signal energy in time and frequency. This multi-resolution decomposition produces a natural hierarchical representation of the signal, where the importance of different signal components (sub-bands) can be more readily discerned and controlled. SPIHT partitions the wavelet coefficients through an iterative series of binary partitioning decisions in order to determine the "significance" of each of the coefficients. The goal of partitioning is to keep less significant coefficients in large subsets, which can be more efficiently encoded. The formation of groups of coefficients via the DWT allows for more efficient sorting, and retention or removal of coefficients, depending on their location in the tree structure. SPIHT encodes the wavelet coefficients by determining their significance through comparison with threshold levels, in an iterative fashion. The thresholds used are powers of two, creating a binary representation of the integer value of the wavelet coefficients. The initial threshold is set to a high value, such that wavelet coefficients that exceed this threshold are considered the most significant. Then, at each iteration, the threshold is reduced by a factor of 2, and more coefficients are added to the list of significant coefficients.
This process continues until the threshold becomes equal to 0, or until the desired compression level is reached. As the encoder has prior knowledge of the length of the original data being compressed, it is possible to specify a desired compression level prior to encoding and terminate the process when this has been reached. As SPIHT orders the bit stream from most "significant" bits to least significant bits, those bits that are retained are those deemed most important to reconstruct the original message, given the allotted bit budget (determined by the desired compression level), and termination of the process before the threshold drops to 0 ensures that only less significant coefficients are removed. A detailed description of the algorithm may be found in [29]. For the work presented here, the implementation of SPIHT described in [33] is employed, where the DWT uses a Cohen-Daubechies-Feauveau (CDF) 9-7 biorthogonal wavelet with 7 levels of decomposition.

Detection Based on Shannon Entropy Calculation
AF may be present in the ECG if there is no cyclic ventricular activity and with disorganized low amplitude atrial activity (f-waves) in the baseline. AF typically causes a highly irregular ventricular rhythm. Therefore, AF detection methods generally perform ventricular activity detection, through identification of the R peak, to measure the associated atrial activity [10,34]. However, most automated AF detection algorithms use irregular ventricular activity as the sole criterion for detection because f-waves are much harder to detect than QRS complexes due to their relatively lower amplitudes. Therefore, R-peak detection is a very important task. In this paper, R-peak detection was performed using Afonso et al.'s method [35].
During AF, R-R intervals are more irregular and consequently have a larger standard deviation when compared to normal sinus rhythm. Therefore, an R-R interval entropy measure can be employed to distinguish AF from other ECG rhythms. Let X be a finite discrete random variable, with possible values x 1 , x 2 , . . . , x m , representing the R-R interval time series. The entropy of the sequence is calculated according to the Shannon entropy definition: . A sliding window of fixed length equal to 45 was applied to the R-R interval time series, in order to estimate the entropy fluctuations of the series over time. Since entropy is a measure of the disorder of a system, it follows that a highly irregular heartbeat will result in a large entropy measure. The entropy measure may then be thresholded whereby values above the threshold are deemed to indicate the presence of AF, while those below the threshold indicate the absence of AF. Different threshold values result in different trade-offs between sensitivity and sensitivity of detection; this is explored further in Section 3. Figures 1 and 2 presents examples of the different signals utilized in the AF detection algorithm.

Performance Metrics
Compression ratio (CR) is one of the key characteristics for a compression algorithm. In this work, CR is defined as the ratio of the number of bits in the original signal, s r , divided by the number of bits required for the compressed signal, s c (see Equation (1)).
A number of measures are used to determine performance of compression algorithms. One of the simplest and most widely-used measures is the Percent RMS Distortion (PRD), which quantifies the amount of signal distortion in the reconstructed signal relative to the original signal. PRD is given by Equation (2) PRD is usually evaluated over a signal segment of length N samples, as indicated in Equation (2). While PRD is a useful measure of signal distortion, it does not adequately capture the functional impact of compression in particular applications, e.g., how compression impacts upon classification accuracy in a diagnostic application. Therefore, in this paper we also evaluate the effect of compression by detecting atrial fibrillation from the reconstructed signal, for different values of CR, using the data from the MIT-BIH AF database. This is carried out using the following approach, and making use of the AF detection algorithm described above. The original ECG waveforms are first compressed at different CRs, and the ECG signal reconstructed from the compressed bit stream. R peaks are located from the reconstructed signals, and the R-R intervals are calculated. To evaluate AF detection accuracy, the R-R series are classified into AF episodes and non-AF episodes using the approach described in Section 2.3. The classification is performed on the basis of 50 consecutive detected R-peak positions, based on previous work in [37,38]. The Receiver Operating Characteristic (ROC) is a commonly-used graphical plot that captures the classification performance of a binary classifier as its detection threshold is varied. The ROC captures the trade-off between the two primary types of error made by a classifier, i.e., false positives and false negatives, as reflected in the standard measures of sensitivity and specificity, defined as follows: Sensitivity(%) = TP/(TP + FN); (3) where TP stands for true positives, TN stands for true negatives, FN stands for false negatives, and FP stands for false positives. Sensitivity reports the proportion of detected true episodes out of all true AF episodes, while Specificity reports the proportion of correctly identified non-AF episodes out of all detected beats. The manual annotations provided with the MIT-BIH AF database provide the gold standard used for performance evaluation and calculation of these quantities. A compact and effective way of capturing the overall performance of a classifier, over all of its potential operating points, is to calculate the Area under the ROC (AUC). This takes values from 0 to 1, where a value of 0 indicates complete failure of the detection algorithm, and a value of 1 reflects a perfectly accurate algorithm.

Results
R-R interval entropy is employed as an indicator of AF. Performance is evaluated by generating the ROC, and hence estimating the AUC, using a range of entropy thresholds in the AF detection algorithm.
By way of example, Table 1 presents the performance of the compression algorithm for different CRs, in terms of both waveform fidelity as expressed in PRD, as well as in "functional" performance in AF detection, presented as PRD, AUC, and specificity, where the threshold has been varied to achieve a fixed sensitivity equal to 0.950. As expected, in this example, as CR increases, signal distortion expressed as PRD increases, while AF detection expressed as specificity drops.  Figure 3 shows an example of an original ECG waveform from the AF database, along with two compressed versions of the same signal. The loss of detail in the reconstructed signals as CR increases can be seen in this figure. However, as noted in the Introduction, in the context of a computer-aided diagnostic application the goal is not necessarily to preserve the signal fidelity, rather the goal is to preserve diagnostic information, therefore, significant distortion of the signal, as illustrated for the higher CR values in Figure 3, may still be tolerated, while at the same time, good AF detection performance can still be maintained. Figure 4 illustrates three AF detection ROC curves averaged over all patient records, at three different CRs. ROC curves are plots of true positive rate (sensitivity) as a function of false positive rate (equal to 1-specificity). The blue line illustrates AF detection accuracy for uncompressed data. The red line represents the point where AUC starts to drop below 0.9, i.e., where performance is still reasonably high. This corresponds to a CR of 90. Finally, the yellow line shows performance for a higher CR, where performance is substantially lower (AUC = 0.75).  Figure 5 plots the variation of AF detection performance as a function of CR. It is clear that the proposed AF detection approach can provide a significant reduction in data while maintaining high AF detection performance. As noted in Figure 4, detection performance reflected in AUC is preserved at a relatively high level (>0.9) up to a very high CR of approximately 90, which suggests that substantial compression of the signal is possible while maintaining reasonably good atrial fibrillation performance. For CRs greater than 90, the performance starts to reduce more rapidly. Figure 6 illustrates the variation of AF detection performance against the level of signal distortion, expressed as PRD. The AUC starts to drop below 0.9 for a PRD value of 58%. Figures 5 and 6 together highlight the point that, in terms of detection performance using the entropy-based algorithm in this paper, significant compression and substantial distortion of the signal (reflected in a high PRD value) is possible, while still maintaining good AF detection performance. RR interval irregularity, as well as being one of the most distinctive features of AF, is the most accessible ECG characteristic for AF detection. During AF, if the atrial rate becomes relatively slow and regular, the ventricular rate tends to rise, and this is manifested as reduced variability of the RR intervals. This is reflected in lower entropy [39]. From a physiology point of view, information on the regularity of RR intervals can be very useful to understand AF dynamics because the correlation between atrial frequency and ventricular frequency is higher in areas close to the septum [40].

Discussion and Conclusions
Electrocardiography is a popular non-invasive technique for monitoring human heart electrical activity, and is used in many biomedical engineering applications, including AF detection [41][42][43][44][45].
Devices based on ECG have shown good performance in AF detection, and in fact the gold standard for atrial fibrillation detection is the 12-lead ECG [46,47]. Consumer devices are now available which transmit ECG data in addition to heart rate enabling accurate AF detection by a cardiologist through visual inspection, or using automated algorithms [48]. Nevertheless, these devices themselves do not generally have embedded algorithms incorporated for the automated detection of AF, necessitating storage or transmission of ECG data to a central server for processing. Previous studies have proposed the stationary wavelet transform and support vector machine to detect AF [48]. Other detectors are based on parameters which characterize R-R interval irregularity, for example P-wave absence, f-wave presence, and noise level have led to substantial improvements when detecting brief episodes of AF [14]. Research based on the automated detection of AF using R-R variation and density histograms of R-R intervals has also been conducted. The goal of the study in this paper was to examine the effect of ECG signal compression on the automatic detection of atrial fibrillation and in particular, to determine how performance varies as a function of compression ratio. The study used the wavelet transform for signal decomposition, followed by the SPIHT algorithm for ECG signal compression. Shannon entropy estimated from R-R interval statistics was used to detect the presence or absence of AF [49]. An advantage of this method is the detection of AF from single-lead recordings. Another advantage is the small quantity of R-R intervals utilised [50][51][52][53].
The detection performance of the algorithm was reported in terms of sensitivity, specificity and area under the ROC curve. The results indicate that quite high levels of compression (and hence reduced energy for transmission or storage of the compressed signal) can be achieved before there is a noticeable degradation in the performance of AF detection; this is considered to correspond to an AUC value of 0.9 or less. The signal distortion for an AUC of 0.9 is approximately 58%, indicating that a high degree of signal fidelity loss is tolerable while still maintaining good detection performance. Moreover, the curve of performance versus CR remains comparatively flat (not much degradation) for AUC values greater than 0.9.
Early detection of AF in patients is very useful because therapeutic decisions can be facilitated by an accurate estimate risk of AF, particularly in situations where the patient is not in the clinic. Moreover, it could be applied to enhance diagnostic accuracy in paroxysmal AF without the need to store a large amount of data.
One limitation of this method is that the strategy of diagnosing atrial arrhythmia using R-R intervals is not suited to detecting atrial flutter and ectopic beats because the ventricular rhythm can be fixed at integer multiples of the atrial rate. This is one of the reasons why the diagnostic performance of the AF detection algorithm is not higher than 0.947 AUC even with uncompressed data.
In conclusion, the main benefit of this work is that AF detection accuracy can be preserved with highly compressed signals. This finding mitigates the constraints of limited storage and power budgets present with ambulatory ECG acquisition devices.