Two-stage detection method for sleep apnea
By combining respiratory audio signals and heart sound signals, using Mel spectrograms and transfer learning technologies, the problems of low sleep apnea detection accuracy and neglected awakening stages in the existing technology are solved, and more accurate sleep duration calculations and AHI evaluations are achieved , improves the reliability of testing.
Patent Information
- Application Number
- CN202411490964.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-10-24
AI Technical Summary
The existing sleep apnea detection method based on sound signals has low diagnostic accuracy, is susceptible to environmental noise interference, and ignores the awakening stage, resulting in inaccurate calculation of sleep duration, affecting the reliability of AHI.
Combining respiratory audio signals and heart sound signals, using Mel spectrogram, transfer learning, longitudinal box algorithm and support vector machine, the statistical features of the RR interval were extracted, and the sleep-wake detection model was constructed through the VGG16 network, the sleep duration was calculated, and AV was used. -Box algorithm detects potential sleep apnea segments.
It improves the accuracy and efficiency of sleep apnea detection, provides more comprehensive and accurate physiological information, reduces misjudgment and misjudgment, and enhances the reliability and clinical application value of the detection.
Smart Images

Figure CN119279511A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of breathing detection, and more specifically, to a two-stage detection method for sleep apnea. Background Art
[0002] At present, sound perception has attracted widespread attention in the field of sleep apnea detection due to its excellent non-invasiveness and ease of use. However, most studies are limited by the amount of information in breathing sounds, and the diagnostic accuracy is insufficient. In addition, due to the lack of sleep-wake detection steps, the patient's accurate sleep duration cannot be obtained, resulting in the calculated patient's sleep apnea-hypopnea index being low, which is difficult to meet clinical needs. Therefore, it is of great significance to develop an accurate sleep apnea detection method based on sound signals.
[0003] The Chinese patent application, application number 202310419815.2, discloses a method for identifying apnea snoring based on a dual-stream multi-scale model, including: preprocessing snoring data, including signal pre-emphasis and frame windowing; then, extracting Mel-frequency cepstral coefficients (MFCC) of the snoring data as snoring features; then, constructing a dual-stream multi-scale model to classify normal snoring and sleep apnea snoring, wherein the time domain branch uses a one-dimensional convolutional neural network to process the MFCC features, and the frequency domain branch uses a two-dimensional convolutional neural network to process the transpose of the MFCC features; finally, counting the number of apnea snoring sounds and calculating the patient's sleep apnea hypopnea index.
[0004] Although the above methods have achieved the recognition of sleep apnea events and the calculation of AHI to a certain extent, there are still some obvious shortcomings. First, the single breath sound does not contain enough information and is easily disturbed by environmental noise, which may lead to missed or misjudgment of sleep apnea. In addition, the fixed convolution kernel structure and the single feature fusion method in the above methods make it difficult for the model to learn the optimal feature representation when processing complex and changeable all-night sound data, resulting in poor detection performance. More importantly, the above methods all ignore the wakefulness stage in all-night monitoring, and directly use the monitoring time instead of the patient's actual sleep time to calculate AHI, resulting in a low AHI for patients, namely the "dilution effect", which greatly limits its reliability and practicality in clinical applications. Summary of the invention
[0005] 1. Technical problems to be solved
[0006] In response to the problem of low diagnostic accuracy in sleep apnea detection methods based on sound signals in the prior art, the present application provides a two-stage detection method for sleep apnea, which improves the detection accuracy by combining respiratory audio signals and heart sound signals, using Mel-spectrograms, transfer learning, longitudinal box algorithm, heart sound feature extraction and support vector machines.
[0007] 2. Technical solution
[0008] The purpose of this application is achieved through the following technical solutions.
[0009] The present application provides a two-stage detection method for sleep apnea, including: collecting tracheal sound signals of a user's sleep breathing, preprocessing the tracheal sound signals, and generating a mel-spectrogram of the tracheal sound signals; wherein the tracheal sound signals include a respiratory audio signal and a heart sound signal; through transfer learning, constructing a sleep-wake detection model based on a VGG16 network, and calculating the user's sleep duration; using a longitudinal box algorithm AV-Box to perform sleep apnea segment detection on the mel-spectrogram to obtain a potential sleep apnea segment; sampling the potential sleep apnea segment, extracting the S1 peak and the S2 peak of the potential sleep apnea segment, and calculating the RR interval according to the time interval between adjacent S1 peaks; wherein the S1 peak represents the first heart sound, and the S2 peak represents the second heart sound; obtaining the statistical features of the RR interval, and performing apnea detection using a support vector machine SVM according to the statistical features; and calculating the user's sleep apnea hypopnea index AHI according to the number of sleep apneas counted from the apnea detection result and the sleep duration.
[0010] Among them, the tracheal sound signal is a sound signal of breathing and heart activity collected by placing a sound sensor in the trachea of the human neck. It contains two main components: respiratory audio signal and heart sound signal. The respiratory audio signal reflects the sound produced when the airflow passes through the respiratory tract, while the heart sound signal reflects the sound produced when the heart valve opens and closes and the blood flows. The tracheal sound signal can provide important information about breathing and heart function, and is used for the detection and analysis of sleep apnea.
[0011] VGG16 network is a classic convolutional neural network architecture. It is one of the deep learning models that performed well in the ImageNet image classification competition. The VGG16 network consists of 16 convolutional layers and fully connected layers. Through transfer learning, the pre-trained VGG16 network can be applied to the sleep-wake detection task, using its powerful feature representation ability to distinguish between sleep and wake states.
[0012] AV-Box (Adaptive Vertical-Box Algorithm): is an adaptive algorithm for time series signal segmentation. It slides a vertical rectangular window on the signal and determines the segmentation points of the signal according to the distribution of sample points in the window. The AV-Box algorithm can adaptively adjust the size and position of the window to adapt to the local characteristics of the signal. In sleep apnea detection, the AV-Box algorithm can be applied to the Mel-spectrogram to locate potential sleep apnea segments by detecting sudden changes in energy distribution.
[0013] The S1 peak and S2 peak correspond to the peak points of the first heart sound (S1) and the second heart sound (S2) in the heart sound signal, respectively. The first heart sound is caused by the closure of the atrioventricular valves (mitral valve and tricuspid valve), which usually occurs at the beginning of ventricular contraction. The second heart sound is caused by the closure of the semilunar valves (aortic valve and pulmonary valve), which usually occurs at the beginning of ventricular diastole. The positioning and identification of the S1 peak and the S2 peak are very important for the analysis of the heart sound signal and the calculation of the RR interval.
[0014] The RR interval refers to the time interval between two consecutive R wave peaks in the electrocardiogram. In the analysis of heart sound signals, the S1 peak can be regarded as an equivalent R wave peak, so the RR interval can also be understood as the time interval between two consecutive S1 peaks. The RR interval reflects the rhythm changes of the heart and can be used to evaluate heart rate variability and cardiac autonomic nervous function. In sleep apnea detection, the statistical characteristics of the RR interval can serve as an important basis for judging respiratory events.
[0015] Apnea-Hypopnea Index (AHI): The Apnea-Hypopnea Index (AHI) is an important indicator for assessing the severity of sleep apnea. It indicates the average number of apnea and hypopnea events that occur per hour during sleep. Apnea refers to a complete cessation of breathing that lasts for more than 10 seconds; hypopnea refers to a significant decrease in breathing amplitude that lasts for more than 10 seconds, accompanied by a decrease in blood oxygen saturation.
[0016] Furthermore, tracheal sound signals of the user's sleep breathing are collected, and the tracheal sound signals are preprocessed to generate a Mel-spectrogram of the tracheal sound signal, including: framing the collected tracheal sound signals; performing short-time Fourier transform on the tracheal sound signals after framing to obtain a spectrum of the tracheal sound signal; converting the spectrum into a single-sided spectrum, and filtering the single-sided spectrum through a Mel filter group to obtain a logarithmic Mel-frequency spectrum of the tracheal sound signal; and combining the logarithmic Mel-frequency spectrum into a Mel-spectrogram.
[0017] Among them, the one-sided spectrum (One-sided Spectrum) refers to the spectrum that only contains the positive frequency part in the spectrum graph. In signal processing, by performing Fourier transform on the time domain signal, the frequency domain representation of the signal, that is, the spectrum graph, can be obtained. The spectrum graph usually contains two parts, positive frequency and negative frequency. For real signals, its spectrum has conjugate symmetry, that is, the positive frequency part and the negative frequency part are mirror-symmetric. In the process of generating the Mel-spectrogram of the tracheal sound signal, the spectrum graph of the tracheal sound signal is obtained by performing short-time Fourier transform on the framed tracheal sound signal. Then, the spectrum graph is converted into a one-sided spectrum, that is, only the positive frequency part is retained and the negative frequency part is discarded. This can simplify the subsequent processing steps and reduce the amount of calculation.
[0018] Furthermore, collecting the tracheal sound signal of the user's sleeping breathing, preprocessing the tracheal sound signal, and generating a Mel-spectrogram of the tracheal sound signal also includes: using a bilinear interpolation method to adjust the size of the Mel-spectrogram to obtain a Mel-spectrogram of uniform size.
[0019] Furthermore, through transfer learning, a sleep-wake detection model based on the VGG16 network is constructed to calculate the user's sleep duration, including: training the VGG16 network on the source domain database. After training, all network structures and trained parameters before the last maximum pooling layer of the VGG16 network are migrated to the sleep-wake detection model, and the last maximum pooling layer and fully connected layer of the VGG16 network are removed; in the migrated network structure, a new maximum pooling layer, multiple convolutional layers, LSTM layers and fully connected layers are added in sequence to form a sleep-wake detection model; the Mel spectrum with uniform size is used as the input. The image is input into the sleep-wake detection model, the feature representation of the Mel-spectrogram is obtained through forward propagation, and the model parameters are adjusted using the back-propagation algorithm. A softmax function is added after the last fully connected layer of the sleep-wake detection model to construct a sleep-wake state classifier, and the input Mel-spectrogram is classified into two sleep-wake states to obtain the sleep-wake detection result. According to the sleep-wake detection result, the start frame and end frame of the sleep state are extracted, and the time difference between the start frame and the end frame is calculated to obtain the duration of the sleep state. The duration of all sleep states is accumulated to obtain the user's sleep duration.
[0020] Among them, the source domain database (Source Domain Database), in transfer learning, refers to the original dataset used for pre-training models. It is usually a large-scale, well-annotated dataset that is different from the domain (target domain) where the target task is located. The data samples and labels in the source domain database are used to train the basic model so that it can learn common feature representations and patterns.
[0021] Furthermore, a longitudinal box algorithm AV-Box is used to detect sleep apnea segments on the Mel spectrogram to obtain potential sleep apnea segments, including: setting the coordinates of the center point of the right boundary of the rectangular window to (n, Yn), where n represents the sampling point and Yn represents the signal amplitude; setting the box length of the rectangular window to L, the box height to 2H, and initializing the coordinates of the center point of the boundary to (n=L+1, Yn); calculating the number of sampling points bLH(n) in the rectangular window; judging whether the number of sampling points bLH(n) is less than a threshold, if so, marking the current sampling point n as a change point; judging whether the current sampling point n is equal to the total number of sampling points of the Mel spectrogram, if so, outputting the position parameters of the current sampling point n, otherwise, moving the rectangular window forward by a unit distance, updating the coordinates of the center point of the boundary to (n=ε+n, Yn), where ε is a unit distance, and repeating the number of sampling points judgment until the current sampling point n is equal to the total number of sampling points of the Mel spectrogram.
[0022] Among them, the right boundary center point coordinate (Right Boundary Center Coordinate), in the vertical box algorithm (AV-Box), the right boundary center point coordinate refers to the coordinate of the center point of the right boundary of the rectangular window. It is used to determine the position and movement of the rectangular window on the signal. The right boundary center point coordinate consists of two parts: sampling point n and the corresponding signal amplitude Yn. Sampling point n represents the discrete position of the signal on the time axis, that is, the nth sampling point. The signal amplitude Yn represents the amplitude value of the signal at the nth sampling point. The function of the right boundary center point coordinate is to determine the position of the rectangular window on the signal and control the movement of the rectangular window. By continuously updating the right boundary center point coordinate, the rectangular window can slide along the signal to capture the local features and changes of the signal. At each position, the algorithm calculates the number of sampling points in the rectangular window and determines whether the current position is a change point (segmentation point of the signal) based on the threshold.
[0023] Furthermore, the AV-Box algorithm is used to detect sleep apnea segments on the Mel-spectrogram to obtain potential sleep apnea segments, which also includes: calculating the interval between adjacent change points of the output, judging whether the interval is less than the first threshold, if so, merging the corresponding two change points into one change point; calculating the segment duration between the merged adjacent change points, judging whether the segment duration is less than the second threshold or greater than the third threshold, if so, deleting the corresponding segment; wherein the second threshold is less than the third threshold; calculating the interval between adjacent segments after deleting the segment, judging whether the interval is greater than the fourth threshold, if so, marking the corresponding segment as a potential sleep apnea segment; wherein the fourth threshold is greater than the third threshold. The first threshold value ranges from 180ms to 220ms; the second threshold value range is the same as the first threshold, the third threshold value ranges from 3s to 7s; the fourth threshold value ranges from 8s to 12s.
[0024] Further, the potential sleep apnea segment is sampled, the S1 peak and S2 peak of the potential sleep apnea segment are extracted, and the RR interval is calculated according to the time interval of adjacent S1 peaks, including: performing Hilbert transform on the potential sleep apnea segment, calculating the energy envelope of the potential sleep apnea segment; comparing the energy envelope value with the threshold T, and retaining the energy envelope value whose energy envelope value is greater than the threshold T; setting variables d12 and d21 to represent the time interval of the S1-S2 peak and the time interval of the S2-S1 peak, respectively, the two values are initialized with fixed values, and dynamically changed using weight factors k1 and k2, and k1 and k2 are set to empirical values 0 .95 and 0.05; in the time window corresponding to d12, obtain the peak with the largest energy envelope value, marked as S1 peak; in the time window corresponding to d21, obtain the peak with the largest energy envelope value, marked as S2 peak; calculate the time interval Δt between adjacent S1 peaks and S2 peaks, compare the time interval Δt with variables d12 and d21, if the time interval Δt is less than d12, mark the corresponding peak pair as S1-S2 peak pair; if the time interval Δt is greater than d12 and less than d21, mark the corresponding peak pair as S2-S1 peak pair; calculate the time interval between adjacent S1 peaks as the RR interval.
[0025] Among them, the variable d12 represents the time interval between the S1 peak and the S2 peak, that is, the time difference between the first heart sound (S1) and the second heart sound (S2). It is a preset time window used to search and locate the S1 peak and the S2 peak in the energy envelope. By setting a suitable d12 value, the S1 peak and the S2 peak can be more accurately identified and extracted, avoiding misidentification of other non-heart sound peaks as heart sound peaks. The S1 peak refers to the peak point marked as the first heart sound (S1) in the energy envelope. The first heart sound is caused by the closure of the atrioventricular valves (mitral valve and tricuspid valve), which usually occurs at the beginning of ventricular contraction. Within a given time window (defined by the variable d12), find the peak point with the largest energy envelope value and mark it as the S1 peak. The S2 peak refers to the peak point marked as the second heart sound (S2) in the energy envelope. The second heart sound is caused by the closure of the semilunar valves (aortic valve and pulmonary valve), which usually occurs at the beginning of ventricular diastole. Similar to the S1 peak, within a given time window (defined by the variable d21), find the peak point with the largest energy envelope value and mark it as the S2 peak.
[0026] The S1-S2 peak pair refers to a peak pair consisting of an S1 peak and an S2 peak that are adjacent in time and meet specific conditions. By calculating the time interval Δt between adjacent S1 peaks and S2 peaks and comparing it with the variable d12, if the time interval Δt is less than d12, the corresponding S1 peak and S2 peak are marked as an S1-S2 peak pair. The S2-S1 peak pair refers to a peak pair consisting of an S2 peak and an S1 peak that are adjacent in time and meet specific conditions. Similar to the S1-S2 peak pair, by calculating the time interval Δt between adjacent S2 peaks and S1 peaks and comparing it with the variables d12 and d21, if the time interval Δt is greater than d12 and less than d21, the corresponding S2 peak and S1 peak are marked as an S2-S1 peak pair. The RR interval refers to the time interval between two adjacent R wave peaks. In the analysis of heart sound signals, the S1 peak can be regarded as an equivalent R wave peak, so the RR interval can also be understood as the time interval between two adjacent S1 peaks. By calculating the time difference of adjacent S1 peaks, the value of the RR interval can be obtained. The RR interval reflects the rhythm changes of the heart and is an important indicator for evaluating heart rate variability and cardiac autonomic nervous function. In the detection of sleep apnea, the change pattern of the RR interval can be used as one of the bases for judging respiratory events.
[0027] Furthermore, the statistical characteristics of the RR interval are obtained, and the statistical characteristics include: maximum value, minimum value, range, standard deviation, mean, skewness and kurtosis.
[0028] Furthermore, the user's sleep apnea-hypopnea index AHI is calculated by the following formula: AHI=N / T, wherein N represents the number of sleep apnea episodes of the user; and T represents the sleep duration of the user.
[0029] 3. Beneficial effects
[0030] Compared with the prior art, the advantages of this application are:
[0031] Mel-spectrogram is used to represent the time-frequency domain features of tracheal sound signals, and a sleep-wake detection model is constructed through transfer learning, which can effectively identify the user's sleep state and accurately calculate the sleep duration; the longitudinal box algorithm AV-Box is used to detect sleep apnea segments on Mel-spectrograms, which can quickly and accurately locate potential sleep apnea events, reduce the amount of data for subsequent processing, and improve detection efficiency; by simultaneously collecting the user's breathing audio signals and heart sound signals during sleep, more comprehensive and accurate physiological information can be obtained; by extracting the first heart sound S1 peak and the second heart sound S2 peak in the potential sleep apnea segment and calculating the RR interval, the impact of sleep apnea events on heart rhythm can be effectively evaluated and more physiological indicators can be provided; the support vector machine SVM model is used to classify the statistical characteristics of the RR interval, which can accurately determine whether the potential sleep apnea segment is a true sleep apnea event, thereby improving the accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A technical roadmap for a two-stage sleep apnea detection method of the present application;
[0033] Figure 2 This is a potential sleep apnea segment screening result diagram of an embodiment of the present application;
[0034] Figure 3 This is a waveform diagram of a tracheal sound signal according to an embodiment of the present application;
[0035] Figure 4 This is a graph showing the segmentation results of the S1 and S2 peaks in one embodiment of the present application;
[0036] Figure 5 This is the AHI analysis chart for traditional acoustic detection;
[0037] Figure 6 This is an AHI analysis diagram for detecting an embodiment of the present application;
[0038] Figure 7 This is a diagram of sleep apnea estimation results according to an embodiment of the present application. DETAILED DESCRIPTION
[0039] The present application is described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0040] Figure 1 This is a technical roadmap for a two-stage detection method for sleep apnea in this application. In the first stage, the tracheal sound signal of the patient is collected throughout the night, and the signal is preprocessed, including denoising, normalization and other operations to obtain the preprocessed tracheal sound signal. The preprocessed tracheal sound signal is converted into a Mel spectrogram. Specifically, the signal is analyzed in time and frequency using a short-time Fourier transform (STFT), and then the spectrogram is mapped to the Mel frequency scale to obtain a Mel spectrogram. A sleep-wake detection model is constructed based on transfer learning. First, the VGG16 network is pre-trained on a large-scale sleep dataset, and then fine-tuned on the target domain data to obtain a feature extractor suitable for sleep-wake detection. The Mel spectrogram is input into the feature extractor to extract high-level features, and a classifier (such as a softmax layer) is used to identify the sleep-wake state. According to the recognition results, the actual sleep duration of the patient is calculated. The adaptive longitudinal box (AV-Box) algorithm is used to screen the Mel spectrogram for potential sleep apnea segments. The AV-Box algorithm searches for areas with energy mutations on the Mel-spectrogram by adaptively adjusting the size and position of the rectangular window and marks them as potential sleep apnea segments.
[0041] The second stage: Secondary confirmation of sleep apnea segments based on the RR interval. For each potential sleep apnea segment, the corresponding heart sound signal segment is synchronously analyzed. The peak detection algorithm is used to identify the S1 peak and S2 peak in the heart sound signal, and the time interval between adjacent S1 peaks, namely the RR interval, is calculated. The statistical features of the RR interval are extracted, including the mean, standard deviation, maximum value, minimum value, etc. These statistical features can reflect the degree of influence of respiratory events on cardiac rhythm. The statistical features of the RR interval are input into the pre-trained support vector machine (SVM) classifier for secondary confirmation of sleep apnea events. SVM divides potential sleep apnea segments into true sleep apnea events and non-sleep apnea events by finding the optimal classification hyperplane. According to the sleep apnea detection results of the second stage and the actual sleep duration obtained in the first stage, the patient's sleep apnea hypopnea index (AHI) is calculated. AHI represents the average number of sleep apnea and hypopnea events that occur per hour of sleep, and is an important indicator for assessing the severity of OSA.
[0042] In the first stage, sleep-wake classification and respiratory sound event detection are performed based on tracheal sound signals to achieve potential sleep apnea segment screening. The specific steps are as follows: Set the frame length to 25 milliseconds and the frame shift to 10 milliseconds to ensure that there is enough overlap between frames to capture the dynamic changes of the signal. Select the Hanning window as the analysis window and perform windowing on each frame of the signal to reduce the impact of spectral leakage. Perform a 512-point short-time Fourier transform (STFT) on each frame of the windowed signal to convert the time domain signal into a frequency domain signal to obtain the spectrum of the sound signal. Since the spectrum is symmetrical, only half of the spectrum information, that is, the single-sided spectrum, needs to be retained. Take the first 257 points of the spectrum (including the DC component) to form a single-sided spectrum.
[0043] Design a set of 64-order Mel filters, with the center frequencies of the filters distributed according to the Mel frequency scale. Filter the single-sided spectrum through the Mel filter bank to obtain the energy values in 64 frequency bands. Sum the amplitude values in each frequency band to obtain a 64-dimensional Mel frequency spectrum. Take the logarithm of the energy value in each frequency band to obtain the logarithmic Mel frequency spectrum. The purpose of taking the logarithm is to smooth the spectrum line to make it closer to the auditory characteristics of the human ear.
[0044] The logarithmic Mel spectra of every 96 frames are combined into a Mel spectrogram as the time-frequency representation of the sound signal. The vertical axis of the Mel spectrogram represents the Mel frequency (a total of 64 frequency bands), and the horizontal axis represents the time frame (each 96 frames constitutes a unit). The number of Mel spectrograms depends on the length of the sound signal and can be adjusted according to the actual situation. In order to meet the input requirements of the subsequent deep learning model, the size of the Mel spectrogram needs to be adjusted. The size of the Mel spectrogram is adjusted to 224×224 using bilinear interpolation, keeping the aspect ratio of the image unchanged. The adjusted Mel spectrogram can be directly input into the sleep-wake detection model based on transfer learning for feature extraction and classification.
[0045] In the second step, the VGG16 network pre-trained on the large-scale image database ImageNet is selected as the base model. The top fully connected layer and the maximum pooling layer of the VGG16 network are removed, and the remaining convolutional layer and pooling layer structures are retained. The parameters of the pre-trained convolutional layer and pooling layer are migrated to the sleep-wake detection model as feature extractors. On top of the migrated VGG16 network, new convolutional layers, LSTM layers, Dropout layers, and fully connected layers are added to form a complete sleep-wake detection model. The convolution kernel size of the convolutional layer is 3×3, and the activation function selects ReLU to extract local features. After the convolutional layer, three fully connected layers are added, with the number of neurons being 4096, 4096, and 256, respectively, to map the extracted features to a 256-dimensional embedding space. Dropout layers are inserted between the fully connected layers to randomly discard some neurons to prevent the network from overfitting. The preprocessed Mel spectrogram is input into the migrated VGG16 network, and the deep features of the tracheal sound signal are extracted through a series of convolutional and pooling layers. The convolutional layer extracts the time-frequency features in the Mel spectrogram through local receptive field and weight sharing. The pooling layer reduces the size of the feature map and improves the robustness of the feature through downsampling operations. The extracted features are mapped to a 256-dimensional embedding space through a fully connected layer to obtain a compact representation of the tracheal sound signal.
[0046] The model is trained using labeled sleep-wake data, where the label indicates the sleep or wake state corresponding to each frame. Convolutional layers and LSTM layers are added on top of the extracted 256-dimensional embedding features to capture temporal dependencies. The LSTM layer can effectively model long-term dependencies and capture the temporal evolution of sleep-wake states. After the LSTM layer, a fully connected layer and a Softmax activation function are added to map the features to the two categories of sleep and wake. The model is trained using the cross entropy loss function and the Adam optimizer, and the network parameters are continuously adjusted to minimize the prediction error. The mel spectrogram of the test sample is input into the trained sleep-wake detection model to obtain the sleep or wake state prediction results for each frame. Based on the prediction results, the number of sleep frames and wake frames of the patient is counted to calculate the actual sleep duration of the patient.
[0047] The third step is to input the tracheal sound signal and set the initial parameters of the AV-Box algorithm. Set the box length L and the box height 2H to determine the size of the rectangular window. Initialize the center point of the right boundary to (n=L+1, Yn), where n represents the sampling point and Yn represents the signal amplitude. Calculate the number of sample points in the rectangular window. Taking the center point of the right boundary as the reference, count the number of sample points in the rectangular window, recorded as bLH(n). The number of sample points reflects the energy distribution of the signal in the current rectangular window.
[0048] The calculated number of sample points bLH(n) is compared with the preset threshold. If the number of sample points is lower than the threshold, the current point is judged as a change point, indicating that there may be a boundary of a respiratory event. It is determined whether the current change point is the end point of the signal.
[0049] If it is the end point, the position parameter of the point is output, indicating that a complete respiratory event segment is detected. If it is not the end point, the rectangular window is moved forward by a unit distance, and the center point of the right boundary is updated to (n=n+ΔL, Yn), where ΔL represents the moving step. The rectangular window is continuously moved, the number of sample points is calculated, and the change point is determined until the end of the signal is reached. Through the iterative process, all potential respiratory event segments in the signal can be detected.
[0050] Check the time interval between adjacent change points. If the interval is less than 200 milliseconds, merge the respiratory event segments corresponding to the two change points into one segment. The merging operation can eliminate over-segmentation caused by signal noise or short-term respiratory changes.
[0051] Verify the duration of the merged respiratory event segments. If the duration of the segment is less than 200 milliseconds or greater than 5 seconds, the segment is judged not to be a valid respiratory event and is deleted. By filtering the duration, segments that are too short or too long can be removed to improve the accuracy of respiratory event detection. Analyze the time interval between adjacent respiratory event segments. If the interval is greater than 10 seconds, mark the interval as a sleep apnea segment. The sleep apnea segment represents an interruption in the respiratory event and is a key factor in determining the sleep apnea hypopnea index (AHI).
[0052] Figure 2 This is a potential sleep apnea segment screening result diagram of an embodiment of the present application. The present application uses an adaptive longitudinal box algorithm to screen tracheal sound signals for potential sleep apnea segments. The black waveform in the figure is the tracheal sound signal, and the flat part between the red rectangular windows is the potential sleep apnea segment.
[0053] In the second stage, the RR interval of the potential sleep apnea segment is estimated, multidimensional statistical features are extracted and classified using support vector machines to achieve accurate detection of sleep apnea. Combined with the sleep duration obtained in the first stage, the patient's AHI is calculated. The specific steps are as follows: The sampling rate of the potential sleep apnea segment obtained in the first stage is downsampled to 2kHz to reduce the amount of data and improve processing efficiency. The potential sleep apnea segment is segmented according to a window length of 2 seconds to obtain a series of heart sound signal segments. Each heart sound signal segment is Hilbert transformed to obtain its analytical signal. The analytical signal is modulo to obtain the energy envelope of the heart sound signal segment. The energy envelope reflects the instantaneous energy change of the heart sound signal, which helps to locate the S1 and S2 peaks.
[0054] Define the initial threshold level T as 0.25 times the maximum energy value of the heart sound signal segment. Only retain the envelope signal whose energy envelope value is greater than the threshold T, and eliminate the energy peaks corresponding to the unnecessary ripples in the data. Through threshold processing, the noise and interference with lower energy can be removed, and the energy characteristics of the S1 and S2 peaks can be highlighted. Define variables d21 and d21 to represent the time interval of the S1-S2 peak and the time interval of the S2-S1 peak, respectively. Use fixed values to initialize d12 and d21, for example, they can be set to half of the average period of the heart sound signal. Introduce weight factors k1 and k2 to dynamically adjust the values of d12 and d21 to adapt to the rhythm changes of the heart sound signal.
[0055] In each S1-S2 time distance, only the peak with the largest energy is retained, and other peaks are discarded and marked as S1 peaks. Similarly, in each S2-S1 time distance, only the peak with the largest energy is retained, and other peaks are discarded and marked as S2 peaks. Through peak screening, the S1 and S2 peaks in the heart sound signal can be accurately located and redundant peak interference can be eliminated.
[0056] Calculate the time interval between adjacent S1 peaks and S2 peaks. Compare the time interval with variables d12 and d21. If the interval is close to d12, mark the previous peak as S1 peak and the next peak as S2 peak; if the interval is close to d21, mark the previous peak as S2 peak and the next peak as S1 peak. By comparing the time intervals, S1 and S2 peaks can be accurately distinguished to ensure the correct classification of the peaks. Calculate the time interval between adjacent S1 peaks to obtain a series of RR interval values. The RR interval reflects the rhythm changes of the heart and is an important indicator for evaluating sleep apnea events.
[0057] Figure 3 This is a graph of the S1 peak segmentation result of an embodiment of the present application; Figure 4 This is a graph showing the segmentation result of the S2 peak in an embodiment of the present application. If 3 and Figure 4 As shown, the figure shows the S1 and S2 peak recognition results in a 20-second long neck pulse sound signal, where the red asterisk represents the S1 peak and the red hollow circle represents the S2 peak. It can be seen that the recognition results of the S1 and S2 peaks of this method are good. This embodiment calculates the Hilbert envelope of the tracheal sound, extracts the S1 and S2 peaks through the adaptive threshold of the envelope, and uses the timing characteristics of the peaks for recognition to estimate the RR interval.
[0058] For each potential sleep apnea segment, calculate the following statistics of the corresponding RR interval sequence: Maximum: the maximum value of the RR interval, reflecting the slowest point of the heart rate. Minimum: the minimum value of the RR interval, reflecting the fastest point of the heart rate. Range: the difference between the maximum and minimum values, indicating the range of variation of the RR interval. Standard deviation: the standard deviation of the RR interval, measuring the degree of dispersion of the RR interval. Mean: the arithmetic mean of the RR interval, reflecting the average level of heart rate. Skewness: the asymmetry of the RR interval distribution, describing the direction and degree of deviation of the distribution. Kurtosis: the degree of sharpness of the RR interval distribution, describing the degree of concentration of the distribution. The calculated statistics are used as the feature vector of the potential sleep apnea segment. Construct a support vector machine (SVM) classifier. Select a suitable SVM kernel function, such as a linear kernel, a Gaussian kernel, etc., and select the optimal kernel function according to the characteristics of the data. Set the parameters of the SVM, such as the penalty coefficient C, the parameters of the kernel function, etc., and optimize the parameter selection through methods such as cross-validation. The SVM classifier is trained using labeled training data, where the label indicates whether each potential sleep apnea segment is a true sleep apnea event. The potential sleep apnea segments are classified.
[0059] Input the feature vector of each potential sleep apnea segment into the trained SVM classifier. The SVM classifier classifies the potential sleep apnea segments into two categories: normal breathing and apnea based on the feature vector. The classification result indicates whether each potential sleep apnea segment is a true sleep apnea event. The classification results are counted to calculate the number of sleep apnea events during the entire sleep period. The number of sleep apnea events reflects the frequency of apnea in the patient during sleep. Use the actual sleep duration of the patient obtained in the second step as the denominator. Use the number of sleep apnea events obtained in the fourth step as the numerator. Calculate AHI = number of sleep apnea events / sleep duration (in hours). AHI represents the average number of sleep apnea events that occur per hour in patients, and is an important indicator for assessing the severity of sleep apnea.
[0060] Figure 5 This is the AHI analysis chart for traditional acoustic detection; Figure 6 This is an AHI analysis diagram for an embodiment of the present application, from Figure 5 and Figure 6 It can be seen from the comparison that the AHI estimation result of the present application is more consistent with the AHI result of PSG and is more adaptable to the needs of clinical applications.
[0061] Figure 7 This is a sleep apnea severity estimation result diagram of an embodiment of the present application. The method proposed in the present application was used to estimate the severity of sleep apnea for 108 local patients. It can be seen from the figure that the present application is relatively accurate in distinguishing mild, moderate and severe sleep apnea.
[0062] The invention of the present application and its implementation methods are described schematically above. The description is not restrictive. Without departing from the spirit or basic features of the present application, the present application can be implemented in other specific forms. What is shown in the accompanying drawings is only one of the implementation methods of the invention of the present application. The actual structure is not limited to this. Any figure mark in the claims should not limit the claims involved. Therefore, if a person of ordinary skill in the art is inspired by it, without departing from the purpose of the present invention, a structural method and an embodiment similar to the technical solution are designed without creativity, which should all fall within the scope of protection of this patent. In addition, the word "including" does not exclude other elements or steps, and the word "one" before the element does not exclude the inclusion of "multiple" elements. The multiple elements stated in the product claim can also be implemented by one element through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
Claims
1. A two-stage sleep apnea detection method, characterized in that: include: Collecting the tracheal sound signal of the user's sleeping breathing, preprocessing the tracheal sound signal, and generating a mel-spectrogram of the tracheal sound signal; wherein the tracheal sound signal includes a breathing audio signal and a heart sound signal; Through transfer learning, a sleep-wake detection model based on the VGG16 network is constructed to calculate the user's sleep duration; The longitudinal box algorithm AV-Box is used to detect sleep apnea segments on the Mel-spectrogram to obtain potential sleep apnea segments; Sampling the potential sleep apnea segment, extracting the S1 peak and S2 peak of the potential sleep apnea segment, and calculating the RR interval according to the time interval between adjacent S1 peaks; wherein the S1 peak represents the first heart sound, and the S2 peak represents the second heart sound; Obtain the statistical characteristics of the RR interval, and use the support vector machine (SVM) to detect apnea based on the statistical characteristics; The user's sleep apnea hypopnea index AHI is calculated based on the number of sleep apneas counted in the apnea detection results and the sleep duration.
2. The two-stage sleep apnea detection method according to claim 1, characterized in that: Collect the tracheal sound signal of the user's sleeping breathing, pre-process the tracheal sound signal, and generate a mel spectrogram of the tracheal sound signal, including: Perform frame processing on the collected tracheal sound signals; Performing short-time Fourier transform on the framed tracheal sound signal to obtain a spectrum diagram of the tracheal sound signal; The spectrum is converted into a single-sided spectrum, and the single-sided spectrum is filtered by a Mel filter bank to obtain the logarithmic Mel frequency spectrum of the tracheal sound signal; Combine the log-mel frequency spectra into a mel-spectrogram.
3. The two-stage sleep apnea detection method according to claim 2, characterized in that: The tracheal sound signal of the user's sleeping breathing is collected, the tracheal sound signal is preprocessed, and a mel spectrogram of the tracheal sound signal is generated, which also includes: Bilinear interpolation is used to adjust the size of the mel-spectrogram to obtain a mel-spectrogram of uniform size.
4. The two-stage sleep apnea detection method according to claim 3, characterized in that: Through transfer learning, a sleep-wake detection model based on the VGG16 network is constructed to calculate the user's sleep duration, including: The VGG16 network is trained on the source domain database. After training, all network structures and trained parameters before the last maximum pooling layer of the VGG16 network are transferred to the sleep-wake detection model, and the last maximum pooling layer and fully connected layer of the VGG16 network are removed. In the migrated network structure, new maximum pooling layers, multiple convolutional layers, LSTM layers, and fully connected layers are added in sequence to form a sleep-wake detection model. The Mel-spectrograms of uniform size are input into the sleep-wake detection model, the feature representation of the Mel-spectrograms is obtained through forward propagation, and the model parameters are adjusted using the back-propagation algorithm; A softmax function is added after the last fully connected layer of the sleep-wake detection model to construct a sleep-wake state classifier. The input Mel spectrogram is classified into two sleep-wake states to obtain the sleep-wake detection result. According to the sleep-wake detection results, the start frame and end frame of the sleep state are extracted, the time difference corresponding to the start frame and the end frame is calculated to obtain the duration of the sleep state, and the duration of all sleep states is accumulated to obtain the user's sleep duration.
5. The two-stage sleep apnea detection method according to claim 4, characterized in that: The longitudinal box algorithm AV-Box is used to detect sleep apnea segments on the Mel spectrogram to obtain potential sleep apnea segments, including: Set the coordinates of the center point of the right boundary of the rectangular window to (n, Yn), where n represents the sampling point and Yn represents the signal amplitude; Set the box length of the rectangular window to L, the box height to 2H, and initialize the coordinates of the center point of the boundary to (n=L+1, Yn); Calculate the number of sampling points bLH(n) within the rectangular window; Determine whether the number of sampling points bLH(n) is less than the threshold. If so, mark the current sampling point n as a change point. Determine whether the current sampling point n is equal to the total number of sampling points of the Mel-spectrogram. If so, output the position parameters of the current sampling point n. Otherwise, move the rectangular window forward by a unit distance, and update the coordinates of the center point with the boundary to (n=ε+n, Yn), where ε is the unit distance. Repeat the judgment of the number of sampling points until the current sampling point n is equal to the total number of sampling points of the Mel-spectrogram.
6. The two-stage sleep apnea detection method according to claim 5, characterized in that: The AV-Box algorithm is used to detect sleep apnea segments on the Mel-spectrogram to obtain potential sleep apnea segments, including: Calculate the interval between adjacent change points of the output, and determine whether the interval is less than a first threshold. If so, merge the corresponding two change points into one change point. Calculate the duration of the segment between the merged adjacent change points, and determine whether the segment duration is less than a second threshold or greater than a third threshold. If yes, delete the corresponding segment; wherein the second threshold is less than the third threshold; The interval between adjacent segments after the segment is deleted is calculated to determine whether the interval is greater than a fourth threshold, and if so, the corresponding segment is marked as a potential sleep apnea segment; wherein the fourth threshold is greater than the third threshold.
7. The two-stage sleep apnea detection method according to claim 6, characterized in that: The potential sleep apnea segment is sampled, the S1 peak and S2 peak of the potential sleep apnea segment are extracted, and the RR interval is calculated according to the time interval between adjacent S1 peaks, including: Performing Hilbert transformation on the potential sleep apnea segment to calculate the energy envelope of the potential sleep apnea segment; Compare the energy envelope value with a threshold value T, and retain the energy envelope value whose energy envelope value is greater than the threshold value T; Set variables d12 and d21 to represent the time interval between the S1-S2 peak and the time interval between the S2-S1 peak, respectively; In the time window corresponding to d12, the peak with the largest energy envelope value is obtained, which is marked as S1 peak; in the time window corresponding to d21, the peak with the largest energy envelope value is obtained, which is marked as S2 peak; Calculate the time interval Δt between adjacent S1 peaks and S2 peaks, compare the time interval Δt with variables d12 and d21, if the time interval Δt is less than d12, mark the corresponding peak pair as S1-S2 peak pair; if the time interval Δt is greater than d12 and less than d21, mark the corresponding peak pair as S2-S1 peak pair; The time interval between adjacent S1 peaks was calculated as the RR interval.
8. The two-stage sleep apnea detection method according to claim 7, characterized in that: Get the statistical characteristics of the RR interval, including maximum value, minimum value, range, standard deviation, mean, skewness and kurtosis.
9. The two-stage sleep apnea detection method according to claim 8, characterized in that: Calculate the user's sleep apnea hypopnea index AHI using the following formula: AHI=N / T Wherein, N represents the number of sleep apnea events of the user; T represents the sleep duration of the user.
10. A two-stage sleep apnea detection system, characterized in that: include: A collection module collects tracheal sound signals of the user's sleeping breathing; A preprocessing module preprocesses the tracheal sound signal to generate a mel-spectrogram of the tracheal sound signal; wherein the tracheal sound signal includes a respiratory audio signal and a heart sound signal; The sleep-wake detection module builds a sleep-wake detection model based on the VGG16 network through transfer learning to calculate the user's sleep duration; The sleep apnea detection module uses the longitudinal box algorithm AV-BOX to detect the sleep apnea segments on the Mel-spectrogram to obtain potential sleep apnea segments; The heart sound feature extraction module samples the potential sleep apnea segment, extracts the S1 peak and S2 peak of the potential sleep apnea segment, and calculates the RR interval according to the time interval between adjacent S1 peaks; wherein the S1 peak represents the first heart sound and the S2 peak represents the second heart sound; The apnea detection module obtains the statistical characteristics of the RR interval and uses the support vector machine (SVM) to perform apnea detection based on the statistical characteristics; the user's sleep apnea hypopnea index (AHI) is calculated based on the number of sleep apneas and sleep duration counted from the apnea detection results.
Citation Information
Patent Citations
Apnea snore recognition method based on double-flow multi-scale model
CN116486839A
Sleep breathing monitoring method and device
CN109431470A
Acoustic upper airway assessment system and method, and sleep apnea assessment system and method relying thereon
US20170119303A1
Cited By
Sleep apnea identification method based on multi-modal feature fusion
CN121015165A
OSA monitoring and early warning method and device integrating snore and blood oxygen characteristics
CN121101468A
Velcro rale detection method and system based on breathing auscultation sound
CN121694790A