Sleep apnea detection method and system based on electrocardiosignal and storage medium

By identifying the R-peak and extracting features from electrocardiogram signals to form multi-channel features, and using a complex model to detect sleep apnea, the problem of insufficient detection accuracy in existing technologies is solved, and more efficient sleep apnea detection is achieved.

CN121647600APending Publication Date: 2026-03-13HANGZHOU PROTON TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-14
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies for sleep apnea detection based on single-lead electrocardiogram signals cannot fully capture the comprehensive manifestation of apnea events on electrocardiogram signals, resulting in insufficient detection accuracy and limiting its applicability in complex sleep scenarios.

Method used

By acquiring the R-peak of the target electrocardiogram signal, identifying it, calculating the RR interval and R-peak amplitude, resampling and interpolating the heart rate curve, extracting signals related to breathing frequency bands, forming multi-channel features, and using a sleep breathing detection model with a dual-branch multi-scale feature extraction module, an adaptive weight fusion module, a time-dependent modeling module, and an adaptive feature fusion module, the sleep apnea state is determined.

Benefits of technology

It improves the discrimination and robustness of sleep apnea detection, enhances the practicality and applicability of the detection, and enables more comprehensive detection of sleep apnea.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121647600A_ABST
    Figure CN121647600A_ABST
Patent Text Reader

Abstract

The invention discloses an electrocardiosignal-based sleep apnea detection method and system and a storage medium. The method comprises the following steps: acquiring a target electrocardiosignal to be analyzed, performing R peak identification on the target electrocardiosignal, calculating an RR interval between two adjacent R peaks, and acquiring a voltage amplitude of the electrocardiosignal at the R peak position as an R peak amplitude; on the basis of the RR interval, the RR interval is converted into an instantaneous heart rate sequence, resampling operation is carried out on the heart rate sequence, interpolation processing is carried out on non-uniform sampling points obtained after resampling so as to obtain a continuous and equally-spaced heart rate curve, and signals of a breathing-related frequency band are extracted through filtering to serve as electrocardio derived breathing signals; and splicing the RR interval, the R peak amplitude and the electrocardio-derived respiration signal to form a multi-channel feature, and inputting the multi-channel feature into a trained sleep respiration detection model to obtain sleep apnea state judgment information. Therefore, the apnea state can be detected more comprehensively, and the accuracy of sleep apnea detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sleep health assessment, and more particularly to a method, system, and storage medium for detecting sleep apnea based on electrocardiogram signals. Background Technology

[0002] Electrocardiogram (ECG) signal analysis, as a non-invasive physiological monitoring method, has significant application value in the field of sleep health assessment. By analyzing the rhythm and morphological characteristics of ECG signals, potential respiratory abnormalities during sleep can be indirectly reflected, providing a technical basis for early screening and monitoring. Currently, existing technologies typically extract respiratory-related features based on single-lead ECG signals. Specifically, existing solutions generally extract specific indicators in the time or frequency domain, such as heart rate variability features or waveform morphology parameters, by preprocessing the ECG signal, and then combine these with preset thresholds or simple classifiers to determine respiratory events. However, existing technologies still have significant limitations in implementation. Due to the multidimensional and non-linear relationship between ECG signals and respiratory activity, relying solely on a single type of feature or a simple combination of features is insufficient to comprehensively capture the overall manifestation of sleep apnea events in ECG signals, resulting in insufficient detection accuracy and limiting their applicability in complex sleep scenarios. Summary of the Invention

[0003] To address the shortcomings of existing technologies, this invention discloses a method for detecting sleep apnea based on electrocardiogram signals, comprising the following steps:

[0004] The target electrocardiogram (ECG) signal to be analyzed is acquired, R-peaks are identified in the target ECG signal, the RR interval between two adjacent R-peaks is calculated, and the voltage amplitude of the ECG signal at the R-peak position is obtained as the R-peak amplitude.

[0005] Based on the RR interval, the RR interval is converted into an instantaneous heart rate sequence. The heart rate sequence is resampled, and the non-uniform sampling points after resampling are interpolated to obtain a continuous and equally spaced heart rate curve. The signal of the respiratory-related frequency band is extracted by filtering as the ECG-derived respiratory signal. The RR interval, R peak amplitude and ECG-derived respiratory signal are spliced ​​together to form a multi-channel feature.

[0006] The multi-channel features are input into the trained sleep breathing detection model to obtain sleep apnea state judgment information.

[0007] Preferably, the steps of acquiring the target electrocardiogram (ECG) signal to be analyzed, identifying the R-peak of the target ECG signal, calculating the RR interval between two adjacent R-peaks, and acquiring the voltage amplitude of the ECG signal at the R-peak position as the R-peak amplitude include:

[0008] The QRS complex of the target ECG signal is detected based on the steepness characteristics of the absolute gradient of the ECG signal, the local maximum value of the QRS complex is located and the R peak is identified.

[0009] Based on the identified R peak, the time interval between two adjacent R peaks is calculated. The time interval is the RR interval. At the same time, the voltage amplitude of the electrocardiogram at the R peak position is obtained as the R peak amplitude.

[0010] Preferably, the step of detecting the QRS complex of the target ECG signal based on the steepness characteristics of the absolute gradient of the ECG signal, locating the local maximum value of the QRS complex, and identifying the R peak includes:

[0011] Calculate the gradient value corresponding to each sampling point in the target electrocardiogram signal, and perform an absolute value operation on the gradient value to obtain the absolute gradient.

[0012] The absolute gradient is smoothed by using a uniform filter with a first window size to obtain a smoothed gradient, and the smoothed gradient is averaged by using a uniform filter with a second window size to obtain an average gradient.

[0013] The signal location where the average gradient exceeds the preset gradient threshold is determined based on the relationship between the average gradient and the preset gradient threshold, and potential QRS groups are identified based on the signal location.

[0014] Exclude potential QRS groups whose width does not meet the preset width standard, and locate the local maximum value in the remaining potential QRS groups that meet the width requirement as candidate R peaks.

[0015] Each candidate R-peak is judged for its interval compliance. Potential R-peaks whose interval with the previous adjacent R-peak that has passed the judgment does not reach the preset interval are discarded, and the remaining candidate R-peaks are used as the determined R-peaks of the target ECG signal.

[0016] Preferably, the step of converting the RR interval into an instantaneous heart rate sequence based on the RR interval, performing a resampling operation on the heart rate sequence, interpolating the non-uniform sampling points after resampling to obtain a continuous, equally spaced heart rate curve, and extracting signals related to respiratory frequency bands as ECG-derived respiratory signals through filtering; and splicing the RR interval, R-peak amplitude, and ECG-derived respiratory signals to form a multi-channel feature includes:

[0017] The calculated RR intervals are converted into instantaneous heart rate sequences. The instantaneous heart rate value corresponding to each RR interval is calculated by combining the ratio of the sampling frequency to the RR interval with a fixed time coefficient.

[0018] A reference frequency for respiratory analysis is set, and a scaling factor is determined based on the ratio between the reference frequency and the sampling frequency. The instantaneous heart rate sequence is then subjected to a second sampling operation according to the scaling factor to obtain a resampled heart rate sequence. The original R peak position is mapped to the resampled time axis according to the scaling factor to generate an index sequence corresponding to the resampled sequence.

[0019] On the resampling time axis, the piecewise cubic spline interpolation method is used to interpolate the resampled heart rate sequence for the non-uniform sampling points corresponding to the index sequence, resulting in a continuous and equally spaced heart rate curve.

[0020] The obtained heart rate curve is input into a zero-phase IIR bandpass filter to extract signals in the frequency bands related to respiratory activity, thus obtaining an electrocardiogram-derived respiratory signal.

[0021] Preferably, the step of converting the RR interval into an instantaneous heart rate sequence based on the RR interval, performing a resampling operation on the heart rate sequence, interpolating the non-uniform sampling points after resampling to obtain a continuous, equally spaced heart rate curve, and extracting signals related to the respiratory frequency band as ECG-derived respiratory signals through filtering; and splicing the RR interval, R-peak amplitude, and ECG-derived respiratory signals to form a multi-channel feature further includes:

[0022] Z-score standardization was performed on the RR interval sequence, R peak amplitude sequence, and ECG-derived respiratory signal, respectively. The Z-score standardization process includes calculating the mean and standard deviation of each signal and eliminating the dimensional differences between different signals by dividing the difference between the original signal value and the mean by the standard deviation.

[0023] The cubic spline interpolation method was used to interpolate the three signals after Z-score standardization, and the number of sampling points for the three signals was adjusted.

[0024] The interpolated RR interval sequence, R peak amplitude sequence, and ECG-derived respiratory signal are spliced ​​together to form a multi-channel feature.

[0025] Preferably, the sleep apnea detection model includes:

[0026] A dual-branch multi-scale feature extraction module is configured to construct a dual-branch architecture containing an ECG signal branch and an ECG-derived respiratory signal branch, using the formed multi-channel features as input. Each branch is configured with an enhanced one-dimensional convolutional component, which integrates convolutional layers, a multi-scale temporal pyramid, and a cross-modal interactive attention mechanism. Specifically, features are initially extracted through the convolutional layers, and these features are then input into the multi-scale temporal pyramid for parallel convolutional processing at different time scales. The cross-modal interactive attention mechanism explicitly models the inter-modal dependencies between the R-peak interval, R-peak amplitude, and each channel of the ECG-derived respiratory signal, and learns collaborative representations between modalities. Max pooling layers are used to downsample the features, and Dropout layers are applied for further processing. After all enhanced one-dimensional convolutional modules have completed execution, the spatiotemporal-channel interactive features of the multi-channel signals are extracted.

[0027] An adaptive weight fusion module is configured to receive multi-channel spatiotemporal-channel interactive features output by a dual-branch multi-scale feature extraction module, construct a dynamic weight calculation mechanism based on feature representation quality and modal contribution, constrain weight values ​​within a preset range through an activation function, and analyze the reliability and modal synergy of ECG signal branches and ECG-derived respiratory signal branches in real time through the mechanism, generating adaptive weights for each branch feature that are adapted to the current data distribution; after weighted fusion of each branch feature with the corresponding adaptive weights, a fused feature is obtained, and a comprehensive feature representation is output.

[0028] A temporal dependency modeling module is configured to receive the comprehensive feature representation output by the adaptive weight fusion module. It performs layer normalization on the fused features using a temporal processing structure containing Transformer encoding blocks and a temporal recurrent neural network. The processed features are then element-wise added to the temporal position encoding, carrying temporal position information. The features carrying temporal position information are input into an attention mechanism to calculate feature attention weights. After residual connections and layer normalization, the Transformer-processed features are output through a feedforward network. Finally, the features are input into a bidirectional temporal recurrent neural network to capture long-term temporal dependencies, outputting temporally enhanced comprehensive features.

[0029] An adaptive feature fusion module is configured to receive temporally enhanced comprehensive features output by a temporal dependency modeling module, calculate the importance score of each time step of the sequence corresponding to the temporally enhanced comprehensive features through a temporal attention mechanism, and adaptively focus on features at key time points; a dynamic feature selection component is configured to generate channel weight vectors based on the characteristics of the input sequence, achieve soft selection of feature dimensions through an activation function, highlight discriminative features related to sleep apnea, and output a weighted feature sequence;

[0030] The classification output module is configured to receive the weighted feature sequence output by the adaptive feature fusion module and perform a global average pooling operation on it to compress the temporal dimension into a single feature vector; the single feature vector is then sequentially input into a fully connected layer for feature transformation and dimension mapping, and the model output value is converted into a probability distribution through an activation function.

[0031] This invention also discloses a sleep apnea detection system based on electrocardiogram signals, comprising:

[0032] The feature extraction module is configured to acquire the target electrocardiogram (ECG) signal to be analyzed, identify the R-peak of the target ECG signal, calculate the RR interval between two adjacent R-peaks, and acquire the voltage amplitude of the ECG signal at the R-peak position as the R-peak amplitude.

[0033] The feature parsing module is configured to convert the RR interval into an instantaneous heart rate sequence based on the RR interval, perform a resampling operation on the heart rate sequence, perform interpolation processing on the non-uniform sampling points after resampling to obtain a continuous and equally spaced heart rate curve, extract the signal of the respiratory-related frequency band by filtering as the ECG-derived respiratory signal, and splice the RR interval, R peak amplitude and ECG-derived respiratory signal to form a multi-channel feature.

[0034] A state discrimination module is configured to input the multi-channel features into a trained sleep breathing detection model to obtain sleep apnea state judgment information.

[0035] Preferably, the feature parsing module includes:

[0036] The positioning and recognition module is configured to detect the QRS complex of the target ECG signal based on the steepness characteristics of the absolute gradient of the ECG signal, locate the local maximum value of the QRS complex, and identify the R peak.

[0037] The feature peak analysis module is configured to calculate the time interval between two adjacent R peaks based on the identified R peaks, the time interval being the RR interval, and simultaneously acquire the voltage amplitude of the electrocardiogram signal at the R peak position as the R peak amplitude.

[0038] The present invention also discloses a sleep apnea detection device based on electrocardiogram signals, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the methods described above.

[0039] The present invention also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the methods described above.

[0040] This invention discloses a sleep apnea detection method based on electrocardiogram (ECG) signals. The method acquires the target ECG signal, identifies R-peaks, calculates the RR interval between two adjacent R-peaks, and obtains the voltage amplitude of the ECG signal at the R-peak position as the R-peak amplitude. Based on the RR interval, it converts the RR interval into an instantaneous heart rate sequence. The heart rate sequence is resampled, and the non-uniform sampling points after resampling are interpolated to obtain a continuous, equally spaced heart rate curve. Signals in the respiratory-related frequency bands are extracted through filtering as ECG-derived respiratory signals. The RR interval, R-peak amplitude, and ECG-derived respiratory signals are concatenated to form a multi-channel feature. This multi-channel feature is input into a trained sleep apnea detection model to obtain sleep apnea state judgment information. This method solves the problem of incomplete sleep apnea event recognition, enabling more comprehensive detection of sleep apnea states, improving the discriminative power and robustness of sleep apnea state detection, and enhancing the practicality and applicability of the method.

[0041] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0042] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0043] Figure 1 This is a schematic diagram illustrating the specific process of a sleep apnea detection method based on electrocardiogram signals disclosed in an embodiment of the present invention.

[0044] Figure 2 This is a flowchart of step S1 of a sleep apnea detection method based on electrocardiogram signals disclosed in an embodiment of the present invention.

[0045] Figure 3 This is a schematic diagram of the specific process of step S11 disclosed in an embodiment of the present invention.

[0046] Figure 4 This is a partial flowchart illustrating step S2 of an embodiment of the present invention.

[0047] Figure 5 This is a schematic diagram of another part of the specific process of step S2 disclosed in an embodiment of the present invention.

[0048] Figure 6 This is a schematic diagram of a sleep apnea detection system based on electrocardiogram signals disclosed in an embodiment of the present invention. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0050] Unless otherwise defined, the technical or scientific terms used herein should be understood in their ordinary sense by one of ordinary skill in the art to which this invention pertains. The terms “first,” “second,” and similar terms as used in this embodiment do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms “an” or “a,” and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one.

[0051] In this embodiment, as shown in the appendix Figure 1 As shown, the sleep apnea detection method based on electrocardiogram signals includes the following steps:

[0052] Step S1: Obtain the target electrocardiogram (ECG) signal to be analyzed, identify the R-peak of the target ECG signal, calculate the RR interval between two adjacent R-peaks, and obtain the voltage amplitude of the ECG signal at the R-peak position as the R-peak amplitude.

[0053] The target ECG signal is subjected to a characteristic peak identification operation. This involves waveform feature analysis of the target ECG signal to define morphological characteristic parameters of the characteristic peaks, such as peak amplitude threshold and rising / falling edge slope. A peak detection algorithm is used to traverse the target ECG signal, locate and mark all signal sites that meet the morphological parameters of the characteristic peaks, establish a position index for the characteristic peaks, and complete the identification of the characteristic peaks. Based on the identified and marked characteristic peak sites, the timestamp information corresponding to each characteristic peak is extracted, and the time interval between adjacent characteristic peaks is obtained by calculating the difference between the timestamps of adjacent characteristic peaks. Simultaneously, the signal amplitude values ​​at the marked positions of each characteristic peak are collected to obtain the signal amplitude corresponding to each characteristic peak.

[0054] In this embodiment, as shown in the appendix Figure 2 As shown, step S1 includes:

[0055] Step S11: Detect the QRS complex of the target ECG signal based on the steepness characteristics of the absolute gradient of the ECG signal, locate the local maximum value of the QRS complex, and identify the R peak.

[0056] Specifically, the target ECG signal undergoes sample-by-sample absolute gradient calculation to generate the signal gradient change at each time point. Based on the physiological waveform characteristic that the QRS complex in the ECG signal has a more significant gradient steepness compared to other waveforms such as the P wave and T wave, a gradient steepness judgment threshold is set, and signal segments with gradient changes exceeding this threshold are initially identified as candidate intervals for the QRS complex. Local extremum detection is performed on the signal waveforms within each candidate interval, traversing the signal amplitude of all sampling points within the candidate interval, and selecting the sampling point with the optimal amplitude and defining it as the local maximum point of the QRS complex. The local maximum point is compared with the preset R-peak morphological verification conditions to confirm the R-peak attribute of the local maximum point, completing the identification and location marking of the R-peak across the entire signal range. The preset R-peak morphological verification conditions include the slope matching degree of the rising and falling edges of the signal before and after the peak value.

[0057] In this embodiment, as shown in the appendix Figure 3 As shown, step S11 includes:

[0058] Step S111: Calculate the gradient value corresponding to each sampling point in the target electrocardiogram signal, and perform absolute value operation on the gradient value to obtain the absolute gradient.

[0059] Calculate the amplitude difference between each sampling point in the target ECG signal and the next adjacent sampling point, and use the amplitude difference as the gradient value corresponding to that sampling point; perform absolute value operation on all the obtained gradient values ​​one by one, and define the operation result as the absolute gradient to unify the direction representation of gradient change.

[0060] Step S112: The absolute gradient is smoothed using a uniform filter with a first window size to obtain a smoothed gradient, and the smoothed gradient is averaged using a uniform filter with a second window size to obtain an average gradient.

[0061] The absolute gradient signal is input into a uniform filter with a first window size, and the high-frequency fluctuation components in the signal are suppressed by the uniform filter with the first window size. The absolute gradient is smoothed, and the processed signal is output and marked as the smoothed gradient. The smoothed gradient signal is input into a uniform filter with a second window size, and the smoothed gradient signal is local mean calculated by the uniform filter with the second window size. The smoothed gradient is then processed by moving average, and the processed signal is output and determined as the average gradient. This reduces noise interference and enhances the gradient characteristics of the QRS group.

[0062] In one specific embodiment, the uniform filter with a first window size can be configured as a uniform filter with a window size of 25 points (0.1 seconds); the uniform filter with a second window size can be configured as a uniform filter with a window size of 375 points (0.75 seconds).

[0063] Step S113: Determine the signal location where the average gradient exceeds the preset gradient threshold based on the relationship between the average gradient and the preset gradient threshold, and identify potential QRS groups based on the signal location.

[0064] The average gradient is compared point by point with a preset gradient threshold to filter out all signal locations whose average gradient values ​​are greater than the preset gradient threshold; based on the continuous distribution characteristics of the signal locations on the time axis, signal segments that continuously exceed the threshold are defined as potential QRS groups, and signal intervals that may contain QRS groups are preliminarily identified.

[0065] Step S114: Eliminate potential QRS groups whose width does not meet the preset width standard, and locate the local maximum value in the remaining potential QRS groups that meet the width requirement as candidate R peaks.

[0066] Read the duration width of each potential QRS group on the time axis. The duration width is the time span from the start position to the end position of the group. Compare the duration width with a preset width standard. Eliminate potential QRS groups with widths smaller than the preset width standard and retain potential QRS groups with widths that meet the preset standard. For each retained potential QRS group, traverse the signal amplitude of all sampling points within it, locate and extract the sampling point with the largest amplitude, and mark the sampling point as a candidate R peak.

[0067] In another embodiment, the gradient of the ECG signal is calculated and its absolute value is taken. Then, the absolute gradient is smoothed using a uniform filter with a window size of 25 points (0.1 seconds) to obtain a smoothed gradient. The smoothed gradient is averaged using a uniform filter with a window size of 375 points (0.75 seconds) to obtain an average gradient. Potential QRS complexes are identified based on the location where the average gradient exceeds a gradient threshold. The gradient threshold is set to 1.5 times the average gradient. Potential QRS complexes with a width less than 100 points (0.4 seconds) are excluded, and potential R-peaks are determined by finding the most significant local maxima within the QRS complex. Considering that the interval between two R-peaks is typically not less than 75 points (0.3 seconds), potential R-peaks with an interval less than 75 points from the previous R-peak are discarded. The gradient calculation formula is as follows:

[0068]

[0069] in This represents the i-th sampling point of the input signal. This represents the gradient at that sampling point.

[0070] In another embodiment, excluding potential QRS groups with widths smaller than a preset width standard includes the following steps.

[0071] Step S101: Select the target ECG signal after noise removal; based on the morphological characteristics and gradient change patterns of the target ECG signal, identify and extract potential candidate waveforms that conform to the basic morphology of the QRS complex within the target ECG signal using signal processing algorithms; exclude non-target signal components such as electromyography artifacts and power line interference by combining the steep rising edge and significant amplitude changes of the QRS complex, and screen candidate objects with QRS complex morphological characteristics; measure the duration width of each potential QRS complex on the time axis; and calculate the central tendency index and dispersion index of the width based on the width data of all candidate waveforms using statistical analysis methods; establish a QRS complex width benchmark adapted to the current observation object.

[0072] The target ECG signal reflects the basic physiological morphological characteristics of the QRS complex of the observed object. The signal processing algorithm includes using filtering techniques to suppress power frequency interference on the denoised target ECG signal. Specifically, suitable filtering parameters are selected from the main energy distribution frequency bands of the QRS complex to retain the characteristic signal of the QRS complex and suppress the periodic interference caused by the power grid frequency. Signal enhancement methods are used to filter electromyographic noise. Based on the difference between the electromyographic signal and the QRS complex in terms of frequency and amplitude change rate, the steep rising edge and significant amplitude change characteristics of the QRS complex are enhanced, while the high-frequency random noise caused by the electromyographic signal is weakened. Baseline correction processing is performed to eliminate the slow drift of the signal baseline caused by factors such as respiration and body movement, and to clearly present the morphological characteristics of the QRS complex. By monitoring the changes in signal amplitude gradient through a sliding window, when a gradient abrupt change occurs within the window that conforms to the characteristics of a steep rising edge of a QRS complex, it is marked as the starting point of a candidate complex. When the signal gradient returns to a stable state and the amplitude change conforms to the characteristics of a falling edge of a QRS complex, it is marked as the ending point of a candidate complex, thus locating a single candidate complex. For all extracted candidate complexes, combined with the significant amplitude change characteristics of the QRS complex, candidates whose amplitude does not reach the physiological threshold or whose morphology does not conform to the typical biphasic or triphasic morphology of a QRS complex are excluded, while potential QRS complexes with basic physiological morphology are retained.

[0073] Step S102: Based on the QRS group width central tendency index and dispersion index, construct a dynamic screening threshold adapted to the current individual; based on the width central tendency index and combined with the individual width dispersion characteristics reflected by the dispersion index, adaptively adjust the dynamic screening threshold; form a personalized judgment standard matching the physiological morphological characteristics of the QRS group of the current observation object; and perform preliminary screening of potential QRS groups through this dynamic threshold.

[0074] The central tendency index is the core physiological cluster center of QRS complex width. The central tendency index is based on QRS complex width data with stable physiological morphology after initial screening. It identifies numerical clustering regions that occur frequently in the width data and conform to the stability of the ECG signal rhythm, and performs weighted calculation on the width values ​​in the region to highlight the core width range that is adapted to the individual's cardiac conduction function.

[0075] The dispersion index is the physiological fluctuation fit of QRS complex width. The dispersion index is the fluctuation characteristics of individual QRS complex width around the core physiological cluster center. Combined with the physiological variation law of normal human myocardial conduction function, extreme fluctuation data that exceed the physiologically reasonable range are eliminated, and the fluctuation amplitude and frequency of width value within the core cluster area are quantitatively calculated to reflect the natural fluctuation range of QRS complex width of an individual under stable physiological conditions.

[0076] The study focuses on the physiological characteristics of individual QRS complex width, and obtains the physiological fluctuation fit through data processing and physiological pattern verification. The specific steps are as follows:

[0077] Step S201: Based on the initially extracted potential QRS complex width data, and combining the morphological integrity of the QRS complex with the synchronicity of the electrocardiogram rhythm, abnormal width values ​​caused by noise, artifacts or signal distortion are eliminated, and effective width data that conforms to basic physiological morphological characteristics are retained.

[0078] Step S202: Using the core physiological cluster center as the reference anchor point, the core physiological cluster center is obtained through cluster analysis. The core physiological cluster center reflects the physiological reference value of the core distribution of the individual's QRS complex width.

[0079] Step S203: Calculate the deviation of each width value from the core physiological cluster center for each of the filtered effective width data, statistically analyze the distribution characteristics of all deviations, and identify high-frequency deviation intervals. The intervals contain the deviations corresponding to more than 80% of the effective width data, and the trend of the deviations is consistent with the physiological fluctuation law of myocardial conduction function.

[0080] Step S204: Verify the high-frequency deviation range by combining the age, basic cardiac function characteristics, and physiological variation range of normal human QRS complex width of the observed subject: If the upper limit of the range does not exceed the maximum reasonable fluctuation value under the individual's physiological state, and the lower limit of the range is not lower than the minimum reasonable fluctuation value, then the range is determined to be a natural fluctuation range that conforms to the individual's physiological characteristics; if it exceeds the limit, then the range is corrected based on physiological laws.

[0081] Step S205: Based on the amplitude of the natural fluctuation range, the deviation within the range is converted into a quantitative indicator. That is, the smaller the range amplitude and the more uniform the distribution, the more stable the fluctuation of the individual's QRS complex width and the higher the physiological fluctuation fit. Conversely, the fit is lower, indicating that there may be non-physiological factors interfering or potential physiological state changes in the fluctuation.

[0082] Specifically, using the core physiological cluster center as a baseline and combining it with the individual fluctuation amplitude reflected by the physiological fluctuation fit, the basic adjustment range of the threshold is determined. If the individual physiological fluctuation fit is low, the width fluctuation is gentle and the threshold adjustment range is narrowed. If the fluctuation fit is high, the adjustment range is appropriately expanded to accommodate reasonable physiological fluctuations. By introducing the physiological limit range of the normal human QRS complex width as the upper and lower limit constraints of the threshold, it is avoided that the threshold exceeds the physiologically reasonable range due to individual data deviations. For example, for adult subjects, the lower limit of the threshold is ensured to be no lower than the minimum QRS complex width to maintain normal myocardial conduction function, and the upper limit is no higher than the typical width value when myocardial conduction is abnormal. The threshold is adjusted in combination with the age characteristics of the subjects. For example, children generally have narrower QRS complex widths due to the developmental characteristics of their myocardial conduction system, so the lower limit of the threshold is appropriately lowered based on the core physiological cluster center. Elderly people have wider widths due to slower myocardial conduction velocity, so the upper limit of the threshold is appropriately raised to form a dynamic threshold that fits individual characteristics.

[0083] Dynamic threshold adaptation to differences is achieved through multi-dimensional individual characteristic correlation adjustment. For observation subjects of different age groups, based on the physiological laws of development and decline of the myocardial conduction system at each age, a correlation model between age and the core physiological cluster center of QRS complex width is established. When the age of the observation subject changes, the dynamic threshold is adjusted synchronously based on the baseline of this model. The threshold range is fine-tuned by using correlation between body size parameters and the physiological laws of QRS complex width. For example, the QRS complex width of observation subjects with larger body size may be slightly wider than that of observation subjects with smaller body size, and the upper limit of the threshold is adjusted accordingly to avoid missed detection of effective complexes or misjudgment of artifacts due to body size differences.

[0084] Step S103: Perform refined verification on the candidate QRS complex set initially screened by dynamic thresholds; using the statistically obtained QRS complex width central tendency index as a reference, calculate the relative proportion between the actual width of each candidate complex and the central tendency index; set a reasonable relative proportion range based on the physiological variation law of QRS complex width; screen complexes whose width is within the normal physiological fluctuation range; identify complexes whose width is significantly lower than the lower limit of the range and complexes whose width is significantly higher than the upper limit of the range; and remove the above abnormal complexes through secondary verification.

[0085] The QRS wavegroup candidate set, after initial screening by dynamic thresholds, is further refined and verified. The verification includes calculating the relative proportion between the actual width of each candidate wavegroup and the central tendency index of the QRS wavegroup width as a reference. Through secondary verification, such abnormal wavegroups are further eliminated, reducing interference factors in the subsequent R-peak localization process and providing a high-quality wavegroup candidate set for accurate identification of the R-peak.

[0086] Step S104: Using the valid QRS complexes that have undergone secondary verification as the object, locate the R peak of each complex; analyze the amplitude gradient changes within the QRS complex; identify the location of the local peak with the highest amplitude within the complex; combine the steep gradient of the rising edge and the gentle gradient of the falling edge of the QRS complex to distinguish the true R peak, secondary peak, and noise peak within the complex; and use the time coordinate of the R peak location as a reference to obtain the RR interval sequence reflecting changes in cardiac rhythm.

[0087] Specifically, the amplitude gradient changes within the QRS complex are analyzed to identify the location of the local peak with the highest amplitude. By combining the steep gradient of the rising edge and the gentle gradient of the falling edge of the QRS complex, the true R peak, secondary peak, and noise peak within the complex are distinguished, avoiding misidentification of non-core peaks as R peaks. Using the time coordinate of the R peak location as a reference, an RR interval sequence that can truly reflect changes in cardiac rhythm is obtained.

[0088] Step S115: Perform interval compliance judgment on each candidate R peak, discard potential R peaks whose interval with the previous adjacent R peak that has passed the judgment does not reach the preset interval, and take the remaining candidate R peaks as the determined R peaks of the target ECG signal.

[0089] Candidate R-peaks are selected sequentially according to time. The time interval between the candidate R-peak and the previous adjacent R-peak that has passed the interval compliance judgment is calculated. The time interval is compared with a preset interval standard. If the interval is less than the preset interval standard, the candidate R-peak is discarded. If the interval reaches or exceeds the preset interval standard, the candidate R-peak is retained. After the above judgment, the remaining candidate R-peaks are determined as the final R-peaks in the target ECG signal. If there are no R-peaks that have passed the test in the initial state, the starting point of the previous valid signal is used as a reference.

[0090] Step S12: Based on the identified R peak, calculate the time interval between two adjacent R peaks, where the time interval is the RR interval. At the same time, obtain the voltage amplitude of the electrocardiogram signal at the R peak position as the R peak amplitude.

[0091] The positions of two adjacent R peaks are determined based on the identified R peaks, and the time interval between the two R peaks is calculated. The time interval is the RR interval. At the same time, the voltage amplitude of the electrocardiogram at the R peak position is read, i.e., the R peak amplitude. The calculated RR interval sequence and the R peak amplitude sequence are smoothed by a median filter with a preset kernel size.

[0092] Specifically, using the marked R peaks as a reference, the timestamp information corresponding to each R peak is extracted; for the extracted R peak timestamps, the timestamps of two adjacent R peaks are selected sequentially according to the signal timing order to calculate the timestamp difference, and the resulting difference is the RR interval; at the same time, the voltage amplitude of the sampling point corresponding to each marked R peak is collected as the R peak amplitude of the corresponding R peak, and the timing association acquisition and storage of all RR intervals and corresponding R peak amplitudes is completed.

[0093] Step S2: Based on the RR interval, the RR interval is converted into an instantaneous heart rate sequence. A resampling operation is performed on the heart rate sequence. The non-uniform sampling points after resampling are interpolated to obtain a continuous and equally spaced heart rate curve. The signal of the respiratory-related frequency band is extracted by filtering as the ECG-derived respiratory signal. The RR interval, R peak amplitude and ECG-derived respiratory signal are spliced ​​together to form a multi-channel feature.

[0094] The calculated RR intervals are converted into corresponding instantaneous heart rate values. All instantaneous heart rate values ​​are sorted according to the temporal order of the RR intervals to construct an instantaneous heart rate sequence. A resampling frequency is set, and resampling processing is performed on the instantaneous heart rate sequence to form a non-uniform sampling point set. A suitable interpolation algorithm is selected, and point-by-point interpolation is performed on the non-uniform sampling points to fill the information gaps between sampling points, generating a heart rate curve with uniform time intervals and continuous waveform. The filtering parameters of a bandpass filter are configured according to the signal frequency band corresponding to the normal human respiratory frequency. Bandpass filtering processing is performed on the continuous heart rate curve to filter out noise components outside the frequency band and extract frequency band signal components related to respiratory activity. These signal components are defined as ECG-derived respiratory signals. The time interval data between adjacent characteristic peaks, the signal amplitude data corresponding to each characteristic peak, and the ECG-derived respiratory signals are standardized to ensure synchronous calibration of the three types of data in the time dimension. The standardized time interval data, signal amplitude data, and ECG-derived respiratory signals are sequentially concatenated to integrate and construct a multi-channel feature with multiple feature dimensions.

[0095] Specifically, Z-score standardization was performed on the acquired RR interval dataset, R-peak amplitude dataset, and generated ECG-derived respiratory signal. For the RR interval and R-peak amplitude, a standardization algorithm was used to compress the data to a preset uniform numerical range, eliminating dimensional differences between different physical quantities. This standardization process transformed each sequence into a distribution with a mean of 0 and a standard deviation of 1 by subtracting the mean of the sequence and dividing by the standard deviation of the sequence, thus eliminating dimensional differences between different signals. For the ECG-derived respiratory signal, the same Z-score standardization process was used to ensure the consistency of the numerical range of the three types of data. The sampling point count of the three types of signals after Z-score standardization was calibrated using an interpolation algorithm. Following a preset channel arrangement rule, the calibrated three types of signals were spliced ​​along the time axis in a multi-dimensional manner to form a multi-channel feature matrix with three feature dimensions. The channel arrangement rule was that the RR interval was set as the first channel, the R-peak amplitude as the second channel, and the ECG-derived respiratory signal as the third channel.

[0096] In another embodiment, after Z-score standardization of the RR interval, R-peak amplitude, and ECG-derived respiratory signal, cubic spline interpolation is used to interpolate the data, resulting in 1200 sampling points. The specific formula is shown below:

[0097]

[0098] in, Represents the original signal. This represents the mean. Indicates standard deviation, This represents the signal after Z-score standardization. The three signals mentioned above are concatenated to form a multi-channel feature, which can be used as a sleep apnea recognition dataset.

[0099] In this embodiment, as shown in the appendix Figure 4 As shown, step S2 includes:

[0100] Step S21: Convert the calculated RR intervals into an instantaneous heart rate sequence, and calculate the instantaneous heart rate value corresponding to each RR interval by combining the ratio of sampling frequency to RR interval with a fixed time coefficient;

[0101] For each calculated RR interval, the ratio of sampling frequency to RR interval is used as the basic parameter, and numerical calculation is performed in combination with a fixed time coefficient to obtain the instantaneous heart rate value corresponding to each RR interval. All instantaneous heart rate values ​​are arranged and combined in chronological order of RR intervals to construct an instantaneous heart rate sequence.

[0102] Step S22: Set a respiratory analysis reference frequency, determine a scaling factor based on the ratio between the reference frequency and the sampling frequency, perform a secondary sampling operation on the instantaneous heart rate sequence according to the scaling factor to obtain a resampled heart rate sequence; map the original R peak position to the resampled time axis according to the above scaling factor to generate an index sequence corresponding to the resampled sequence.

[0103] The instantaneous heart rate sequence is subjected to a second sampling operation based on the scaling factor. The sampling interval is adjusted to generate a resampled heart rate sequence. At the same time, the position of the original R peak on the time axis is transformed according to the above scaling factor and mapped to the time axis corresponding to the resampled signal, generating an index sequence corresponding to the resampled sequence in the time dimension, thereby realizing the positional association between the original signal and the resampled signal.

[0104] Step S23: On the resampling time axis, the piecewise cubic spline interpolation method is used to interpolate the resampled heart rate sequence for the non-uniform sampling points corresponding to the index sequence, so as to obtain a continuous and equally spaced heart rate curve.

[0105] Locate the non-uniformly distributed sampling points corresponding to the index sequence on the resampled time axis; use piecewise cubic spline interpolation to interpolate the signal gaps between all non-uniformly distributed sampling points in the resampled heart rate sequence; fill the signal gaps through the interpolation process to generate a heart rate curve that is continuously distributed on the time axis and has equal intervals between each sampling point.

[0106] Step S24: Input the obtained heart rate curve into a zero-phase IIR bandpass filter to extract the signal in the frequency band related to respiratory activity, and obtain the electrocardiogram-derived respiratory signal.

[0107] The heart rate curve is filtered by the zero-phase IIR bandpass filter to retain the signal frequency components related to respiratory activity and filter out signals of other irrelevant frequency bands; the signal output after filtering is used as the ECG-derived respiratory signal.

[0108] In another embodiment, for the RR interval Convert it into an instantaneous heart rate sequence .Will Sequence scaling factor A second sampling was performed to obtain the heart rate sequence on the time axis after resampling. ,in The reference frequency for respiratory analysis was set to 4Hz in the experiment. Simultaneously, the original... Positions are mapped to the resampling axis at the same ratio, generating corresponding index sequences. On the resampling time axis, for non-uniform sampling points Corresponding heart rate value Piecewise cubic spline interpolation was performed to obtain continuous, equally spaced heart rate curves. Finally, The signal is fed into a zero-phase IIR bandpass filter to extract the 0.1-0.5Hz frequency band signal related to respiration, thus obtaining the electrocardiogram-derived respiratory signal (EDR).

[0109] In this embodiment, as shown in the appendix Figure 5 As shown, step S2 further includes:

[0110] Step S25: Perform Z-score standardization on the RR interval sequence, R peak amplitude sequence and ECG-derived respiratory signal respectively. The Z-score standardization includes calculating the mean and standard deviation of each signal and eliminating the dimensional differences between different signals by dividing the difference between the original signal value and the mean by the standard deviation.

[0111] Traverse all data points contained in the RR interval sequence, R peak amplitude sequence, and ECG-derived respiratory signal, and calculate the mean and standard deviation of the RR interval sequence, R peak amplitude sequence, and ECG-derived respiratory signal; calculate the difference between each original data value in each signal and the mean of the corresponding signal, and divide the difference by the standard deviation of the corresponding signal to obtain the standardized value; eliminate the dimensional differences caused by the different physical quantities such as time, voltage, and respiratory-related signals in the three types of signals.

[0112] Step S26: The cubic spline interpolation method is used to interpolate the three signals after Z-score standardization, and the number of sampling points for the three signals is adjusted.

[0113] Cubic spline interpolation was used to perform interpolation processing on the RR interval sequence, R peak amplitude sequence, and ECG-derived respiratory signal after the above Z-score standardization. Based on the preset target number of sampling points, interpolation was performed to fill gaps between adjacent data points in each signal type, generating new data points and adjusting the number of sampling points for the three signal types to the same value, thus achieving sampling synchronization in the time dimension.

[0114] Step S27: The interpolated RR interval sequence, R peak amplitude sequence and ECG-derived respiratory signal are spliced ​​together to form a multi-channel feature.

[0115] According to the preset channel arrangement rules, the three types of signals after interpolation are spliced ​​along the time axis to form a multi-channel feature containing three feature dimensions.

[0116] Step S3: Input the multi-channel features into the trained sleep breathing detection model to obtain sleep apnea state judgment information.

[0117] In this embodiment, the sleep breathing detection model includes:

[0118] A dual-branch multi-scale feature extraction module is configured to construct a dual-branch architecture containing an ECG signal branch and an ECG-derived respiratory signal branch, using the formed multi-channel features as input. Each branch is configured with an enhanced one-dimensional convolutional component, which integrates convolutional layers, a multi-scale temporal pyramid, and a cross-modal interactive attention mechanism. Features are initially extracted through the convolutional layers and then input into the multi-scale temporal pyramid for processing at different time scales using parallel convolutional paths. The cross-modal interactive attention mechanism explicitly models the inter-modal relationships between the R-peak interval, R-peak amplitude, and each channel of the ECG-derived respiratory signal, and learns collaborative representations between modalities. Max pooling layers are used to downsample the features, followed by Dropout layers for further processing. After all enhanced one-dimensional convolutional modules have completed execution, the spatiotemporal-channel interactive features of the multi-channel signals are extracted.

[0119] The architecture employs a dual-branch structure with ECG and EDR signal branches. Each branch's multi-scale feature extraction module utilizes three enhanced one-dimensional convolutional modules. Each module includes convolutional layers, a multi-scale temporal pyramid (MS-Temporal Pyramid), and cross-modal interactive attention. The number of filters in the convolutional layers is 64, 128, and 128, respectively, with a kernel size of 7 for all modules. The multi-scale temporal pyramid processes features at different time scales through parallel convolutional paths, with scale factors of 1, 2, and 4, effectively capturing short-term fluctuations and long-term trends in physiological signals. Cross-modal interactive attention explicitly models the interdependencies among three physiological signal channels: RRI, R-peak amplitude, and ECG-derived respiratory signal, learning collaborative representations between modalities. Each module is followed by a max-pooling layer for feature downsampling, with a pooling kernel size of 4. A dropout layer is used to prevent overfitting, with a dropout rate of 0.5; spatiotemporal-channel interactive features of the multi-channel signals are extracted.

[0120] An adaptive weight fusion module is configured to receive multi-channel spatiotemporal-channel interactive features output by a dual-branch multi-scale feature extraction module, construct a dynamic weight calculation mechanism based on feature representation quality and modal contribution, constrain weight values ​​within a preset range through an activation function, and analyze the reliability and modal synergy of ECG signal branches and ECG-derived respiratory signal branches in real time through the mechanism, generating adaptive weights for each branch feature that are adapted to the current data distribution; after weighted fusion of each branch feature with the corresponding adaptive weight, a fused feature is obtained, and a comprehensive feature representation is output.

[0121] This involves introducing learnable EDR weight parameters, which are then constrained within the range of [0,1] using the Sigmoid function, thereby achieving adaptive adjustment of the EDR branch contribution. The specific fusion process is as follows:

[0122]

[0123] This represents the fused feature obtained by combining ECG and EDR features. The features extracted from the branches of an electrocardiogram (ECG) represent the information contained in the ECG signal. The features extracted from the EDR branch represent the information contained in the EDR signal. The weight parameters of the EDR branch are limited to the range of [0,1] by the Sigmoid function and are used to adaptively adjust the contribution of the EDR branch to the final features. The weight parameters are automatically optimized during model training to learn a more reasonable branch weight allocation.

[0124] A temporal dependency modeling module is configured to receive the comprehensive feature representation output by the adaptive weight fusion module. It performs layer normalization on the fused features using a temporal processing structure containing Transformer encoding blocks and a temporal recurrent neural network. The processed features are then element-wise added to the temporal position encoding, carrying temporal position information. The features carrying temporal position information are input into an attention mechanism to calculate feature attention weights. After residual connections and layer normalization, the Transformer-processed features are output through a feedforward network. Finally, the features are input into a bidirectional temporal recurrent neural network to capture long-term temporal dependencies, outputting temporally enhanced comprehensive features.

[0125] The temporal recurrent neural network is a bidirectional LSTM network. The feature maps are transposed and then fed into a Transformer encoding block. This Transformer encoding block contains three layers of normalization, sine-cosine positional encoding, and a multi-head self-attention mechanism. The self-attention mechanism used in the multi-head attention mechanism is as follows:

[0126]

[0127] in, These represent the query matrix, key matrix, and value matrix, respectively. Indicates the dimension of the input.

[0128] Specifically, the features extracted by the dual-branch multi-scale feature extraction module are normalized to obtain zero mean and unit variance. ; through sine-cosine absolute position encoding and Add elements one by one to generate a sequence of positions. The They are fed into a multi-head self-attention mechanism to calculate and obtain... . and After performing residual joins, layer normalization is performed again to obtain... . The result is obtained by sequentially passing the feedforward network consisting of two layers of linear mapping and ReLU activation. ; and After summing the residuals again and normalizing them for the third time, the output is regularized by Dropout. Bidirectional LSTM networks capture long-term time dependencies through two layers of LSTM units in both directions. The forget gate, input gate, and output gate of each LSTM unit regulate the retention, updating, and output of information, respectively.

[0129] Among them, X norm This represents the original features extracted by the dual-branch multi-scale feature extraction module, and the feature data obtained after layer normalization. It has the characteristics of zero mean and unit variance, which can improve the stability of subsequent feature processing. pos X represents norm The feature data generated by adding the sine-cosine absolute position code element by element injects temporal position information into the original features, adapting to the temporal characteristics of ECG signals. attn X represents pos After inputting a multi-head self-attention mechanism, the attention feature output obtained by calculating the dependencies between features is used to capture long-range correlation information of ECG signal features. attn_norms X represents attn With X pos The feature data obtained after performing residual connections and layer normalization can alleviate the vanishing gradient problem in deep network training and preserve key features. ffn X represents attn_norms The output is a nonlinear transformation feature after passing through a feedforward network consisting of two layers of linear mapping and the ReLU activation function. This is used to enhance the model's ability to express complex features. out X represents ffn With X attn_normsThe final feature output is obtained after residual summation, third-layer normalization, and Dropout regularization. The forget gate is the component in the bidirectional LSTM network responsible for preserving regulatory information. It determines which parts of the historical time-series information should be retained in the current cell state. The input gate is the component in the bidirectional LSTM network responsible for updating regulatory information. It selects which parts of the current input features should be incorporated into the cell state. The output gate is the component in the bidirectional LSTM network responsible for outputting regulatory information. It generates the final output features of the LSTM unit based on the current cell state.

[0130] An adaptive feature fusion module is configured to receive temporally enhanced comprehensive features output by a temporal dependency modeling module, calculate the importance score of each time step of the sequence corresponding to the temporally enhanced comprehensive features through a temporal attention mechanism, and adaptively focus on features at key time points; a dynamic feature selection component is configured to generate channel weight vectors based on the characteristics of the input sequence, achieve soft selection of feature dimensions through an activation function, highlight discriminative features related to sleep apnea, and output a weighted feature sequence.

[0131] The classification output module is configured to receive the weighted feature sequence output by the adaptive feature fusion module and perform a global average pooling operation on it to compress the temporal dimension into a single feature vector; the single feature vector is then sequentially input into a fully connected layer for feature transformation and dimension mapping, and the model output value is converted into a probability distribution through an activation function.

[0132] The activation function is the Softmax function, which converts the model output value into a probability distribution in the range [0,1] with a sum of 1.

[0133] In another embodiment, when training the model, the data input to the model is preprocessed in the following manner, the preprocessing including:

[0134] The target ECG signal segment with time stamp and its neighboring ECG signal segments are extracted from the ECG recording to form a single ECG signal. Sliding segmentation is then performed on each single ECG signal to form a segmented ECG signal.

[0135] Specifically, the process involves retrieving and locating time-stamped signal sites in complete electrocardiogram (ECG) recordings, defining the start and end boundaries of the target ECG signal segment, and identifying the target signal interval to be extracted. Based on the start and end boundaries of the target signal interval, signal data within the target signal interval is extracted from the ECG recordings to obtain the time-stamped target ECG signal segment. Subsequently, the starting interval of the neighboring ECG signal is defined forward from the starting boundary of the target ECG signal segment, and the ending interval of the neighboring ECG signal is defined backward from the ending boundary of the target ECG signal segment to identify the neighboring ECG signal interval to be extracted. Based on the defined neighboring ECG signal intervals, signal data within the neighboring ECG signal intervals is extracted from the ECG recordings to obtain the neighboring ECG signal segments surrounding the target ECG signal segment. Following the time sequence of ECG signals in the ECG recording data, the extracted target ECG signal segment is spliced ​​with neighboring ECG signal segments to form a continuous signal whole, constructing a single ECG signal segment. The sleep apnea label of the single ECG signal segment is set to be consistent with the sleep apnea label of the target ECG signal segment. Sliding segmentation parameters for the single ECG signal segment are configured, including the sliding direction of the segmentation operation, the signal length step distance for each slide, and the preset length specification of the segmented single signal segment. Based on the set sliding segmentation parameters, the segmentation operation is performed from the starting boundary of the single ECG signal segment, and the segmentation boundary is moved step by step according to the set step distance to segment the single ECG signal segment by segment, generating multiple sets of independent signals. The multiple sets of independent signals generated after sliding segmentation are sorted and each segment is assigned a unique sequence identifier, and the ECG segmented signal is output.

[0136] The target ECG signal is obtained by filtering the segmented ECG signal. Specifically, filtering is performed on each segment of the acquired ECG signal to remove redundant interference components and generate the target analysis signal. During the filtering process, several sampling points are extended at both ends of each segment using a mirror-symmetric method. A third-order Butterworth zero-phase filter with a preset cutoff frequency is used to filter the extended segment. The filled region formed by the extension is trimmed to avoid phase distortion.

[0137] The target electrocardiogram (ECG) signal is subjected to R-peak identification, the RR interval between two adjacent R-peaks is calculated, and the voltage amplitude of the ECG signal at the R-peak position is obtained as the R-peak amplitude. Based on the RR interval, the RR interval is converted into an instantaneous heart rate sequence. The heart rate sequence is resampled, and the non-uniform sampling points after resampling are interpolated to obtain a continuous and equally spaced heart rate curve. The signal of the respiratory-related frequency band is extracted by filtering as the ECG-derived respiratory signal. The RR interval, R-peak amplitude, and ECG-derived respiratory signal are spliced ​​together to form a multi-channel feature as a sleep apnea recognition dataset.

[0138] In another embodiment, the model is trained and evaluated using a sleep apnea recognition dataset through cross-validation, specifically including the following steps.

[0139] Step S301: Split the sleep apnea recognition dataset and divide it into multiple equal-sized subsets. Determine a portion of the subsets as training data for model training and the remaining subsets as test data for model performance verification.

[0140] Step S302: Configure the parameters required for model training, set the data batch processing scale and initial learning rate, and dynamically adjust the learning rate and early stop strategy based on the loss changes during the validation process; select a suitable optimizer and loss function; train the ECG signal spatiotemporal feature analysis model based on the training data, and obtain the trained model by iteratively optimizing the internal parameters of the model by minimizing the loss function.

[0141] In step S303, according to the preset dataset partitioning rules, the subsets used as test data are changed one by one, and the model training and testing process is repeated to evaluate the model performance.

[0142] Step S304: Calculate the classification performance index of the model based on the model prediction results output by each test process; perform statistical averaging on the performance index obtained from multiple tests to obtain the final comprehensive evaluation result of the model.

[0143] In another embodiment, the sleep apnea recognition dataset is divided into five equal-sized subsets, four of which are used to train the model, and the remaining subset is used to test the model. The batch size is set to 128, the initial learning rate is set to 1e-3, and the learning rate and early apnea are dynamically adjusted based on the monitoring validator loss. ADAM is used as the optimizer, and cross-entropy is used as the loss function. The loss function is minimized to optimize all parameters in the MSTF-Net model, resulting in the optimal classification model for classifying sleep apnea. Following the aforementioned dataset partitioning method, a different subset is selected as the test set each time, and the rest are used as the training set, repeated five times. Finally, the average of the five performance evaluation results is taken to obtain the final evaluation result. Accuracy is used as the evaluation metric, and the accuracy calculation formula is as follows:

[0144]

[0145] Wherein, TP represents the number of true positives, FP represents the number of false positives, FN represents the number of false negatives, and TN represents the number of true negatives.

[0146] In this embodiment, as shown in the appendix Figure 6 As shown, a sleep apnea detection system based on electrocardiogram signals is also disclosed, including:

[0147] The feature extraction module is configured to acquire the target electrocardiogram (ECG) signal to be analyzed, identify the R-peak of the target ECG signal, calculate the RR interval between two adjacent R-peaks, and acquire the voltage amplitude of the ECG signal at the R-peak position as the R-peak amplitude.

[0148] The feature parsing module is configured to convert the RR interval into an instantaneous heart rate sequence based on the RR interval, perform a resampling operation on the heart rate sequence, perform interpolation processing on the non-uniform sampling points after resampling to obtain a continuous and equally spaced heart rate curve, extract the signal of the respiratory-related frequency band by filtering as the ECG-derived respiratory signal, and splice the RR interval, R peak amplitude and ECG-derived respiratory signal to form a multi-channel feature.

[0149] A state discrimination module is configured to input the multi-channel features into a trained sleep breathing detection model to obtain sleep apnea state judgment information.

[0150] In this embodiment, the feature parsing module is configured as a positioning and identification module, which is configured to detect the QRS complex of the target ECG signal based on the steepness characteristics of the absolute gradient of the ECG signal, locate the local maximum value of the QRS complex, and identify the R peak.

[0151] The feature peak analysis module is configured to calculate the time interval between two adjacent R peaks based on the identified R peaks, the time interval being the RR interval, and simultaneously acquire the voltage amplitude of the electrocardiogram signal at the R peak position as the R peak amplitude.

[0152] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. Regarding the sleep apnea detection system based on electrocardiogram signals disclosed in the embodiments, since it corresponds to the sleep apnea detection method based on electrocardiogram signals disclosed in the embodiments, the description is relatively simple, and relevant parts can be referred to the method section.

[0153] In other embodiments, a sleep apnea detection device based on electrocardiogram signals is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the various steps of the sleep apnea detection method based on electrocardiogram signals as described in the above embodiments.

[0154] If the aforementioned sleep apnea detection system based on electrocardiogram (ECG) signals is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various embodiments of the sleep apnea detection method based on ECG signals described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

[0156] In summary, the above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be covered by the present invention.

Claims

1. A method for detecting sleep apnea based on electrocardiogram signals, characterized in that, Includes the following steps: The target electrocardiogram (ECG) signal to be analyzed is acquired, R-peaks are identified in the target ECG signal, the RR interval between two adjacent R-peaks is calculated, and the voltage amplitude of the ECG signal at the R-peak position is obtained as the R-peak amplitude. Based on the RR interval, the RR interval is converted into an instantaneous heart rate sequence. The heart rate sequence is resampled, and the non-uniform sampling points after resampling are interpolated to obtain a continuous and equally spaced heart rate curve. The signal of the respiratory-related frequency band is extracted by filtering as the ECG-derived respiratory signal. The RR interval, R peak amplitude and ECG-derived respiratory signal are spliced ​​together to form a multi-channel feature. The multi-channel features are input into the trained sleep breathing detection model to obtain sleep apnea state judgment information.

2. The sleep apnea detection method based on electrocardiogram signals according to claim 1, characterized in that, The steps of acquiring the target electrocardiogram (ECG) signal to be analyzed, identifying the R-peak of the target ECG signal, calculating the RR interval between two adjacent R-peaks, and obtaining the voltage amplitude of the ECG signal at the R-peak position as the R-peak amplitude include: Based on the steepness characteristics of the absolute gradient of the ECG signal, the QRS complex of the target ECG signal is detected, the local maximum value of the QRS complex is located, and the R peak is identified. Based on the identified R peak, the time interval between two adjacent R peaks is calculated. The time interval is the RR interval. At the same time, the voltage amplitude of the electrocardiogram at the R peak position is obtained as the R peak amplitude.

3. The sleep apnea detection method based on electrocardiogram signals according to claim 2, characterized in that, The method of detecting the QRS complex of the target ECG signal based on the steepness characteristics of the absolute gradient of the ECG signal, locating the local maximum value of the QRS complex, and identifying the R peak includes: Calculate the gradient value corresponding to each sampling point in the target electrocardiogram signal, and perform absolute value operation on the gradient value to obtain the absolute gradient; The smoothed gradient is obtained by smoothing the absolute gradient using a uniform filter with a first window size, and the average gradient is obtained by averaging the smoothed gradient using a uniform filter with a second window size. Based on the relationship between the average gradient and the preset gradient threshold, the signal location where the average gradient exceeds the preset gradient threshold is determined, and potential QRS groups are identified based on the signal location. Exclude potential QRS groups whose width does not meet the preset width standard, and locate the local maximum value in the remaining potential QRS groups that meet the width requirement as candidate R peaks; Each candidate R-peak is judged for its interval compliance. Potential R-peaks whose interval with the previous adjacent R-peak that has passed the judgment does not reach the preset interval are discarded, and the remaining candidate R-peaks are used as the determined R-peaks of the target ECG signal.

4. The sleep apnea detection method based on electrocardiogram signals according to claim 3, characterized in that, The process involves converting the RR interval into an instantaneous heart rate sequence, performing resampling on the heart rate sequence, interpolating the non-uniform sampling points after resampling to obtain a continuous, equally spaced heart rate curve, and extracting signals related to respiratory frequency bands as ECG-derived respiratory signals through filtering. The process of splicing the RR interval, R-peak amplitude, and ECG-derived respiratory signals to form a multi-channel feature includes: The calculated RR intervals are converted into instantaneous heart rate sequences, and the instantaneous heart rate value corresponding to each RR interval is calculated by combining the ratio of sampling frequency to RR interval with a fixed time coefficient. A reference frequency for respiratory analysis is set, and a scaling factor is determined based on the ratio between the reference frequency and the sampling frequency. The instantaneous heart rate sequence is then subjected to a second sampling operation according to the scaling factor to obtain a resampled heart rate sequence. The original R peak position is mapped to the resampled time axis according to the above scaling factor to generate an index sequence corresponding to the resampled sequence. On the resampling time axis, the piecewise cubic spline interpolation method is used to interpolate the resampled heart rate sequence for the non-uniform sampling points corresponding to the index sequence, so as to obtain a continuous and equally spaced heart rate curve. The obtained heart rate curve is input into a zero-phase IIR bandpass filter to extract signals in the frequency bands related to respiratory activity, thus obtaining an electrocardiogram-derived respiratory signal.

5. The sleep apnea detection method based on electrocardiogram signals according to claim 4, characterized in that, The process of converting the RR interval into an instantaneous heart rate sequence based on the RR interval, performing a resampling operation on the heart rate sequence, interpolating the non-uniform sampling points after resampling to obtain a continuous, equally spaced heart rate curve, and extracting signals related to respiratory frequency bands as ECG-derived respiratory signals through filtering; and splicing the RR interval, R-peak amplitude, and ECG-derived respiratory signals to form a multi-channel feature also includes: Z-score standardization was performed on the RR interval sequence, R peak amplitude sequence, and ECG-derived respiratory signal, respectively. The Z-score standardization process includes calculating the mean and standard deviation of each signal and eliminating the dimensional differences between different signals by dividing the difference between the original signal value and the mean by the standard deviation. The cubic spline interpolation method was used to interpolate the three signals after Z-score normalization, and the number of sampling points for the three signals was adjusted. The interpolated RR interval sequence, R peak amplitude sequence, and ECG-derived respiratory signal are spliced ​​together to form a multi-channel feature.

6. The sleep apnea detection method based on electrocardiogram signals according to claim 5, characterized in that, The sleep breathing detection model includes: A dual-branch multi-scale feature extraction module is configured to construct a dual-branch architecture containing an ECG signal branch and an ECG-derived respiratory signal branch, using the formed multi-channel features as input. Each branch is configured with an enhanced one-dimensional convolutional component, which integrates convolutional layers, a multi-scale temporal pyramid, and a cross-modal interactive attention mechanism. Specifically, features are initially extracted through the convolutional layers, and these features are then input into the multi-scale temporal pyramid for parallel convolutional processing at different time scales. The cross-modal interactive attention mechanism explicitly models the inter-modal dependencies between the R-peak interval, R-peak amplitude, and each channel of the ECG-derived respiratory signal, and learns collaborative representations between modalities. Max pooling layers are used to downsample the features, and Dropout layers are applied for further processing. After all enhanced one-dimensional convolutional modules have completed execution, the spatiotemporal-channel interactive features of the multi-channel signals are extracted. An adaptive weight fusion module is configured to receive multi-channel spatiotemporal-channel interactive features output by a dual-branch multi-scale feature extraction module, construct a dynamic weight calculation mechanism based on feature representation quality and modal contribution, constrain weight values ​​within a preset range through an activation function, and analyze the reliability and modal synergy of ECG signal branches and ECG-derived respiratory signal branches in real time through the mechanism, generating adaptive weights for each branch feature that are adapted to the current data distribution; after weighted fusion of each branch feature with the corresponding adaptive weights, a fused feature is obtained, and a comprehensive feature representation is output. A temporal dependency modeling module is configured to receive the comprehensive feature representation output by the adaptive weight fusion module. It performs layer normalization on the fused features using a temporal processing structure containing Transformer encoding blocks and a temporal recurrent neural network. The processed features are then element-wise added to the temporal position encoding, carrying temporal position information. The features carrying temporal position information are input into an attention mechanism to calculate feature attention weights. After residual connections and layer normalization, the Transformer-processed features are output through a feedforward network. Finally, the features are input into a bidirectional temporal recurrent neural network to capture long-term temporal dependencies, outputting temporally enhanced comprehensive features. An adaptive feature fusion module is configured to receive temporally enhanced comprehensive features output by a temporal dependency modeling module, calculate the importance score of each time step of the sequence corresponding to the temporally enhanced comprehensive features through a temporal attention mechanism, and adaptively focus on features at key time points; a dynamic feature selection component is configured to generate channel weight vectors based on the characteristics of the input sequence, achieve soft selection of feature dimensions through an activation function, highlight discriminative features related to sleep apnea, and output a weighted feature sequence; The classification output module is configured to receive the weighted feature sequence output by the adaptive feature fusion module and perform a global average pooling operation on it to compress the temporal dimension into a single feature vector; the single feature vector is then sequentially input into a fully connected layer for feature transformation and dimension mapping, and the model output value is converted into a probability distribution through an activation function.

7. A sleep apnea detection system based on electrocardiogram signals, characterized in that, include: The feature extraction module is configured to acquire the target electrocardiogram signal to be analyzed, identify the R-peak of the target electrocardiogram signal, calculate the RR interval between two adjacent R-peaks, and acquire the voltage amplitude of the electrocardiogram signal at the R-peak position as the R-peak amplitude. The feature parsing module is configured to convert the RR interval into an instantaneous heart rate sequence based on the RR interval, perform a resampling operation on the heart rate sequence, interpolate the non-uniform sampling points after resampling to obtain a continuous and equally spaced heart rate curve, and extract the signal of the respiratory-related frequency band as the ECG-derived respiratory signal through filtering; and splice the RR interval, R peak amplitude and ECG-derived respiratory signal to form a multi-channel feature. A state discrimination module is configured to input the multi-channel features into a trained sleep breathing detection model to obtain sleep apnea state judgment information.

8. The sleep apnea detection system based on electrocardiogram signals according to claim 7, characterized in that, The feature parsing module includes: The positioning and recognition module is configured to detect the QRS complex of the target ECG signal based on the steepness characteristics of the absolute gradient of the ECG signal, locate the local maximum value of the QRS complex and identify the R peak. The feature peak analysis module is configured to calculate the time interval between two adjacent R peaks based on the identified R peaks, the time interval being the RR interval, and simultaneously acquire the voltage amplitude of the electrocardiogram signal at the R peak position as the R peak amplitude.

9. A sleep apnea detection device based on electrocardiogram signals, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1-6.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it follows the steps of the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Measurement method for detecting sleep apnoea with ECG signal

    CN101496716A

  • Sleep staging method based on electrocardiogram signals

    CN109770892A

  • Method for extracting respiration signal and respiration frequency from wearable electrocardio

    CN110327036A

  • QRS wave group detection method, electrocardiogram detection device and readable storage medium

    CN113499082A

  • Cardiopulmonary coupling feature extraction method and system based on synchronous extrusion transformation

    CN115630290A

Cited By

  • A method and system for calculating respiratory rate based on rr intervals

    CN122208121A

  • A method and system for calculating respiratory rate based on RR intervals

    CN122208121B