key: cord-0881292-nrldl9um authors: Fira, Monica; Costin, Hariton-Nicolae; Goraș, Liviu title: A Study on Dictionary Selection in Compressive Sensing for ECG Signals Compression and Classification date: 2022-02-27 journal: Biosensors (Basel) DOI: 10.3390/bios12030146 sha: 4de81dbff787d6dee4d174398baa961a1d635488 doc_id: 881292 cord_uid: nrldl9um The paper proposes a comparative analysis of the projection matrices and dictionaries used for compressive sensing (CS) of electrocardiographic signals (ECG), highlighting the compromises between the complexity of preprocessing and the accuracy of reconstruction. Starting from the basic notions of CS theory, this paper proposes the construction of dictionaries (constructed directly by cardiac patterns with R-waves, centered or not-centered) specific to the application and the results of their testing. Several types of projection matrices are also analyzed and discussed. The reconstructed signals are analyzed quantitatively and qualitatively by standard distortion measures and by the classification of the reconstructed signals. We used a k-nearest neighbors (KNN) classifier to evaluate the reconstructed models. The KNN module was trained with the models from the mega-dictionary used in the classification block and tested with the models reconstructed with class-specific dictionaries. In addition to the KNN classifier, a neural network was used to test the reconstructed signals. The neural network was a multilayer perceptron (MLP). Moreover, the results are compared with those obtained with other compression methods, and ours proved to be superior. Compressed sensing (CS) is a method of signals acquisition and processing based on the fact that sparse or rare signals can be reconstructed from a relatively small number of projections on a set of random signals [1] . This technique is relatively new compared to classical techniques, so in recent years, a large number of papers on implementation, applicability, advantages and the pertinence to dedicated types of signals have been published [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] . Many of the papers that address CS focus on how to build specific dictionaries for signal reconstruction [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] . In the case of the ECG signal, due to its particularities, namely, the quasi-periodicity of the P, Q, R and S waves and the preservation of their shapes, many of the methods proposed in the literature focus on the advantages offered by these features specific to the ECG signal [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] . Thus, a large part of the methods proposed regarding CS of ECG signals aim at building dictionaries specific to these signals. In many cases, building these dictionaries involves a preprocessing step with or without signal segmentation, with or without QRS wave alignment. Another aspect regarding CS applied to ECG signals is the optimization of the compression matrix. In the following lines, we will briefly present some specific ECG methods proposed in the literature over the past years, which contain results similar to the methods we presented in this paper, except for the fact of using patient-specific dictionaries or involving updating the dictionary when there are changes in the ECG signal. In general, there is a big inconvenience in the situation of using such a system in practice, because it involves resubmitting the dictionary and necessary calculations in real time to see if the dictionary is good or needs to be updated. All these calculations imply additional hardware needs, which can make the method less practical in real-time acquisition situations. On the other hand, our approach is based on the use of non-modified patient-specific dictionaries or pathology-specific dictionaries; these are established once and updating can be done less frequently than in other techniques and does not require real-time decisions. In one paper [33] , the presented method uses an over complete wavelet dictionary, a dictionary that is later reduced due to a training phase. In addition, it is proposed to align the beats according to the position of the R-peak. This alignment aims to exploit the different scaling characteristics of ECG waves in the wavelet dictionary optimization process. Three different methods are tested for dictionary optimization. It should be mentioned that this optimized dictionary is specific to the patient and for its construction, the first 5 minutes of registration are taken. For acquisition, the authors use a matrix optimized for the ECG signal to be acquired through CS. The use of an optimized compression matrix leads to improved results, but has the disadvantage that once this matrix is changed it must be sent together with the compressed ECG signal. That means both the compressed ECG signal and the compression matrix must be sent to restore the ECG signal. Another approach is presented in [34] , where the quasi-periodic character of the ECG signal is used to detect similarities between ECG pulses and to transmit segments that show dissimilarities normally, without compression. This approach is proposed because abnormal frames, which could be signs of heart disease, are not similar to normal frames. Thus, only the ECG segments considered normal are transmitted by CS, the rest being transmitted normally. Once it is determined, whether the heartbeat is acquired normally or by CS, a quantization step follows and then a Huffman compression. These two steps lead to improved compression results. A critical point in the method is the correct detection of normal vs. abnormal beats, because this automated detection is debatable in the light of the fact that normality or abnormality is determined by a cardiologist and the accuracy of the acquisition should not be influenced by this decision. In paper [35] , the authors also used CS associated to dictionaries built specifically for the ECG signal, thus using the dictionary learning technique to construct a better sparsifying basis to improve the compression ratio. Moreover, the authors consider the change of ECG signal characteristics and propose a physiological variation detection technique and a low-complexity dictionary refreshing algorithm to update the dictionary from time to time when the current dictionary is no longer suitable for the patient. Many papers in the CS field focus on optimizing the measurement matrix, i.e., the matrix is used in the acquisition stage or on optimizing the necessary calculations in this stage by arranging this matrix in a way that allows easy hardware implementation of the necessary calculations. In practical implementations, the simple random or Bernoulli matrix may have the inconvenience of the required number of operations. Thus, in paper [36] , the authors propose an optimized algorithm for collecting the compressed ECG signal, based on the proposed optimization of a deterministic binary block diagonal matrix. The blocks, which make up the diagonal of the matrix, are identical and contain m = N/M elements each, where M and N, respectively, represent the number of rows and columns. In paper [37] , a new method of compressive sampling of ECG signals is presented, which is based on the idea of building the compression matrix adapted to the frame of the ECG signal to be compressed. Thus, a circulating matrix is proposed, containing zeros and ones, obtained by quantizing (with 1-bit resolution) the size of the ECG signal. The detection matrix adapted in this way guarantees that the significant portions of the waveform of the compressed ECG signal are in fact contained in the compressed version. In this way, a more precise reconstruction is guaranteed in relation to the methods already available in the literature. For the reconstruction stage, the acquisition matrix is then used in combination with a modified wavelet dictionary, which also allows the reconstruction of the signal deviation for each processed frame. The big disadvantage of the method is that whenever the acquisition matrix has to be updated, it has to be sent to the receivers and for reconstruction we have to know each frame with which matrix was collected. In this paper, we propose a detailed comparative study of two different approaches regarding the possibility of compressed sensing specific ECG signals. This study considers several acquisition techniques/projection matrices used in the acquisition stage and several dictionaries used in the ECG signal reconstruction stage. We will also analyze the effect of preprocessing on the results. Broadly speaking, we analyze and discuss two CS approaches dedicated to ECG signals, namely: 1. An approach that is based on the direct CS obtaining of the signal, without preprocessing it prior acquiring the projections. This "genuine" CS we call patient-specific classical compressed sensing (PSCCS), since the dictionary is constructed from a patient's initial signals. A variant that involves a module of pre-processing and segmentation of the ECG signal. This stage aims at improving the scatter and recoverability of the ECG signal. In this additional stage of preprocessing, the ECG signal results in the rhythmicization of the ECG signal and divides it into cardiac cycles-hereinafter referred to as cardiac patterns compressed sensing (CPCS). Now the acquired signals and atoms of dictionary are segmented heartbeats pre-processed without or with the R-waves centered. For both approaches from above, we will analyze several projection matrices, namely, matrices with random independent and identically distributed (i.i.d.) elements taken from the Gaussian or Bernoulli distribution and project matrices optimized for the particular dictionary used in the reconstruction. To optimize the projection matrix, the method presented in [7] will be used. Furthermore, we will pay special attention to the way the dictionary is built. We will also present the advantages and disadvantages of each and the choice of the method that depends on the available hardware and software resources. The paper is organized as follows: Section 2 is dedicated to the types of sampling vectors, projection matrices and dictionary construction methods. Section 3 presents the CS methods dedicated to ECG signals. Section 4 shows the results obtained. In Section 5 the results from the previous section are compared and in Section 6 conclusions are drawn. Traditionally, signals are acquired according to the sampling theorem [8] that states that an f 0 -bandlimited signal can be recovered from its samples if the sampling frequency is at least 2 f 0 , i.e., twice the highest frequency of the signal spectrum. Thus, in a time window W, an f 0 -bandlimited analog signal can be represented by N = 2 f 0 W samples equally spaced at T = 1/2 f 0 , i.e., as a vector belonging to the space R N . Such a signal can be alternatively defined by using any complete set of orthogonal functions in R N . In fact, sampling is nothing else than taking projections (scalar products) on the elements of the canonical basis. In the general case the signal can be reconstructed from its projections on N orthogonal (or only linear independent) elements in RN the canonical basis being the most frequently used. However, in practice, there are cases in which a signal can be reconstructed from fewer samples or projections on an appropriate set of signals, compared to the number prescribed by the sampling theorem. This is possible since the samples contain unnecessary information, and thus, these signals can be compressed and recovered using projections and previous known information. An example would be the class of sparse or rare signals [9] [10] [11] that allow a representation based on a small number of elements/atoms in RN. In signal processing literature, the name "k-sparse" denotes signals that can be reconstructed by means of k of elements of RN, the most significant situation being that in which k<