# Optimal Heart Sound Segmentation Algorithm Based on K-Mean Clustering and Wavelet Transform
###### Abstract  
The accurate localization of S1 and S2 is essential for heart sound segmentation and classification. However, current direct heart sound segmentation algorithms have poor noise immunity and low accuracy. Therefore, this paper proposes a new optimal heart sound segmentation algorithm based on K-means clustering and Haar wavelet transform. The algorithm includes three parts. Firstly, this method uses the [PERSON] integral method and [PERSON]'s energy-based algorithm to extract the function of the envelope of the heart sound energy. Secondly, the time-frequency domain features of the acquired envelope are extracted from different dimensions and the optimal peak is searched adaptively based on a dynamic segmentation threshold. Finally, K-means clustering and Haar wavelet transform are implemented to localize S1 and S2 of heart sounds in the time domain. After validation, the recognition rate of S1 reached 98.02% and that of S2 reached 96.76%. The model outperforms other effective methods that have been implemented. The algorithm has high robustness and noise immunity. Therefore, it can provide a new method for feature extraction and analysis of heart sound signals collected in clinical settings. cardiovascular diseases; feature extraction; localization; PCG; segmentation; integral waveform +
Footnote †: journal: Medical  
S2 [7, 8]. This method required acquisition of multiple signals, which resulted in certain limitations in practice. Unlabeled segmentation analyzes the heart sound directly, and does not depend on a reference signal. It is the mainstream analysis method at present. It mainly extracts the heart sound envelope based on time domain or frequency domain. The time-domain features of S1 and S2 have been classified and detected. Kurtosis of Hilbert envelopes of heart sound signals were analyzed using a zero-frequency filter to locate PCG signals [9]. [PERSON] et al. proposed a homomorphic envelope method to extract the envelope features of PCG signals [10]. [PERSON] et al. extracted the heart sound envelopes using Shannon energy and S-transform [11]. Robustness of detection and classification using stationary wavelet transform and Hilbert phase envelope was used to verify heart sounds and murmurs under normal and pathological conditions [12]. The team also proposed PCG signal decomposition based on empirical wavelet transform to distinguish heart sounds and heart murmurs [13]. The main objective of the above-mentioned study using envelope extraction methods was to highlight the basic heart sound and minimize the noise, which resulted in good accuracy in case of clean PCG signals. However, these algorithms suffered from a high number of burrs in the extracted envelopes and had poor noise immunity. In addition, an unsupervised low-complexity algorithm for detecting S1 and S2 using empirical mode decomposition (EMD) was proposed. In this technique, PCG signals were decomposed into some specific functions called intrinsic mode functions (IMF), to extract the basic characteristics of the signal in the time domain [14]. On this basis, ensemble empirical mode decomposition (EEMD) combined with kurtosis was used to identify heart sound features [15]. [PERSON] et al. used variational mode decomposition combined with Shannon energy to analyze PCG signals [16]. The main limitation of this technology was the choice of IMF for heart sound segmentation under different types of spectral characteristics such as heart murmurs, background noise and so on. Furthermore, [PERSON] et al. used Shannon energy and K-means clustering to segment heart sounds [17]. We noticed that K-means is a non-deterministic, unsupervised, numerical, iterative method of clustering [18]. In K-means each cluster is represented by the mean value of objects in the cluster. A group of n objects is divided into k clusters so that intercluster similarity is low and intracluster similarity is high. Similarity is measured in terms of mean value of objects in a cluster.