A multi-scale medical prior-guided sleep apnea detection method

CN122642841APending Publication Date: 2026-08-28SOUTHWEST JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610844441.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-11
Publication Date
2026-08-28

AI Technical Summary

Technical Problem

[0004]本申请实施例的目的是提供一种多尺度医学先验引导的睡眠呼吸暂停检测方法,能够解决相关技术中检测结果的准确性较低的问题

Benefits of technology

[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the multi-scale medical prior-guided sleep apnea detection method as described in the first aspect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122642841A_ABST
    Figure CN122642841A_ABST
Patent Text Reader

Abstract

The application discloses a sleep apnea detection method guided by multiscale medical prior, and belongs to the technical field of computers. The method introduces a multiscale time domain encoder to extract feature information at different time scales for different physiological characteristics, so as to overcome the defects of a single receptive field; a time sequence network guided by medical prior is introduced to take statistical characteristics of different patient individuals as a medical prior guiding condition, so as to consider static medical prior information of different patient individuals; a multi-view pooling and joint feature classification module is introduced to aggregate a time sequence hidden state feature matrix based on a multi-view pooling mechanism; and a hidden Markov decoding module is introduced to correct classification probabilities at continuous time steps according to real sleep apnea state transition priors. Therefore, the accuracy of sleep apnea detection results can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer technology, specifically relating to a multi-scale medical prior-guided method for detecting sleep apnea. Background Technology

[0002] Traditional sleep apnea (SA) detection relies on polysomnography, but this technology suffers from drawbacks such as high equipment costs, cumbersome operation, and severe disruption to patients' normal sleep. In contrast, automated SA detection technology based on single-lead electrocardiography (ECG) has become a research hotspot in the field of medical artificial intelligence due to its advantages such as convenient signal acquisition and natural compatibility with wearable devices.

[0003] In related technologies, deep learning methods have achieved good performance in ECG-based SA detection tasks. However, current deep learning methods (such as bandpass filtering and standardization of raw ECG signals, followed by automatic feature extraction and classification using convolutional neural networks (CNNs)) are often limited by a single receptive field, making it difficult to fully explore multi-scale physiological features. Furthermore, they ignore the static medical prior information of individual patients and the temporal continuity of physiological state evolution, which can easily lead to state jumps that do not conform to physiological common sense, resulting in low accuracy of detection results. Summary of the Invention

[0004] The purpose of this application is to provide a multi-scale medical prior-guided sleep apnea detection method that can solve the problem of low accuracy of detection results in related technologies.

[0005] To solve the above-mentioned technical problems, this application is implemented as follows: In a first aspect, embodiments of this application provide a multi-scale medical prior-guided sleep apnea detection method, applied to a sleep apnea detection model. The model includes a data preprocessing module, a multi-scale temporal encoder, a medical prior-guided temporal network, a multi-view pooling and joint feature classification module, and a hidden Markov decoding module. The method includes: The data preprocessing module, in response to receiving the patient's raw electrocardiogram signal and demographic information, extracts physiological features under multiple preset dimensions from the raw electrocardiogram signal and processes the patient's demographic information into scaled statistical features. The multi-scale temporal encoder is based on multi-scale convolution to extract feature information at different time scales from physiological features under multiple preset dimensions. The medical prior-guided temporal network uses the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, and obtains a temporal hidden state feature matrix to characterize medical priors and global context. The multi-view pooling and joint feature classification module is based on the multi-view pooling mechanism, which aggregates the temporal hidden state feature matrix into a multi-view temporal representation, and generates the classification probability at continuous time steps based on the multi-view temporal representation and the scaled statistical features. The Hidden Markov Model (HMM) decoding module corrects the classification probability at continuous time steps based on the prior knowledge of the actual sleep apnea state, thereby obtaining the detection result of sleep apnea.

[0006] Secondly, embodiments of this application provide a sleep apnea detection model, the model comprising: The data preprocessing module is configured to, in response to receiving the patient’s raw electrocardiogram signal and demographic information, extract physiological features under multiple preset dimensions from the raw electrocardiogram signal and process the patient’s demographic information into scaled statistical features. The multi-scale temporal encoder is configured to extract feature information at different time scales from physiological features under multiple preset dimensions based on multi-scale convolution. The medical prior-guided temporal network is configured to use the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, and obtain a temporal hidden state feature matrix to characterize the medical prior and the global context. The multi-view pooling and joint feature classification module is configured to aggregate the temporal hidden state feature matrix into a multi-view temporal representation based on the multi-view pooling mechanism, and generate classification probabilities at continuous time steps based on the multi-view temporal representation and the scaled statistical features. The Hidden Markov Model (HMM) decoding module is configured to correct the classification probability at continuous time steps based on the prior of the actual sleep apnea state, so as to obtain the detection result of sleep apnea.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the multi-scale medical prior-guided sleep apnea detection method as described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the multi-scale medical prior-guided sleep apnea detection method as described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the multi-scale medical prior-guided sleep apnea detection method as described in the first aspect.

[0010] In this application embodiment, a hypothetical sleep apnea (SA) detection framework jointly proposed by a medical prior-guided multi-scale temporal network and a global temporal decoder is presented. The multi-scale temporal encoder extracts feature information at different time scales for different physiological characteristics to overcome the limitations of a single receptive field and fully mine multi-scale physiological feature information. The medical prior-guided temporal network uses statistical characteristics of different individual patients as medical prior guidance conditions to consider the static medical prior information of different individual patients. Based on this, the network dynamically guides long-range temporal modeling under the physiological baseline of different individual patients, obtaining a temporal hidden state feature matrix that accurately represents the medical prior and global context. The multi-view pooling and joint feature classification module aggregates the temporal hidden state feature matrix based on the multi-view pooling mechanism, reducing the probability of losing important information. The hidden Markov decoding module corrects the classification probability at continuous time steps based on the true sleep apnea state transition prior, thereby correcting state jumps that do not conform to physiological common sense based on the temporal continuity of physiological state evolution. Therefore, the accuracy of sleep apnea detection results can be effectively improved. Attached Figure Description

[0011] Figure 1 A flowchart illustrating the implementation of a multi-scale medical prior-guided sleep apnea detection method provided in this application embodiment; Figure 2 A schematic diagram of a sleep apnea detection model provided in an embodiment of this application; Figure 3 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0014] The following description, in conjunction with the accompanying drawings, details a multi-scale medical prior-guided sleep apnea detection method provided in this application through specific embodiments and application scenarios.

[0015] See Figure 1 The diagram shows an implementation flowchart of a multi-scale medical prior-guided sleep apnea detection method provided in this application. The multi-scale medical prior-guided sleep apnea detection method is applied to a sleep apnea detection model, which includes a data preprocessing module, a multi-scale temporal encoder, a medical prior-guided temporal network, a multi-view pooling and joint feature classification module, and a hidden Markov decoding module. The method may include the following steps: Step S101: In response to receiving the patient's original electrocardiogram signal and demographic information, the data preprocessing module extracts physiological features under multiple preset dimensions from the original electrocardiogram signal and processes the patient's demographic information into scaled statistical features.

[0016] In this embodiment, considering that the raw electrocardiogram (ECG) signal (i.e., the raw ECG waveform) often has problems such as baseline drift and high-frequency electromyography interference, directly using it as the input of the multi-scale time-domain encoder may cause noise overfitting. Therefore, this application introduces a data preprocessing module to preprocess the raw ECG signal into physiological features under multiple preset dimensions, such as RR interval (RRI), ECG-derived respiration (EDR), and respiratory amplitude envelope (RAMP), which are highly clinically interpretable physiological features. These physiological features are then used as the input of the multi-scale time-domain encoder.

[0017] See Figure 2The diagram illustrates a sleep apnea detection model. To accurately locate heartbeat events, the data preprocessing module utilizes a zero-phase bandpass filter to remove low-frequency interference and high-frequency noise, and enhances the QRS complex characteristics. Subsequently, algorithms such as Pan-Tompkins can be combined to complete R-peak detection and position correction.

[0018] Based on the detected R peaks, the data preprocessing module can calculate physiological characteristics across multiple preset dimensions. For example, the data preprocessing module can calculate the time interval between adjacent R peaks to obtain an RRI sequence reflecting heart rate variability. Simultaneously, the data preprocessing module can extract the amplitude of the corresponding R peak and filter out high-frequency modulation components using a bandpass filter to obtain the ECG-derived respiratory sequence. To intuitively quantify the attenuation of respiratory airflow intensity, the data preprocessing module can perform frequency domain analysis on the EDR signal to extract the respiratory amplitude envelope. :

[0019] Where t represents the current time step, and H{·} represents the Hilbert transform operation.

[0020] As one possible implementation, after extracting physiological features across multiple preset dimensions (such as the three sets of physiological features mentioned above), the data preprocessing module extracts feature sequences one minute before and after the current prediction time, constructing a local context window with a total length of 180 seconds. Within each independent window, cubic spline interpolation is used to uniformly resample each sequence to 4Hz, resulting in a feature sequence of length 720 (for example, the three sets of physiological features mentioned above can be denoted as...). To mitigate the distributional differences in baseline heart rate, respiratory amplitude, etc., among different patients, the data preprocessing module can preprocess physiological characteristics (e.g., ...) across multiple preset dimensions after interpolation and alignment. Perform Z-Score standardization separately, for example:

[0021] in, Let represent any sequence to be normalized, where µ and σ represent the mean and standard deviation of the corresponding sequence within a 180-second window, respectively. The data preprocessing module stacks the three normalized sequences along the channel dimension to form a feature matrix, which serves as the input to the multi-scale temporal encoder. :

[0022] Furthermore, considering that sleep apnea is closely related to the individual physiological characteristics of patients, this application introduces demographic information such as age, gender, height, and weight as prior medical knowledge of the patients. Moreover, to reduce the impact of different physical dimensions on network stability, a data preprocessing module is designed to pre-scale this information using constants that conform to real-world physical meanings, such as physical scale normalization, to obtain scaled statistical characteristics. :

[0023] in, These represent the patient's original age, gender, height, and weight, respectively.

[0024] Step S102: The multi-scale temporal encoder extracts feature information at different time scales from physiological features under multiple preset dimensions based on multi-scale convolution.

[0025] In this embodiment, considering that different physiological characteristics (such as RR interval, ECG-derived respiration, and respiratory amplitude envelope) typically exhibit significant differences across time scales, traditional single-scale convolution is insufficient to simultaneously capture feature information at different time scales. Therefore, this application introduces a multi-scale temporal encoder with different receptive fields to enhance the model's ability to model different physiological characteristics based on multi-scale convolution (e.g., using parallel residual branches constructed from convolutional kernels of different sizes). This enables effective feature extraction, allowing the model to capture both fine-grained local mutations and macroscopic physiological rhythms.

[0026] Step S103: The medical prior-guided temporal network uses the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, and obtains a temporal hidden state feature matrix to represent medical priors and global context.

[0027] In this embodiment, considering that the state of sleep apnea evolves continuously, relying solely on local features is insufficient to fully model the long-range temporal dependencies of the sequence. Therefore, this application introduces a medically guided temporal network. After the multi-scale temporal encoder completes the extraction of local temporal features, it uses the patient's demographic information as a medically guided condition to guide the temporal network (such as a bidirectional long short-term memory network (Bi-LSTM)) to model the global temporal dependencies under different individual physiological baselines.

[0028] Step S104: The multi-view pooling and joint feature classification module aggregates the temporal hidden state feature matrix into a multi-view temporal representation based on the multi-view pooling mechanism, and generates the classification probability at continuous time steps according to the multi-view temporal representation and the scaled statistical features.

[0029] In this embodiment, considering that sleep apnea not only manifests as instantaneous physiological abnormalities but also reflects changes in the average distribution of the entire signal, traditional methods typically extract only the latent state of the last time step as a global representation, which easily leads to the loss of important information such as key abnormal features and overall baseline information in the sequence. Therefore, this application introduces a multi-view pooling and joint feature classification module to aggregate temporal sequence information based on a multi-view pooling mechanism.

[0030] Furthermore, to prevent information decay of patients' global statistical signs in long-term time-series modeling, this application designs a multi-view pooling and joint feature classification module to further combine scaled statistical features to generate classification probabilities (such as the prediction probability of whether it is sleep apnea), and enables the multi-view pooling and joint feature classification module to generate classification probabilities at continuous time steps, so as to provide support for subsequent hidden Markov decoding (and the loss function design in the training phase below).

[0031] Step S105: The Hidden Markov Model (HMM) decoding module corrects the classification probability at continuous time steps based on the prior of the actual sleep apnea state transition, and obtains the detection result of sleep apnea.

[0032] In this embodiment, while deep neural networks can effectively extract local temporal features and output classification probabilities, this time-step independent prediction method lacks explicit constraints on the global state transition patterns. Sleep apnea is a continuously evolving state, with very few frequent jumps between normal and apnea states occurring within a short period.

[0033] To correct potential prediction jitter in neural networks across continuous time steps, this application introduces a Hidden Markov Model (HMM) decoding module. This module incorporates an HMM during the inference phase to correct the classification probabilities generated by the network at continuous time steps. For example, the HMM decoding module can combine the classification probabilities of the neural network with the actual sequence transition patterns based on the HMM. It uses the Viterbi algorithm to search for the optimal state transition path across the global sequence, correcting state jumps in the classification probabilities that do not conform to physiological common sense at continuous time steps. This results in a detection label sequence that is temporally smooth and strictly conforms to physiological continuity as the detection result.

[0034] As can be seen from the above technical solutions, this application proposes an SA detection framework jointly based on a medical prior-guided multi-scale temporal network and global temporal decoding. The multi-scale temporal encoder extracts feature information at different time scales for different physiological characteristics to overcome the limitations of a single receptive field and fully mine multi-scale physiological feature information. The medical prior-guided temporal network uses the statistical characteristics of different patients as medical prior guidance conditions to consider the static medical prior information of different patients, and then dynamically guides the network to perform long-range temporal modeling under the physiological baseline of different patients, obtaining a temporal hidden state feature matrix that accurately represents the medical prior and global context. The multi-view pooling and joint feature classification module aggregates the temporal hidden state feature matrix based on the multi-view pooling mechanism, which can reduce the probability of losing important information. The hidden Markov decoding module corrects the classification probability at continuous time steps based on the real sleep apnea state transition prior, thereby correcting state jumps that do not conform to physiological common sense based on the temporal continuity of physiological state evolution. Therefore, the accuracy of sleep apnea detection results can be effectively improved.

[0035] In some embodiments, the physiological features under the multiple preset dimensions include the RR interval, ECG-derived respiration, and respiratory amplitude envelope; the multi-scale temporal encoder, based on multi-scale convolution, extracts feature information at different time scales from the physiological features under the multiple preset dimensions, including: The multi-scale time-domain encoder processes the physiological features under the multiple preset dimensions into a first feature branch and a second feature branch in the channel dimension. The first feature branch includes ECG interval features composed of a single-channel RR interval sequence, and the second feature branch includes ECG-derived respiration and dual-channel respiratory-related features formed by stacking respiratory amplitude envelopes along the channels. The multi-scale temporal encoder uses a first branch network to extract various short-term local heart rate variability features from the first feature branch. The multi-scale temporal encoder uses a second branch network to extract macroscopic breathing features of each long period from the second feature branch. The first branch network and the second branch network are constructed based on convolutional kernels, and each convolutional kernel in the first branch network is smaller than each convolutional kernel in the second branch network. The multi-scale temporal encoder uses convolutional layers to perform cross-modal fusion of the heart rate variability features of each short time period and the macroscopic respiratory features of each long period, to obtain a feature matrix that characterizes the feature information at different time scales.

[0036] In this embodiment, to address the problem that traditional single-scale convolution struggles to handle the significant differences in RR intervals, ECG-derived respiration, and respiratory amplitude envelope across time scales, thus making it difficult to simultaneously capture short-term heart rate fluctuations and long-term respiratory rhythm changes, this application designs a multi-scale temporal encoder. First, in the channel dimension, it integrates the feature information (such as feature matrices) output from the preprocessing stage at different time scales. The feature branches are divided into two groups: one group consists of ECG interval features composed of single-channel RRI sequences. Another group consists of dual-channel respiratory features formed by the stacking of EDR and RAMP along the channels. ,For example:

[0037] in, and These represent the standardized EDR and RAMP sequences, respectively.

[0038] To address the two sets of features mentioned above, the multi-scale temporal encoder constructed the first and second branch networks using convolutional kernels of different sizes. This was done to use smaller convolutional kernels to enhance the model's ability to perceive local rhythm abnormalities and short-term heart rate changes, and to use larger convolutional kernels to enable the model to capture prolonged respiratory stasis and macroscopic envelope decay.

[0039] Subsequently, in order to achieve cross-modal feature interaction, the multi-scale temporal encoder can concatenate the deep features extracted by each branch network along the channel dimension, and then achieve cross-modal fusion through convolutional layers to obtain the fused feature matrix.

[0040] Optionally, the short-term local heart rate variability and the long-term macroscopic respiratory characteristics are determined by the following formula:

[0041]

[0042] in, This represents the short-term local heart rate variability associated with a convolutional kernel of size k. ResBlock represents the long-period macroscopic breathing characteristics associated with a convolutional kernel of size k. k,s (·) represents a one-dimensional residual convolution block with kernel size k and stride s, and MaxPool(·) represents the max pooling operation. Indicates the first feature branch. This indicates the second feature branch.

[0043] In this embodiment of the application, the first branch network and the second branch network are constructed based on four parallel residual branches.

[0044] Specifically, for high-frequency ECG interval characteristics Using a smaller convolution kernel ( This enhances the model's ability to perceive local rhythm abnormalities and short-term heart rate changes, resulting in the extraction of deep electrocardiogram features. For low-frequency respiratory-related features Using a larger convolution kernel ( This method captures prolonged respiratory stagnation and macroscopic envelope decay to extract deep respiratory features. .

[0045] Subsequently, the multi-scale temporal encoder concatenates the deep features extracted by the four parallel residual branches along the channel dimension, and then achieves cross-modal fusion through convolutional layers to obtain the following fused feature matrix. :

[0046] Wherein, Concat[·] represents the splicing operation along the channel dimension, and Fusion(·) represents a deep fusion network based on a one-dimensional convolutional layer (such as a network consisting of a one-dimensional convolution with a kernel size of 3, batch normalization, and a non-linear activation function).

[0047] In some embodiments, the medical prior-guided temporal network uses the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, obtaining a temporal hidden state feature matrix representing the medical prior and global context, including: The medical prior-guided temporal network generates initial hidden states and initial cell states respectively using independent linear mapping layers based on the scaled statistical features. The medical prior-guided temporal network utilizes a bidirectional long short-term memory network to perform global context modeling on the feature information at different time scales, obtaining the complete hidden state at each time step. The initial states of the forward and backward networks in the bidirectional long short-term memory network are determined based on the initial hidden state and the initial cell state. The medical prior-guided temporal network constructs a feature matrix based on the complete hidden states of each time step, thus obtaining the temporal hidden state feature matrix.

[0048] In this embodiment, the medical prior-guided temporal network utilizes Bi-LSTM to model global temporal dependencies. Meanwhile, considering that traditional recurrent neural networks typically initialize their hidden states with zero vectors, this can lead to the model ignoring individual differences among different patients.

[0049] To address the aforementioned issues, this application designs a medical prior-guided temporal network that uses previously extracted statistical features as global medical prior knowledge. Through independent linear mapping layers, it dynamically generates initial hidden states for the Bi-LSTM. With cell state The aforementioned process can be represented as follows:

[0050] in, and These represent the learnable weight matrix and bias vector of the corresponding linear mapping layer, respectively.

[0051] Understandably, this medically-guided initialization strategy allows the temporal network to incorporate the patient's current physiological information before processing dynamic sequences, thereby enhancing the model's adaptability to individual differences among patients.

[0052] After completing state initialization, the medical prior-guided temporal network will integrate feature information from different time scales, such as the aforementioned fused feature matrix. The time step dimension is considered as a feature sequence of length T, i.e. Subsequently, the sequence is fed into a Bi-LSTM for global context modeling to obtain the complete hidden states over T time steps. The feature matrix formed by these hidden states is then used as the temporal hidden state feature matrix. For example, the temporal hidden state feature matrix... , This represents the complete hidden state at time step t.

[0053] Optionally, the complete hidden state at each time step is determined by the following formula:

[0054]

[0055] in, Represents the complete hidden state at time step t. This represents the hidden state of the forward and backward networks in the corresponding directions at time step t. This represents the cell state in the corresponding direction of the output of the forward and backward networks at time step t. and This represents the forward and backward Long Short-Term Memory (LSTM) network update operators. and This represents the historical state of the forward network at time step t-1 and the backward network at time step t+1. The fusion features at time step t (e.g.) The t-th component), the fusion features of each time step are determined based on the feature information under different time scales, and Concat[·] represents the splicing operation along the channel dimension.

[0056] In this embodiment of the application, the initial state generated based on medical priors is... Assign values ​​to the initial state of the feedforward network. The initial state of the backward network Then, at any time step t, the forward and backward networks read the current input and step state respectively, and calculate the hidden state in the corresponding output direction. With cell state Subsequently, the forward and backward hidden state sequences are concatenated along the feature dimension to obtain the complete hidden state at the current time step t. .

[0057] In some embodiments, the multi-view pooling and joint feature classification module, based on a multi-view pooling mechanism, aggregates the temporal latent state feature matrix into a multi-view temporal representation, including: The multi-view pooling and joint feature classification module performs feature compression on the corresponding temporal hidden states in the temporal hidden state feature matrix based on three dimensions: extreme value capture, global average, and final state of the sequence, to obtain the max pooling vector, average pooling vector, and final hidden state vector. The multi-view pooling and joint feature classification module concatenates the max pooling vector, average pooling vector, and terminal hidden state vector along the feature dimension to obtain the multi-view temporal representation.

[0058] In this embodiment, after obtaining the temporal hidden state feature matrix containing medical priors and global context, the multi-view pooling and joint feature classification module combines the three dimensions of extreme value capture, global averaging and sequence final state to perform feature compression on the corresponding temporal hidden states, so as to aggregate the sequence information of the time dimension based on the multi-view pooling mechanism.

[0059] Specifically, max pooling vector It can capture the most significant transient pathological features in a sequence, achieving extreme value capture. Average pooling vector. It can characterize the overall trend and extract the macroscopic baseline state. (Terminal hidden state vector) The contextual information accumulated at the end of the sequence evolution is preserved. For example, the calculation process for the three vectors is as follows:

[0060] Where max(·) represents the global max pooling operation along the time dimension. , This represents the complete hidden state at time step t and time step T.

[0061] Then, by concatenating the feature vectors from these three perspectives along the feature dimensions, a multi-view temporal representation can be obtained. :

[0062] In some embodiments, the classification probabilities at consecutive time steps are represented using a two-dimensional joint prediction probability matrix, which is determined by the following formula:

[0063] in, represents the two-dimensional joint prediction probability matrix, Softmax(·) represents the Softmax activation function, Reshape(·) represents the tensor dimension transformation operation, and MLP(·) represents the multilayer perceptron (which can be composed of linear layers and ReLU activation functions). This represents the joint feature matrix determined based on the multi-view temporal representation and the scaled statistical features. This represents the classification probability at time steps t-1, t, and t+1.

[0064] In this embodiment, the multi-view pooling and joint feature classification module can convert statistical features... The data are fed into a multilayer perceptron for nonlinear mapping to obtain high-dimensional statistical features. and integrate it with multi-view temporal representation The features are concatenated to obtain the final joint feature matrix. The aforementioned process can be represented as follows:

[0065] MLP(·) represents a multilayer perceptron (which can be composed of linear layers and ReLU activation functions).

[0066] Then, the multi-view pooling and joint feature classification module will combine the joint feature matrix. The data is fed into a classification head composed of a multilayer sensing mechanism. It should be noted that, unlike traditional classification networks that only predict the state for the current single step length when calculating the final output, this application proposes a three-step joint prediction mechanism.

[0067] Specifically, the classification header of this application simultaneously outputs the current time step t and its two adjacent time steps (i.e., t0). The logical values ​​of 1 and t+1 are used, and the two-dimensional joint prediction probability matrix is ​​finally calculated by applying the Reshape and softmax activation functions. .

[0068] Therefore, explicitly constructing the three-step joint output space facilitates the design of subsequent loss functions and hidden Markov decoding, such as the classification probability at time t. It can not only be directly used in the calculation of subsequent cross-entropy loss, but also directly used as the emission probability for sequence decoding in subsequent Hidden Markov Models (HMMs). and This provides a direct comparison target for subsequent calculation of local temporal consistency loss.

[0069] In some embodiments, the Hidden Markov Modeling (HMM) module corrects the classification probability at consecutive time steps based on the actual sleep apnea state transition prior, to obtain the sleep apnea detection result, including: The Hidden Markov Model (HMM) decoding module, based on the prior knowledge of actual sleep apnea states, uses the following dynamic programming forward recursion formula to correct the classification probability at continuous time steps, thereby obtaining the sleep apnea detection result:

[0070]

[0071] in, and This represents the global maximum logarithmic probability and path pointer matrix at time step t and hidden state j. This represents the global maximum logarithmic probability at time step t-1 and in hidden state i. This represents the probability of transitioning from hidden state i to hidden state j in the state transition matrix. Let represent the emission probability at time step t and in hidden state j, and It is determined based on the j-th component of the vector between the true prior probability of sleep apnea state transition associated with latent state j and the predicted probability at time step t. This indicates that latent state i belongs to one of two discrete latent states: normal and sleep apnea.

[0072] In this embodiment of the application, based on the complete state label sequence provided by the training set, the initial prior probability π and the state transition matrix A of the Hidden Markov Model can be statistically analyzed directly through maximum likelihood estimation. This process can be represented as follows:

[0073] in, Both represent two discrete latent states: normal and apnea. N(·) represents the total number of times the event satisfying the conditions within the parentheses appears in the training set label sequence, i.e. The total number of samples in state s in the training set. This represents the total number of times a state transitions from state i to state j in adjacent time steps.

[0074] Considering that the emission probability B of the HMM needs to be dynamically calculated based on the input of the current time step, this application defines... This represents the patient's true physiological state at time step t. This represents the observed features (i.e., the actual physiological signal segments input to the network) corresponding to time step t. The emission probability required for HMM decoding is essentially the observation probability under the given state conditions. The classification probability directly output by the neural network classifier Belongs to posterior probability According to Bayes' theorem, the theoretical transformation relationship between the two can be expressed as:

[0075] To prevent numerical overflow and facilitate subsequent dynamic programming calculations, this application performs the aforementioned emission probability conversion process in logarithmic space. This is because the probability of the observation data itself... This is a constant that applies to all candidate paths and does not change the final ranking, therefore it can be directly omitted from the formula:

[0076] in, Let represent the s-th component of the predicted probability vector (i.e., classification probability) output by the neural network at time step t.

[0077] The Hidden Markov Model (HMM) decoding module employs dynamic programming to execute the Viterbi algorithm during the global sequence decoding stage. Specifically, it uses... Let i be the global maximum logarithmic probability at time step t and the current hidden state is j, where i represents the previous time step t. Let j represent the candidate hidden state at time step t, and let j represent the target hidden state at the current time step t. A path pointer matrix is ​​also defined. To record the previous state that maximizes the current probability, the Hidden Markov Model (HMM) decoding module uses the aforementioned dynamic programming forward recursion formula to correct the classification probabilities at consecutive time steps. During this process, the HMM decoding module, at time step t=1, uses... Initialization complete; after completing the forward derivation of the entire sequence, starting from the highest probability state at the last time step, use the path pointer matrix... By performing reverse backtracking, the globally optimal state sequence that conforms to the clinical physiological transition pattern (such as normal-normal-normal-sleep apnea-sleep apnea) is finally decoded as the model's final output.

[0078] In some embodiments, the joint optimization loss function used by the model during the training phase It is expressed as follows:

[0079]

[0080]

[0081] in, Indicates the primary classification loss. Represents local temporal consistency loss The weight hyperparameters, This represents the value of the true label at time step t in category c (e.g., 1 when c is the true label category, 0 otherwise). This represents the prediction probability vector at time step t. The probability components for category c (e.g., 0 for normal, 1 for sleep apnea), where T represents the total number of time steps. The KL divergence represents the distance between two probability distributions. , This represents the predicted probability vectors at time steps t-1 and t+1.

[0082] In the embodiments of this application, during the model training phase, in order to enable the model to not only accurately identify the current apnea event, but also to learn the state continuity within the local time window, this application proposes a joint optimization objective that combines the main classification error and the local temporal consistency constraint.

[0083] Specifically, the standard cross-entropy loss is used to measure the difference between the model's predicted probability distribution at all time steps and the true label, thus obtaining the main classification loss. Meanwhile, to constrain the smoothness between prediction results at adjacent time steps, a local temporal consistency loss based on KL divergence is introduced. Finally, the primary classification loss... Local temporal consistency loss By performing a weighted combination, the joint optimization loss function of the model can be obtained. .

[0084] As one possible implementation method, such as Figure 2 As shown, during the training phase, the data preprocessing module, multi-scale temporal encoder, medical prior-guided temporal network, and multi-view pooling and joint feature classification module are used as the model to be trained (which can be called TS-Net) for parameter optimization; then the trained TS-Net is connected to the hidden Markov decoding module to construct the sleep apnea detection model.

[0085] To verify the advancement and effectiveness of the proposed model in the sleep apnea detection task, a detailed comparison was conducted with 11 advanced benchmark models from recent years. To ensure fairness, the comparison data directly cites the best results from the corresponding papers for each model. The experimental results are shown in Table 1 below. Bold data in the table represents the best performance in that column, and "-" indicates that the original paper did not mention that metric.

[0086] Experimental results show that the method described in this application achieves the most competitive performance on multiple core evaluation metrics. Specifically, the accuracy of the proposed model reaches 92.42%, and the F1-score reaches 90.52%, achieving the best performance compared to other baseline methods. This demonstrates that the model constructed in this application has stronger feature representation and long-range temporal dependency modeling capabilities in the sleep apnea detection task.

[0087] To investigate the specific contributions of each key module in the proposed method to the sleep apnea detection performance, ablation experiments were designed and completed on the ApneaECG dataset, as shown in Table 2 below. Four variant networks were constructed: w / o MSC: Remove the multi-scale temporal encoder and pass all features through a single-scale regular one-dimensional convolution.

[0088] w / o Stats Prior: Removes the model's perception of patient statistical priors and relies solely on ECG signals as input.

[0089] w / o MVP: Remove multi-view pooling and use only the output features of the last layer of the network for classification.

[0090] w / o HMM: Removes the HMM-based decoding mechanism and directly uses the posterior probability of the feedforward neural network to output the final prediction result.

[0091] Experimental results show that after removing the multi-scale temporal encoder, the model's sensitivity dropped from 91.36% to 85.17%, and the accuracy also decreased significantly. This indicates that high-frequency transients in ECG and respiratory features have different periodic scales, and using only a single scale leads to the loss of some physiological features, resulting in severe missed detections. After removing the model's perception of patient statistical priors, since the pathological manifestations of sleep apnea are highly dependent on the patient's age, gender, and body type, the network lacking these global prior guidance showed a decrease in generalization ability when facing test sets with significant differences across subjects, proving the rationality of injecting medical priors as hidden states into the temporal model in this application. When the multi-view pooling mechanism was removed, and only the hidden state of the last time step of the BiLSTM output was fed into the classifier, all the model's indicators decreased. This indicates that this mechanism can aggregate features from different perspectives into the high-dimensional hidden state space encoded by Bi-LSTM, enriching the model's discriminative representation space. When the HMM-based decoding module was removed, the accuracy, sensitivity, specificity, and F1 score all dropped significantly. This indicates that the module uses the state transition matrix as a prior constraint and performs global optimal path search through the Viterbi algorithm, which can effectively smooth transient jumps that do not conform to physiological laws and improve the performance of the model.

[0092] To further explore the impact of convolution kernel size on the extraction of physiological features of different branches in a multi-scale temporal encoder, this application conducted ablation experiments on the combination of convolution kernels for the ECG interval branch and the respiratory-related branch. The experimental results are shown in Table 3 below. In the experiment, four convolution kernel setting schemes were tested, including uniformly using small convolution kernels {3,5}, uniformly using large convolution kernels {7,11}, and two cross-combination schemes.

[0093] Experimental results show that the proposed convolutional kernel configuration scheme, using small convolutional kernels {3,5} for the ECG interval branch and large convolutional kernels {7,11} for the respiratory-related branch, achieves the best overall performance, reaching the optimal levels in accuracy, sensitivity, F1 score, and AUC. When both branches use small convolutional kernels, the model can capture local transient changes well, thus exhibiting high specificity. However, due to the limited receptive field, it is difficult to fully model long-term respiratory rhythm changes, resulting in relatively low sensitivity. When both branches use large convolutional kernels, the model can acquire contextual information over a longer time span, but its ability to perceive local rhythmic abnormalities and short-term heart rate changes within the ECG interval decreases, thus affecting the overall discriminative performance of the model. When the ECG interval branch uses a large convolutional kernel and the respiratory-related branch uses a small convolutional kernel, the model performance significantly decreases, demonstrating that different physiological signals have significant differences across time scales. From a physiological perspective, high-frequency ECG intervals primarily reflect short-term heart rate variability, and small convolutional kernels can more effectively capture local rhythm abnormalities and short-term heart rate changes. In contrast, the periods of low-frequency respiratory-related features are typically longer than heart rate changes, and large convolutional kernels can better cover respiratory cessation and macroscopic envelope decay over a longer time span, thereby enhancing the model's ability to identify apnea events.

[0094] To verify the effectiveness of introducing medical prior-guided initialization in long-term temporal modeling, this application conducted comparative experiments on the hidden state initialization strategies of BiLSTM in medical prior-guided temporal networks. The experimental results are shown in Table 4. In the experiments, we tested three strategies: random initialization, zero initialization, and the proposed medical prior-guided initialization strategy. The experimental results show that the proposed medical prior-guided initialization strategy achieves the best overall performance. When random initialization is used, there is no clear correlation between the initial state and the actual physiological characteristics of the patient. This introduces additional noise in the initial stage of sequence modeling, interfering with the network's ability to capture the dynamic changes of physiological signals, thus affecting the model's ability to model global temporal features. When zero initialization is used, both the initial hidden state and the cell state are set to zero vectors. The network lacks individual physiological information of the patient in the initial stage of sequence modeling and needs to rely on subsequent time steps to gradually build contextual representations. Therefore, although the model can learn certain temporal patterns, its ability to adapt to differences in physiological baselines between different patients is limited. In contrast, the medical prior-guided initialization strategy proposed in this application utilizes statistical characteristics such as the patient's age, gender, height, and weight to dynamically generate the initial hidden state and cell state of the Bi-LSTM through learnable mapping. This allows the network to incorporate individual physiological prior information about the patient before temporal modeling begins. This approach effectively mitigates the differences in physiological distribution among different patients, enabling the network to establish temporal state expressions that better reflect individual characteristics in the early stages of the sequence, thereby enhancing the model's global modeling ability for apnea events.

[0095] Table 1. Comparison of this application (Ours) with recent advanced benchmark models.

[0096] Table 2 Ablation Experiment Results of Key Modules

[0097] Table 3 Results of Kernel-Related Ablation Experiments

[0098] Table 4 Performance comparison results of different hidden state initialization strategies

[0099] This application also provides a sleep apnea detection model, such as... Figure 2 As shown, the model includes: The data preprocessing module is configured to, in response to receiving the patient’s raw electrocardiogram signal and demographic information, extract physiological features under multiple preset dimensions from the raw electrocardiogram signal and process the patient’s demographic information into scaled statistical features. The multi-scale temporal encoder is configured to extract feature information at different time scales from physiological features under multiple preset dimensions based on multi-scale convolution. The medical prior-guided temporal network is configured to use the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, and obtain a temporal hidden state feature matrix to characterize the medical prior and the global context. The multi-view pooling and joint feature classification module is configured to aggregate the temporal hidden state feature matrix into a multi-view temporal representation based on the multi-view pooling mechanism, and generate classification probabilities at continuous time steps based on the multi-view temporal representation and the scaled statistical features. The Hidden Markov Model (HMM) decoding module is configured to correct the classification probability at continuous time steps based on the prior of the actual sleep apnea state, so as to obtain the detection result of sleep apnea.

[0100] Optionally, the multi-scale time-domain encoder is further configured to perform the following steps: In the channel dimension, the physiological features under the multiple preset dimensions are processed into a first feature branch and a second feature branch. The first feature branch includes ECG interval features composed of a single-channel RR interval sequence, and the second feature branch includes ECG-derived respiration and dual-channel respiratory-related features formed by stacking respiratory amplitude envelopes along the channel. Using the first branch network, extract each short-term local heart rate variability feature from the first feature branch; Using the second branch network, macroscopic breathing features of each long period are extracted from the second feature branch. The first branch network and the second branch network are constructed based on convolution kernels, and each convolution kernel in the first branch network is smaller than each convolution kernel in the second branch network. By using convolutional layers to perform cross-modal fusion of the short-term local heart rate variability features and the long-term macroscopic respiratory features, a feature matrix is ​​obtained to characterize the feature information at different time scales.

[0101] Optionally, the short-term local heart rate variability and the long-term macroscopic respiratory characteristics are determined by the following formula:

[0102]

[0103] in, This represents the short-term local heart rate variability associated with a convolutional kernel of size k. ResBlock represents the long-period macroscopic breathing characteristics associated with a convolutional kernel of size k. k,s (·) represents a one-dimensional residual convolution block with kernel size k and stride s, and MaxPool(·) represents the max pooling operation. Indicates the first feature branch. This indicates the second feature branch.

[0104] Optionally, the medical prior-guided temporal network is further configured to perform the following steps: Based on the scaled statistical features, initial hidden states and initial cell states are generated using independent linear mapping layers, respectively. Using a bidirectional long short-term memory network, global context modeling is performed on the feature information at different time scales to obtain the complete hidden state at each time step. The initial states of the forward and backward networks in the bidirectional long short-term memory network are determined based on the initial hidden state and the initial cell state. The time-series hidden state feature matrix is ​​obtained by constructing a feature matrix based on the complete hidden states of each time step.

[0105] Optionally, the complete hidden state at each time step is determined by the following formula:

[0106]

[0107] in, Represents the complete hidden state at time step t. This represents the hidden state of the forward and backward networks in the corresponding directions at time step t. This represents the cell state in the corresponding direction of the output of the forward and backward networks at time step t. and This represents the forward and backward Long Short-Term Memory (LSTM) network update operators. and This represents the historical state of the forward network at time step t-1 and the backward network at time step t+1. The fusion feature of time step t is represented. The fusion feature of each time step is determined based on the feature information under different time scales. Concat[·] represents the splicing operation along the channel dimension.

[0108] Optionally, the multi-view pooling and joint feature classification module is further configured to perform the following steps: Based on three dimensions—extreme value capture, global averaging, and final state of the sequence—feature compression is performed on the corresponding temporal hidden states in the temporal hidden state feature matrix to obtain the max pooling vector, average pooling vector, and final hidden state vector. The max pooling vector, average pooling vector, and terminal hidden state vector are concatenated along the feature dimension to obtain the multi-view temporal representation.

[0109] Optionally, the classification probability at consecutive time steps is represented using a two-dimensional joint prediction probability matrix, which is determined by the following formula:

[0110] in, Let represent the two-dimensional joint prediction probability matrix, Softmax(·) represent the Softmax activation function, Reshape(·) represent the tensor dimension transformation operation, and MLP(·) represent the multilayer perceptron. This represents the joint feature matrix determined based on the multi-view temporal representation and the scaled statistical features. This represents the classification probability at time steps t-1, t, and t+1.

[0111] Optionally, the Hidden Markov Decoding module is further configured to perform the following steps: Based on the actual sleep apnea state transition prior, the following dynamic programming forward recursion formula is used to correct the classification probability at continuous time steps, thus obtaining the sleep apnea detection results:

[0112]

[0113] in, and This represents the global maximum logarithmic probability and path pointer matrix at time step t and hidden state j. This represents the global maximum logarithmic probability at time step t-1 and in hidden state i. This represents the probability of transitioning from hidden state i to hidden state j in the state transition matrix. Let represent the emission probability at time step t and in hidden state j, and It is determined based on the j-th component of the vector between the true prior probability of sleep apnea state transition associated with latent state j and the predicted probability at time step t. This indicates that latent state i belongs to one of two discrete latent states: normal and sleep apnea.

[0114] Optionally, the joint optimization loss function used by the model during the training phase... It is expressed as follows:

[0115]

[0116]

[0117] in, Indicates the primary classification loss. Represents local temporal consistency loss The weight hyperparameters, This represents the value of the actual label in category c at time step t. This represents the prediction probability vector at time step t. The probability component for category c, where T represents the total number of time steps. The KL divergence represents the distance between two probability distributions. , This represents the predicted probability vectors at time steps t-1 and t+1.

[0118] As can be seen from the above technical solutions, this application proposes an SA detection framework jointly based on a medical prior-guided multi-scale temporal network and global temporal decoding. The multi-scale temporal encoder extracts feature information at different time scales for different physiological characteristics to overcome the limitations of a single receptive field and fully mine multi-scale physiological feature information. The medical prior-guided temporal network uses the statistical characteristics of different patients as medical prior guidance conditions to consider the static medical prior information of different patients, and then dynamically guides the network to perform long-range temporal modeling under the physiological baseline of different patients, obtaining a temporal hidden state feature matrix that accurately represents the medical prior and global context. The multi-view pooling and joint feature classification module aggregates the temporal hidden state feature matrix based on the multi-view pooling mechanism, which can reduce the probability of losing important information. The hidden Markov decoding module corrects the classification probability at continuous time steps based on the real sleep apnea state transition prior, thereby correcting state jumps that do not conform to physiological common sense based on the temporal continuity of physiological state evolution. Therefore, the accuracy of sleep apnea detection results can be effectively improved.

[0119] Optionally, this application embodiment also provides an electronic device, including a processor 110, a memory 109, and a program or instructions stored in the memory 109 and executable on the processor 110. When the program or instructions are executed by the processor 110, they implement the various processes of the above-described multi-scale medical prior-guided sleep apnea detection method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0120] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0121] Figure 3 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0122] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.

[0123] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 3 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0124] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described multi-scale medical prior-guided sleep apnea detection method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0125] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0126] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described multi-scale medical prior-guided sleep apnea detection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0127] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0128] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0129] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0130] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A multi-scale medical prior-guided method for detecting sleep apnea, characterized in that, An application is made to a sleep apnea detection model, the model comprising a data preprocessing module, a multi-scale temporal encoder, a medically prior-guided temporal network, a multi-view pooling and joint feature classification module, and a hidden Markov decoding module; the method includes: The data preprocessing module, in response to receiving the patient's raw electrocardiogram signal and demographic information, extracts physiological features under multiple preset dimensions from the raw electrocardiogram signal and processes the patient's demographic information into scaled statistical features. The multi-scale temporal encoder is based on multi-scale convolution to extract feature information at different time scales from physiological features under multiple preset dimensions. The medical prior-guided temporal network uses the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, and obtains a temporal hidden state feature matrix to characterize medical priors and global context. The multi-view pooling and joint feature classification module is based on the multi-view pooling mechanism, which aggregates the temporal hidden state feature matrix into a multi-view temporal representation, and generates the classification probability at continuous time steps based on the multi-view temporal representation and the scaled statistical features. The Hidden Markov Model (HMM) decoding module corrects the classification probability at continuous time steps based on the prior knowledge of the actual sleep apnea state, thereby obtaining the detection result of sleep apnea.

2. The method according to claim 1, characterized in that, The physiological characteristics under the multiple preset dimensions include RR interval, electrocardiogram-derived respiration, and respiratory amplitude envelope; The multi-scale temporal encoder, based on multi-scale convolution, extracts feature information at different time scales from physiological features across multiple preset dimensions, including: The multi-scale time-domain encoder processes the physiological features under the multiple preset dimensions into a first feature branch and a second feature branch in the channel dimension. The first feature branch includes ECG interval features composed of a single-channel RR interval sequence, and the second feature branch includes ECG-derived respiration and dual-channel respiratory-related features formed by stacking respiratory amplitude envelopes along the channels. The multi-scale temporal encoder uses a first branch network to extract various short-term local heart rate variability features from the first feature branch. The multi-scale temporal encoder uses a second branch network to extract macroscopic breathing features of each long period from the second feature branch. The first branch network and the second branch network are constructed based on convolutional kernels, and each convolutional kernel in the first branch network is smaller than each convolutional kernel in the second branch network. The multi-scale temporal encoder uses convolutional layers to perform cross-modal fusion of the heart rate variability features of each short time period and the macroscopic respiratory features of each long period, to obtain a feature matrix that characterizes the feature information at different time scales.

3. The method according to claim 2, characterized in that, The short-term local heart rate variability and the long-term macroscopic respiratory characteristics are determined by the following formula: in, This represents the short-term local heart rate variability associated with a convolutional kernel of size k. ResBlock represents the long-period macroscopic breathing characteristics associated with a convolutional kernel of size k. k,s (·) represents a one-dimensional residual convolution block with kernel size k and stride s, and MaxPool(·) represents the max pooling operation. Indicates the first feature branch. This indicates the second feature branch.

4. The method according to claim 1, characterized in that, The medical prior-guided temporal network uses the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, obtaining a temporal hidden state feature matrix to characterize the medical prior and global context, including: The medical prior-guided temporal network generates initial hidden states and initial cell states respectively using independent linear mapping layers based on the scaled statistical features. The medical prior-guided temporal network utilizes a bidirectional long short-term memory network to perform global context modeling on the feature information at different time scales, obtaining the complete hidden state at each time step. The initial states of the forward and backward networks in the bidirectional long short-term memory network are determined based on the initial hidden state and the initial cell state. The medical prior-guided temporal network constructs a feature matrix based on the complete hidden states of each time step, thus obtaining the temporal hidden state feature matrix.

5. The method according to claim 4, characterized in that, The complete hidden state at each time step is determined by the following formula: in, Represents the complete hidden state at time step t. This represents the hidden state of the forward and backward networks in the corresponding directions at time step t. This represents the cell state in the corresponding direction of the output of the forward and backward networks at time step t. and This represents the forward and backward Long Short-Term Memory (LSTM) network update operators. and This represents the historical state of the forward network at time step t-1 and the backward network at time step t+1. The fusion feature of time step t is represented. The fusion feature of each time step is determined based on the feature information under different time scales. Concat[·] represents the splicing operation along the channel dimension.

6. The method according to claim 1, characterized in that, The multi-view pooling and joint feature classification module, based on a multi-view pooling mechanism, aggregates the temporal hidden state feature matrix into a multi-view temporal representation, including: The multi-view pooling and joint feature classification module performs feature compression on the corresponding temporal hidden states in the temporal hidden state feature matrix based on three dimensions: extreme value capture, global average, and final state of the sequence, to obtain the max pooling vector, average pooling vector, and final hidden state vector. The multi-view pooling and joint feature classification module concatenates the max pooling vector, average pooling vector, and terminal hidden state vector along the feature dimension to obtain the multi-view temporal representation.

7. The method according to claim 1, characterized in that, The classification probability at consecutive time steps is represented by a two-dimensional joint prediction probability matrix, which is determined by the following formula: in, Let represent the two-dimensional joint prediction probability matrix, Softmax(·) represent the Softmax activation function, Reshape(·) represent the tensor dimension transformation operation, and MLP(·) represent the multilayer perceptron. This represents the joint feature matrix determined based on the multi-view temporal representation and the scaled statistical features. This represents the classification probability at time steps t-1, t, and t+1.

8. The method according to claim 1, characterized in that, The Hidden Markov Model (HMM) decoding module corrects the classification probability at continuous time steps based on the actual sleep apnea state transition prior, obtaining the sleep apnea detection result, including: The Hidden Markov Model (HMM) decoding module, based on the prior knowledge of actual sleep apnea states, uses the following dynamic programming forward recursion formula to correct the classification probability at continuous time steps, thereby obtaining the sleep apnea detection result: in, and This represents the global maximum logarithmic probability and path pointer matrix at time step t and hidden state j. This represents the global maximum logarithmic probability at time step t-1 and in hidden state i. This represents the probability of transitioning from hidden state i to hidden state j in the state transition matrix. Let represent the emission probability at time step t and in hidden state j, and It is determined based on the j-th component of the vector between the true prior probability of sleep apnea state transition associated with latent state j and the predicted probability at time step t. This indicates that latent state i belongs to one of two discrete latent states: normal and sleep apnea.

9. The method according to any one of claims 1-8, characterized in that, The joint optimization loss function used by the model during the training phase It is expressed as follows: in, Indicates the primary classification loss. Represents local temporal consistency loss The weight hyperparameters, This represents the value of the actual label in category c at time step t. This represents the prediction probability vector at time step t. The probability component for category c, where T represents the total number of time steps. The KL divergence represents the distance between two probability distributions. , This represents the predicted probability vectors at time steps t-1 and t+1.

10. A sleep apnea detection model, characterized in that, The model includes: The data preprocessing module is configured to, in response to receiving the patient’s raw electrocardiogram signal and demographic information, extract physiological features under multiple preset dimensions from the raw electrocardiogram signal and process the patient’s demographic information into scaled statistical features. The multi-scale temporal encoder is configured to extract feature information at different time scales from physiological features under multiple preset dimensions based on multi-scale convolution. The medical prior-guided temporal network is configured to use the scaled statistical features as medical prior guidance conditions to perform long-range temporal modeling on the feature information at different time scales, and obtain a temporal hidden state feature matrix to characterize the medical prior and the global context. The multi-view pooling and joint feature classification module is configured to aggregate the temporal hidden state feature matrix into a multi-view temporal representation based on the multi-view pooling mechanism, and generate classification probabilities at continuous time steps based on the multi-view temporal representation and the scaled statistical features. The Hidden Markov Model (HMM) decoding module is configured to correct the classification probability at continuous time steps based on the prior of the actual sleep apnea state, so as to obtain the detection result of sleep apnea.