Method and system for monitoring and evaluating sleep quality

Through the KAN-BiLSTM-Transformer's sleep staging prediction method, the problems of insufficient multimodal information fusion and poor generalization performance in the prior art are solved, and more accurate and reliable sleep staging prediction is achieved.

CN119498778AActive Publication Date: 2025-02-25BEIJING INST OF TECH

Patent Information

Application Number
CN202411513301.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-25
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

The existing automatic sleep staging method has insufficient generalization performance in multimodal information fusion and cross-individual and cross-device scenarios, making it difficult to accurately judge sleep staging.

Method used

The sleep stage prediction method of KAN-BiLSTM-Transformer is adopted to extract the adaptive features of multimodal signals through KAN, BiLSTM modeling timing dependence, Transformer captures local patterns, and combines the multi-task self-supervised pre-training paradigm to improve the model's representation and generalization capabilities.

Benefits of technology

It significantly improves the performance of sleep staging, improves the fusion ability of multimodal information and the generalization ability across individuals and devices, and provides an efficient and interpretable sleep staging prediction model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005105992390000021
    Figure BDA0005105992390000021
  • Figure BDA0005105992390000031
    Figure BDA0005105992390000031
  • Figure BDA0005105992390000035
    Figure BDA0005105992390000035
Patent Text Reader

Abstract

The invention relates to the field of sleep quality monitoring and evaluation, in particular to a sleep quality monitoring and evaluation method and system. Firstly, acquisition and quality enhancement preprocessing are carried out on polysomnogram (PSG) data, and then an adaptive spatial-temporal feature learning network KAN-BiLSTM-Transform is designed and is used for automatically extracting discriminative features of sleep signals. The network is composed of a Kolmogorov-Arnold network (KAN), a bidirectional long short-term memory (BiLSTM) and a Transform, and the space-time dependency relationship of a multi-mode signal can be fully mined. In the training stage, weighted Dice loss and time sequence smooth loss are introduced, and a self-supervised pre-training normal form is adopted for parameter optimization. During application, sleep signals are input into the trained network, and the sleep stages corresponding to the time window can be automatically predicted. The method is expected to become an auxiliary tool for detecting and evaluating the sleep quality of people.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of sleep quality monitoring and evaluation, and in particular proposes a method and system for sleep quality monitoring and evaluation. Background Art

[0002] Sleep quality has a profound impact on human health and daily performance. Long-term sleep problems not only lead to daytime fatigue and decreased concentration, but may also increase the risk of various chronic diseases, such as obesity, diabetes, and cardiovascular disease. The key to objectively assessing sleep quality is to accurately determine sleep stages. Traditional sleep staging methods rely on manual interpretation of polysomnography (PSG) data, a process that is time-consuming and easily influenced by subjective factors. With the popularization of wearable devices and the development of artificial intelligence technology, the automation of sleep staging using machine learning and deep learning algorithms has become possible and is receiving increasing attention.

[0003] Existing automatic sleep staging methods can be roughly divided into the following categories:

[0004] 1. Traditional machine learning methods based on handcrafted features, such as support vector machines (SVMs) and random forests (RFs), require extracting various statistical and frequency-domain features from the raw PSG signals, which are then fed into a classifier for training and prediction. Their limitations lie in the fact that feature engineering requires extensive domain knowledge and manpower, and they struggle to fully utilize the temporal information in the raw signals.

[0005] 2. Deep learning-based input-to-output methods, such as convolutional neural networks (CNNs) and long short-term memory networks (LSTMs). These methods directly input raw PSG signals, extract local features through convolutional layers, and then use recurrent neural networks to model temporal dependencies. While these methods overcome the limitations of handcrafted features, they suffer from low computational efficiency and limited expressiveness when processing long sequences.

[0006] Although the above methods have made some progress in sleep staging tasks, they still face the following problems:

[0007] 1. Insufficient multimodal information fusion. In addition to core PSG signals such as EEG, EOG, and EMG, physiological indicators such as respiration, heart rate, and body movement, as well as environmental factors such as temperature and noise, also contain important sleep status information. Most existing methods only utilize a single signal source and lack the comprehensive utilization of multimodal information.

[0008] 2. Unsatisfactory generalization performance. Due to the large differences in the distribution of PSG data collected by different individuals and devices, the generalization performance of existing models in cross-individual and cross-device scenarios is often greatly reduced, and their reliability in practical applications is insufficient. Summary of the Invention

[0009] In response to the above problems, the present invention proposes a sleep quality detection and evaluation method and system.

[0010] The sleep stage prediction method based on KAN-BiLSTM-Transformer demonstrates superiority over existing technologies in many aspects:

[0011] 1. This paper introduces the Kolmogorov-Arnold Network (KAN) to the field of sleep staging for the first time. KAN is a novel neural network architecture whose core concept is to approximate any continuous function using a combination of unary functions. Compared to traditional neural networks, KAN has stronger representational capabilities. Replacing CNN as a feature extractor with KAN allows for richer feature representations to be learned from multimodal physiological signals.

[0012] 2. Combining the strengths of BiLSTM and Transformer. BiLSTM excels at modeling long-term temporal dependencies, while Transformer excels at capturing key local patterns. Features extracted by KAN are first fed into BiLSTM to learn temporal context, and then into Transformer to enhance key features. The complementary strengths of these two approaches enable more comprehensive exploration of the spatiotemporal characteristics of multimodal sleep signals.

[0013] 3. A novel learning framework was designed. In addition to the main sleep staging task, the prediction of physiological indicators such as heart rate and respiration was introduced as an auxiliary means to better utilize multimodal information and understand sleep states from different perspectives, thereby improving the prediction performance and generalization ability.

[0014] The significance of this invention lies in: 1) exploring the application of KAN in the analysis of sleep quality physiological signals; 2) innovatively integrating the advantages of KAN, BiLBTM, and Transformer to design an efficient, interpretable, and robust input-to-output model for the sleep staging task; 3) making full use of multimodal sleep information to lay the foundation for the development of a comprehensive and accurate sleep monitoring system.

[0015] On the one hand, the present invention proposes a sleep quality detection and evaluation method, which is based on the KAN-BiLSTM-Transformer sleep stage prediction method and includes the following steps:

[0016] 1. Multimodal sleep signal acquisition and quality enhancement: De-noising, filtering, normalization, and other quality enhancement processes are performed on EEG, EOG, EMG, ECG, respiration, SpO2, body movement, and environmental signals. For EEG and EOG signals, an adaptive filtering algorithm based on empirical mode decomposition (EMD) is used to remove noise. The formula is:

[0017]

[0018] in, is the denoised signal, c i (t) is the i-th intrinsic mode function (IMF) component, β i is the weight coefficient of the ith IMF component, and n is the total number of IMF components.

[0019] Then, an adaptive threshold denoising algorithm based on wavelet packet decomposition (WPD) is used to further improve the signal-to-noise ratio. The wavelet coefficients after soft threshold processing are:

[0020]

[0021] in, is the i-th wavelet coefficient after processing, w i is the original i-th wavelet coefficient, is the threshold of the ith subband, and sign(·) is the sign function.

[0022] Finally, data enhancement is performed through random truncation, cyclic shift, and additive Gaussian noise perturbation to balance the category distribution and improve the generalization of the model.

[0023] 2. Design of an adaptive spatiotemporal feature learning network based on KAN-BiLSTM-Transformer: Adaptive feature extraction module: Use KAN to extract adaptive feature representations of each modal signal. The formula is:

[0024]

[0025] in, represents the value of the d-th adaptive feature at the t-th time step; P is the number of expansion items of KAN; is the combination coefficient of the d-th adaptive feature on the p-th item; is a unary function of the d-th adaptive feature on the p-th item. The present invention adopts the Swish activation function:

[0026]

[0027] in, is the shape parameter of the d-th adaptive feature on the p-th item; is the projection vector of the p-th item; is the original feature vector of the tth time step.

[0028] Bidirectional long short-term memory network: Use BiLSTM to learn the temporal dependencies of feature sequences. The forward and backward hidden state update formulas are:

[0029]

[0030] in, and are the forward and backward hidden states of the t-th time step, is the adaptive feature vector at the tth time step.

[0031] Multi-information interactive fusion module: Use the multi-head self-attention mechanism to achieve interactive fusion of different modal features. The formula is:

[0032]

[0033] Among them, A h is the self-attention matrix of the h-th attention head; Q h , K h are the query matrix and key matrix of the h-th attention head, respectively, which are obtained from the multimodal feature matrix X through linear transformation:

[0034]

[0035] in, and is the projection matrix of the h-th attention head; D h is the subspace dimension of the h-th attention head, used to scale the dot product result.

[0036] Finally, high-level features are further extracted through a feedforward neural network (FFN):

[0037] F = ReLU(Y′W1+b1)W2+b2;

[0038] Among them, Y′ is the multimodal interaction feature matrix that integrates body motion and environmental information, and W1, b1, W2, and b2 are the parameters of FFN.

[0039] At the end of the model, a fully connected layer is used to map F to the sleep stage label space:

[0040] P=softmax(W cls F+b cls );

[0041] Among them, W cls and b cls is the parameter of the classification layer, and F is the feature matrix output by the multi-information interaction fusion module.

[0042] 3. Construction of a multi-task self-supervised pre-training paradigm based on KAN-BiLSTM-Transformer:

[0043] Loss function design: using weighted Dice loss and time series smoothing loss The weighted sum of is used as the loss function. The formula for weighted Dice loss is:

[0044]

[0045] in, is the weighted Dice loss of the cth class, w c is the weight coefficient of the cth class, p ct is the probability that the model predicts the cth class at the tth time step, y ct is the cth element of the one-hot vector of the true label at the tth time step, and ∈ is the smoothing term. The formula for temporal smoothing loss is:

[0046]

[0047] Among them, N c is the total number of categories, and T is the total number of time steps.

[0048] Optimization algorithm and hyperparameter selection: The RMSprop optimization algorithm is used, and the Cosine Annealing strategy is used to adjust the learning rate. The formula is:

[0049]

[0050] Among them, η t is the learning rate of step t, η min and η max are the minimum and maximum learning rates, T cur is the current training step number, T max is the total number of training steps.

[0051] Training process and evaluation: K-fold cross validation was used, and accuracy, macro-average F1 value, and Cohen's Kappa coefficient were used to evaluate model performance. The macro-average F1 value was calculated as:

[0052]

[0053] Among them, precision c and recall c are the precision and recall of class c respectively. The calculation formula of Cohen's Kappa coefficient is:

[0054]

[0055] Among them, p o is the observation consistency, p e For chance consistency.

[0056] 4. Application of intelligent sleep stage prediction: Perform quality enhancement and feature extraction on new sleep data samples, then use the trained model to predict the sleep stage probability for each time step, and determine the final stage label based on the probability value to generate a sleep stage prediction result graph. The calculation formula for the prediction probability matrix is:

[0057] P=softmax(W cls F+b cls );

[0058] Among them, W cls and b cls is the parameter of the classification layer, and F is the feature matrix output by the multi-information interaction fusion module.

[0059] This model can automatically learn the discriminative features of multimodal sleep signals, capture spatiotemporal dependencies, and perform cross-modal information fusion, significantly improving sleep staging performance. It also offers excellent computational efficiency and understandability, providing significant value for clinical applications. In the future, this model could also be integrated into sleep monitoring devices or systems to enable real-time online sleep staging analysis.

[0060] Based on the above method, we also provide a sleep apnea detection and evaluation system. This system consists of a data acquisition module, a data quality enhancement module, a feature extraction module, a sequence learning module, a feature fusion module, a stage prediction module, and a data visualization module. It is equipped with the necessary storage and computing resources to support model training and inference.

[0061] The data acquisition module is responsible for collecting polysomnographic (PSG) data, including EEG, EOG, EMG, ECG, respiration, SpO2, body movement, and environmental signals. This module consists of various physiological signal sensors and acquisition devices, such as an EEG cap, electrooculogram (EOG) electrodes, electromyography (EMG) electrodes, electrocardiogram (ECG) electrodes, a respiratory belt, a pulse oximeter, and an accelerometer. The collected raw signals are transmitted to the central data processing unit via wired or wireless means.

[0062] The data quality enhancement module performs a series of data quality enhancement operations on the collected raw signals, including denoising, filtering, and segmentation, to improve signal quality and reduce the effects of noise and artifacts. This module is primarily implemented using a dedicated signal processing chip or a high-performance CPU / GPU, equipped with sufficient memory and storage space to cache raw data and intermediate results. After data quality enhancement, the signal data is formatted and stored in the system database for subsequent feature extraction and model training.

[0063] The feature extraction module uses a pretrained KAN model to extract adaptive features for each enhanced signal. The KAN model parameters are stored in the system's memory or cache for fast loading and execution. The extracted adaptive features are written to the memory or cache and passed to the sequence learning module.

[0064] The sequence learning module uses a BiLSTM model to encode the adaptive feature sequence of each signal to capture long-range dependencies in the time dimension. The parameters of the BiLSTM model are also stored in memory or cache, and the forward and backward hidden state vectors are written to the memory or cache and passed to the feature fusion module.

[0065] The feature fusion module uses the Transformer model to perform cross-modal fusion of sequence features from different signals. The Transformer model parameters are also stored in memory or cache. The fused feature vector is written to memory or cache and passed to the installment prediction module.

[0066] The sleep stage prediction module uses a fully connected classifier to predict the sleep state at each time step based on the fused feature vector. The classifier parameters are stored in memory or cache, and the prediction results are written to the system database or external storage device for subsequent analysis and application.

[0067] To support the operation of each of the aforementioned modules, the system is equipped with high-performance processors, large-capacity memory, and storage devices. The processor can be a multi-core CPU, GPU, or dedicated AI chip, such as a Tensor Processing Unit (TPU), providing sufficient computing power. Memory can be built-in DRAM, cache, or external memory modules to meet the needs of data access and model execution. Storage devices can be hard drives, solid-state drives, or network storage to permanently store raw data, intermediate results, and final predictions.

[0068] The system also offers a user-friendly interface and interactive methods to facilitate operation and interpretation of results. Users can upload new sleep data, initiate automatic staging tasks, and view staging results and statistical reports through a graphical or web interface. The system also supports importing and exporting data in multiple formats, such as EDF, XML, and JSON, enabling data exchange and sharing with other medical systems.

[0069] In summary, the system realizes the automation of the entire process from data collection, data quality enhancement, feature extraction, sequence learning, feature fusion, stage prediction to data visualization, and provides flexible user interaction and data management functions. DETAILED DESCRIPTION

[0070] The present invention will be further explained below with reference to specific embodiments, which are not intended to limit the present invention.

[0071] A sleep quality detection and evaluation method is provided. The method is based on a KAN-BiLSTM-Transformer sleep stage prediction method and includes the following steps:

[0072] 1. Multimodal sleep signal acquisition and quality enhancement:

[0073] The data used in this study were obtained from polysomnography (PSG) records of a sleep center. A total of 100 people (50 men and 50 women; age range 18-65 years, average age μ age =42.5, standard deviation σ age =12.1) overnight PSG data. All subjects signed informed consent before the experiment.

[0074] Raw PSG data includes the following signals:

[0075] (1) Electroencephalogram (EEG): Record EEG signals of multiple channels such as F3, F4, C3, C4, O1, and O2, with a sampling frequency of The original EEG signal can be represented as the matrix X EEG .

[0076] (2) Eye movement graph (EOG): records the EOG signals of the left and right channels, with a sampling frequency of The original EOG signal can be expressed as the matrix X EOG .

[0077] (3) Electromyography (EMG): records the EMG signals of the mandibular muscles, with a sampling frequency of The original EMG signal can be represented as a vector x FMG .

[0078] (4) Electrocardiogram (ECG): records single-lead ECG signals with a sampling frequency of The original ECG signal can be represented as a vector x ECG .

[0079] (5) Respiratory signal: records the respiratory signal reflected by chest and abdominal movements, sampling frequency The original respiratory signal can be represented as vector x RESP .

[0080] (6) Blood oxygen saturation (SpO2): Use a pulse oximeter to The frequency records the SpO2 time series, which can be expressed as a vector x SpO2 .

[0081] (7) Body movement: Use wrist accelerometer to The frequency of the hand movement signal is recorded and can be expressed as the matrix X MOT .

[0082] (8) Environment: Use multimodal sensors to The temperature of the laboratory is recorded at a frequency of x TEMP , humidity x HUMI and light intensity x LUMI .

[0083] For different types of raw signals, the following data quality enhancement methods are used:

[0084] (1) EEG and EOG signals: First, an adaptive filtering algorithm based on empirical mode decomposition (EMD) is used to remove power frequency interference and baseline drift. This algorithm adaptively identifies and removes noise components by decomposing the signal into several intrinsic mode functions (IMFs). Let the original EEG signal be x(t), and the IMF components obtained by EMD decomposition be {c1(t), c2(t), …, c n (t)}, then the denoised signal for:

[0085]

[0086] where β i is the weight coefficient of the i-th IMF component, which can be obtained by optimizing the following objective function:

[0087]

[0088] The first term in the above formula is the signal reconstruction error, and the second term is the L1 regularization term, which is used to encourage sparsity, that is, automatically reducing the weight of the noise IMF component to 0. λ is a hyperparameter that balances the two terms.

[0089] Secondly, in order to further improve the signal-to-noise ratio, an adaptive threshold denoising algorithm based on wavelet packet decomposition (WPD) is used. This algorithm performs multi-scale wavelet packet transform on the signal, adaptively sets thresholds in each sub-band, and performs soft threshold processing on the wavelet coefficients to remove high-frequency noise. Assume that the EEG signal after the first denoising step is Its wavelet packet coefficients are w{w1, w2, ..., w N}, then the coefficient after soft threshold processing for:

[0090]

[0091] in is the threshold of the ith subband, which can be determined by the following adaptive strategy:

[0092]

[0093]

[0094] In the above formula, σ i is the standard deviation estimate of the i-th subband coefficient, and N is the signal length. Through wavelet packet reconstruction, the final denoised EEG signal can be obtained

[0095] (2) EMG signal: First, a Butterworth high-pass filter is used to remove low-frequency interference. Second, an envelope extraction algorithm based on Hilbert transform is used to obtain the envelope of the EMG signal. Let the EMG signal after bandpass filtering be x(t), and its Hilbert transform is Then the analytical signal z(t) and envelope signal e(t) are:

[0096]

[0097] Finally, the envelope signal e(t) is smoothed by moving average to obtain the final EMG signal with enhanced data quality. .

[0098] (3) ECG signal: First, a median filter is used to remove baseline drift and myoelectric noise. Second, the Pan-Tompkins algorithm is used to detect the R wave peak and calculate the sequence of adjacent R wave peak intervals (RRI). This algorithm is implemented by the following steps:

[0099] Bandpass filtering: A bandpass filter is used to extract the signal in the QRS complex frequency band (5-15Hz).

[0100] Differentiation: Differentiate the bandpass filtered signal to enhance the slope characteristics of the QRS complex wave.

[0101] Squaring: Squares the differentiated signal to further enhance the energy of the high-frequency QRS complex.

[0102] Moving window integration: Use a moving window to integrate and smooth the squared signal to obtain the QRS complex wave energy envelope.

[0103] Adaptive threshold detection: The threshold is adaptively set based on the signal mean and noise level, and the QRS complex wave energy envelope is threshold detected to obtain the R wave peak position.

[0104] Finally, the RRI series is subjected to 3σ principle outlier removal and cubic spline interpolation to obtain the final RRI time series x after data quality enhancement. RRJ (t).

[0105] (4) Respiratory signal: First, use an FIR low-pass filter to remove high-frequency noise. Second, use the instantaneous phase extraction algorithm based on Hilbert transform to obtain the respiratory phase signal. Let the filtered respiratory signal be x(t), and its Hilbert transform is Then the instantaneous phase signal φ(t) is:

[0106]

[0107] According to φ(t), the respiratory frequency and respiratory depth can be further calculated. Finally, the original respiratory signal x(t) and various respiratory features are normalized by z-score to obtain the respiratory feature vector x after data quality enhancement. RESP .

[0108] (5) SpO2 signal: First, the LOESS regression algorithm is used to smooth the SpO2 time series and remove outliers caused by probe displacement. Second, the statistical features of SpO2 are extracted, including the mean μ SpO2 , standard deviation σ SpO2 , maximum value max(SpO2), minimum value min((SpO2), etc., to obtain the SpO2 feature vector x SpO2 .

[0109] (6) Body motion signal: First, use a Butterworth low-pass filter to remove high-frequency noise. Second, perform vector synthesis on the three-axis acceleration data to obtain the synthetic acceleration time series:

[0110]

[0111] Again, the double threshold method is used to detect body motion events. Assume that the synthetic acceleration sequence is a = [a1, a2, ..., a T ], the two thresholds are θ1 and θ2, then the body motion event m=[m1,m2,…,m T The detection rules for | are:

[0112]

[0113] Where k is the time window length, θ1 and θ2 can be set based on experience. Finally, the detected body motion events are counted to obtain the body motion feature vector x MOT , including the number of body movements, total duration of body movements, average duration of body movements, etc.

[0114] (7) Environmental signal: Perform min-max normalization on temperature, humidity and light intensity respectively to obtain the normalized environmental feature vector x ENV .

[0115] After completing the aforementioned data quality enhancement, the EEG, EOG, and EMG time series signals are segmented into 30-second time windows, with each segment corresponding to a unique sleep stage label (Wake, N1, N2, N3, or REM). Simultaneously, the ECG, respiration, SpO2, body movement, and environmental feature vectors are aligned with each time window to construct a complete multimodal sleep data sample.

[0116] In addition, considering the class imbalance problem of sleep data (such as the relatively small number of N1 and REM segments), the following data augmentation strategy was adopted:

[0117] (1) EEG and EOG signals: Data enhancement methods in time and frequency domains are used. In the time domain, the original signal segments are Perform random interception, cyclic shift, additive Gaussian noise perturbation and other operations in sequence to obtain the enhanced signal :

[0118]

[0119] Among them S L (·) means randomly cutting a segment of length L from the original signal. Indicates that the signal is circularly shifted to the right points, ε is additive Gaussian noise, σ 2 is the noise variance.

[0120] In the frequency domain, the signal is first subjected to a fast Fourier transform (FFT) to obtain the spectrum X(f). Then, a random phase shift φ is superimposed on the spectrum. r , and then perform inverse FFT to obtain the enhanced signal

[0121]

[0122]

[0123] In the above formula, U(0, 2π) represents a uniform distribution on [0, 2π]. Frequency-domain phase shifting is equivalent to introducing random delay in the time domain, which can increase data diversity.

[0124] (2) ECG signal: RRI time series x RRI Perform random resampling. Specifically, from x RRI Randomly select a subsequence s from RRI , then s RRI Perform linear interpolation to obtain new samples of the same length as the original sequence

[0125]

[0126] Where Interpolate(·) represents the linear interpolation function and T is the length of the original sequence. Resampling can change the rhythm characteristics of the RRI sequence and simulate different heart rate variability.

[0127] (3) Respiratory signal: Randomly perturb the respiratory frequency and respiratory depth characteristics. Assume that the original respiratory frequency is f0 and the respiratory depth is d0. The perturbed characteristics are and for:

[0128]

[0129] in and are the variances of the frequency and depth perturbations, respectively, which can be set based on prior knowledge. This perturbation can simulate the natural variation of the breathing pattern.

[0130] (4) SpO2 signal: SpO2 feature vector x SpO2 Randomly offset each feature in . For example, the mean value μ SpO2 The offset is:

[0131]

[0132] in is the variance of the offset. The offset for other features is similar. This offset can simulate individual differences in SpO2 and measurement errors.

[0133] (5) Body motion and environmental signals: The SMOTE algorithm is used to calculate the body motion and environmental feature vector x MOT and x ENV Oversampling is performed to synthesize new minority class samples. The basic idea of ​​the SMOTE algorithm is that for each minority class sample x i , randomly select a sample x from its k nearest neighbors j , then in x i and x j Interpolate between to generate new samples

[0134]

[0135] Where λ is the interpolation coefficient. SMOTE can balance the category distribution of body motion and environmental data, improving the robustness of the model.

[0136] In summary, by enhancing the data quality and data enhancement of the original PSG signal, a standardized and diverse multimodal sleep dataset was obtained. in is the multimodal input of the i-th sample, y i∈{0, 1, 2, 3, 4} is the corresponding sleep stage label, and M is the total number of samples. This dataset can be used for subsequent model training and evaluation.

[0137] 2. Design of an adaptive spatiotemporal feature learning network based on KAN-BiLSTM-Transformer:

[0138] The present invention proposes an innovative adaptive spatiotemporal feature learning network, which consists of three key components: an adaptive feature extraction module (Adaptive Feature Extraction Module), a bidirectional long short-term memory network (BiLSTM) and a multi-modal information interaction fusion module (Multi-Modal Information Interaction Fusion Module). Among them, the adaptive feature extraction module is based on the Kolmogorov-Arnold network (KAN), which is responsible for extracting high-level feature representations with discriminative and adaptive properties from multimodal sleep signals. BiLSTM is used to explore the long-term temporal dependencies within each modal feature sequence. The multi-modal information interaction fusion module takes the self-attention mechanism as its core to achieve dynamic interaction and deep fusion between different modal features. The three components complement each other and jointly build an efficient and accurate deep learning framework for sleep stage prediction from input to output.

[0139] 2.1 Adaptive feature extraction module:

[0140] The input of the adaptive feature extraction module is the multimodal sleep signal obtained in the multimodal sleep signal acquisition and quality enhancement stage, including EEG, EOG, EMG, ECG, respiration, SpO2, body movement and environment. For each signal, a KAN-based adaptive feature extractor is designed to automatically learn the optimal feature representation of the signal. Taking the EEG signal as an example, let the EEG segment after data quality enhancement be Where C is the number of channels and T is the number of time steps. The core idea of ​​KAN is to use a combination of unary functions to approximate complex multivariate signals. Specifically, the KAN feature extraction process of EEG signals can be expressed as:

[0141]

[0142] in For X EEG The t-th column of represents the original EEG features of the t-th time step. is the dth adaptive feature extracted from the EEG signal at the tth time step. P is the number of expansion items of KAN, is the projection vector of the p-th item, is the unary function of the d-th adaptive feature on the p-th item is the corresponding combination coefficient. is the extracted EEG adaptive feature matrix. In actual implementation, Using Swish activation function:

[0143]

[0144] in is the shape parameter of the dth adaptive feature at the pth item, which can be learned through training from the input to the output. Swish can adaptively adjust the nonlinearity of features, thereby improving the representation ability of features.

[0145] For EOG signals, a KAN feature extractor similar to EEG is used to enhance the EOG signal quality. Converted into adaptive feature matrix

[0146]

[0147]

[0148] For the lower-dimensional EMG signal (1D) and ECG signal (1D), a simplified version of the KAN feature extractor is used. Taking EMG as an example:

[0149]

[0150] in is x EMG The tth element of is the scalar projection coefficient. The ECG signal is processed in the same way as the EMG signal, and the adaptive feature matrix is ​​finally obtained.

[0151] For respiratory signals, KAN is first used to extract feature sequences such as respiratory frequency and respiratory depth, and then they are spliced ​​together to form an adaptive feature matrix

[0152] H RESP =[H RESP_RATE ;H RESP_DEPTH ;…];

[0153] Among them H RESP_RATE and H RESP_DEPTH They are the respiratory frequency and respiratory depth feature sequences extracted by KAN respectively.

[0154] For the SpO2 signal, it is mapped to the same time step as EEG and other signals using a fully connected layer together with other slowly changing physiological indicators (such as heart rate, body temperature, etc.) to obtain an adaptive feature matrix

[0155]

[0156] where x SpO2 、x HR 、x TEMP etc. are the original feature sequences after data quality enhancement of SpO2, heart rate, body temperature, etc., and FC(·) represents the fully connected layer.

[0157] For body motion signals, a gated recurrent unit (GRU) layer is first used to encode the original three-axis acceleration data, and then the hidden state output of the last time step is used as the adaptive feature vector of body motion.

[0158]

[0159]

[0160] in is the original feature of the three-axis acceleration at the t-th time step.

[0161] For environmental signals, the features of temperature, humidity, light intensity and other data quality enhancements are spliced ​​together, and then the adaptive feature vector of the environment is obtained through a fully connected layer.

[0162] h ENV =ReLU(W ENV [x TEMP ;x HUMI ;x LUMI ;…]+b ENV );

[0163] Where W ENV and b ENV are the parameters of the fully connected layer.

[0164] In summary, the adaptive feature extraction module extracts a series of adaptive feature matrices {H EEG , H EOG , H EMG , H ECG , H RESP H SpO2} and the eigenvector h MOT and h ENV, which will serve as the input of the subsequent BiLSTM and multi-information interaction fusion modules.

[0165] 2.2 Bidirectional Long Short-Term Memory Network:

[0166] BiLSTM is used to mine the long-term temporal dependencies in the adaptive feature sequences of each modality. First, it is divided into a series of feature vectors according to the time step Then they are input into BiLSTM one by one:

[0167]

[0168] in and are the forward and backward LSTM hidden state outputs at the t-th time step, respectively, and K is the hidden state dimension. is the BiLSTM output at the t-th time step, which is composed of the forward and backward hidden states. The internal structure of LSTM includes the input gate i t 、Forget Gate t , output gate o t and memory cells c t , its forward propagation process is:

[0169] i t =σ(W ii h t +b ii +W hi z t-1 +b hi );

[0170] f t =σ(W if h t +b if +W hf z t-1 +b hf );

[0171] o t =σ(W io h t +b io +W ho z t-1 +b ho );

[0172] g t =tanh(W ig h t +b ig +W hg z t-1 +b hg );

[0173] c t =f t ⊙c t-1 +i t ⊙g t ;

[0174] z t =o t ⊙tanh(c t );

[0175] Where W * and b * is the parameter matrix and bias vector of LSTM, σ(·) is the Sigmoid activation function, tanh(·) is the hyperbolic tangent activation function, and ⊙ is the element-by-element multiplication operation.

[0176] After inputting the feature matrices of all modalities into BiLSTM, a set of high-level time series feature matrices {Z EEG , Z EOG , Z EMG , Z ECG , Z RESP , Z SpO2},in These matrices characterize the long-range dependencies and evolution patterns of each modal signal in the time dimension, providing important prior knowledge for subsequent cross-modal information interaction and fusion.

[0177] 2.3 Multi-information interaction and fusion module:

[0178] The multi-modal information interaction fusion module uses the self-attention mechanism as its core to achieve dynamic interaction and deep fusion of different modal features in both time and space. The input of this module is the high-level temporal feature matrix extracted by BiLSTM and the body motion and environment feature vectors output by the adaptive feature extraction module. First, all feature matrices are spliced ​​in the time dimension to obtain a multi-modal temporal feature matrix.

[0179] X=[Z EEG ; Z EOG ; Z EMG ; Z ECG ; Z RESP ; Z SpO2 ];

[0180] Where D-2K×6 is the feature dimension after splicing.

[0181] Then, the multi-head self-attention mechanism is used to perform adaptive cross-modal interaction and fusion on X. Specifically, the multi-head self-attention mechanism first projects X into H different subspaces through linear transformation to obtain H groups of query matrices Bond Matrix Sum Matrix

[0182]

[0183] in is the projection matrix of the h-th attention head, D h =D / H is the subspace dimension of each head.

[0184] Next, for each attention head, the normalized dot product of the query matrix and the key matrix is ​​calculated to obtain a self-attention matrix

[0185]

[0186] Where softmax(·) is the Softmax function, which is used to normalize the dot product result into the attention weight. is a scaling factor that controls the variance of the dot product.

[0187] Then, the self-attention matrix is ​​multiplied by the value matrix to obtain the output matrix of the h-th attention head :

[0188] U h =V h A h , h=1,2,…,H;

[0189] Finally, the output matrices of all attention heads are concatenated in the feature dimension, and a linear transformation is performed to obtain the final output matrix of the multi-head self-attention

[0190] Y=W O [U1; U2; ...; U H ]+b O ;

[0191] in and are the parameters of the output linear transformation.

[0192] Next, the body motion feature vector h MOT and the environmental characteristic vector h ENV Expand to the same number of time steps as Y and concatenate on the feature dimension:

[0193] Y′=[Y;h MOT 1 T ;h ENN 1 T ];

[0194] in is a vector of all 1s. This step introduces the global information of body motion and environment into the multimodal interaction fusion feature.

[0195] Finally, Y′ is further processed through a feed-forward neural network (FFN) to extract more advanced cross-modal fusion features:

[0196] F = ReLU(Y′W1+b1)W2+b2;

[0197] in is the parameter of FFN, D FFN is the hidden layer dimension of FFN.

[0198] At this point, the multi-information interactive fusion module outputs a fusion feature matrix that integrates the spatiotemporal features of multimodal sleep signals. This includes both the long-range dependencies between signals from different channels in the temporal dimension and the cross-complementary information between signals from different modalities in the feature space, providing a rich and comprehensive feature representation for subsequent sleep stage prediction tasks.

[0199] At the end of the model, a fully connected layer is used to map F to the sleep stage label space:

[0200] P=softmax(W cls F+b cls );

[0201] in and is the parameter of the classification layer, N c The number of sleep stages (usually 5, including Wake, N1, N2, N3, and REM). is the predicted probability matrix, where P ct represents the probability that the t-th time step belongs to the c-th sleep stage.

[0202] In summary, the adaptive spatiotemporal feature learning network based on KAN-BiLSTM-Transformer proposed in the present invention makes full use of the complementary information of multimodal sleep signals. Through a series of designs such as adaptive feature extraction, time series modeling and cross-modal interactive fusion, an efficient and accurate deep learning framework from input to output is constructed. This model can automatically mine the discriminative features in different physiological signals, capture their spatiotemporal evolution laws, and perform comprehensive information fusion, thereby significantly improving the performance of sleep staging. At the same time, thanks to the parallel computing structure of Transformer and the interpretability of the attention mechanism, the model also has good computational efficiency and comprehensibility, which provides it with important advantages in actual clinical applications.

[0203] 3. Construction of a multi-task self-supervised pre-training paradigm based on KAN-BiLSTM-Transformer:

[0204] After defining the structure of the sleep stage prediction model, the next key step is to design an effective training strategy to optimize the model parameters and improve prediction performance. The following section details the model training process, including the design of the loss function, the selection of the optimization algorithm, the adjustment of hyperparameters, and the evaluation method during training.

[0205] 3.1 Loss function design:

[0206] For the multi-classification task of sleep stage classification, a composite loss function is designed to guide model training. The loss function consists of two parts: weighted Dice loss and time series smoothing loss

[0207] Weighted Dice loss is a loss function based on the Dice coefficient, which is particularly suitable for class imbalance problems. For class c, its weighted Dice loss is defined as:

[0208]

[0209] where y ct is the cth element of the one-hot vector of the true label at the tth time step, p ct is the probability that the model predicts the cth class at the tth time step, w c is the weight coefficient of the cth class, ∈ is a smoothing term used to avoid the denominator being zero. c The number of samples in each category in the training set can be adjusted to alleviate the category imbalance problem. The calculation formula is:

[0210]

[0211] where N c is the total number of categories, N i is the number of samples in the i-th category.

[0212] The final weighted Dice loss is the sum of the losses of all categories:

[0213]

[0214] The temporal smoothing loss is defined the same as before and aims to encourage the model to make smooth and consistent predictions between adjacent time steps:

[0215]

[0216] The final composite loss function is the weighted sum of weighted Dice loss and temporal smoothing loss:

[0217]

[0218] where λ WD and λ TS is the weight coefficient to balance the two losses.

[0219] 3.2 Optimization algorithm and hyperparameter selection:

[0220] To optimize the composite loss function, the RMSprop optimization algorithm is used to update the model parameters. RMSprop is a gradient descent method with an adaptive learning rate. It adjusts the learning rate of each parameter by taking an exponentially weighted moving average of the squared gradients. Compared to traditional SGD algorithms, RMSprop can automatically adjust the learning rate, accelerating convergence.

[0221] The update rule of the RMSprop algorithm is:

[0222]

[0223] where υ i is the squared gradient The exponentially weighted moving average of , β is the decay rate, η is the learning rate, ∈ is the smoothing term, θ t are the model parameters at step t.

[0224] In the experiment, β is set to 0.9 and ∈ is set to 10 -6 The initial value of the learning rate η is set to 10 -3 , and use the CosineAnnealing strategy for dynamic adjustment:

[0225]

[0226] where η min and η max are the minimum and maximum learning rates, T cur is the current training step number, T max is the total number of training steps. Through the Cosine Annealing strategy, the learning rate changes periodically, which can help the model escape the local optimum in the later stages of training.

[0227] In addition, the following hyperparameters and training strategies were adopted:

[0228] Batch size: To strike a balance between training efficiency and memory usage, the batch size is set to 128.

[0229] L2 regularization: To prevent overfitting, L2 regularization is applied to the model parameters, and the regularization coefficient is set to 10 -1.

[0230] Dropout: A Dropout layer is added after modules such as KAN, BiLSTM, and FFN to randomly drop a certain proportion (0.5) of neurons to improve the generalization of the model.

[0231] Gradient clipping: To prevent the gradient explosion problem, the gradient is clipped during backpropagation, limiting the gradient norm to less than 1.0.

[0232] 3.3 Training process and evaluation:

[0233] K-fold cross-validation is used to train and evaluate the model. Specifically, the dataset is randomly divided into K mutually exclusive subsets. One of these subsets is selected as the validation set, and the remaining K-1 subsets are used as the training set. This is repeated K times, and the average of the K results is taken as the final performance indicator. In the experiment, K=5.

[0234] For each fold, the model is trained on the training set and the model performance is evaluated on the validation set. The following metrics are used to evaluate the sleep staging performance:

[0235] Accuracy: The ratio of correctly predicted time steps to the total number of time steps.

[0236] Macro-average F1 score: First, calculate the F1 score for each category separately and then take the average. Macro-average F1 score can measure the average performance of the model across different categories and is more robust to class imbalance.

[0237] Cohen's Kappa coefficient: This measures the consistency between the predicted result and the true label. Its value range is [-1, 1], with values ​​closer to 1 indicating better consistency. This metric takes into account the influence of random guessing and better reflects the actual performance of the model.

[0238] When there is no performance improvement for 10 consecutive rounds on the validation set, the early stopping mechanism is triggered, training is stopped, and the model parameters with the best performance are saved.

[0239] The complete training process is shown in the following algorithm.

[0240] Training process of the KAN-BiLSTM-Transformer model

[0241] Input: training dataset Validation dataset Test dataset

[0242] Output: trained model parameters 0

[0243] 1: Randomly initialize model parameters to 0

[0244] 2:for epoch-1 to N cpochs do

[0245] 3:

[0246] 4:P i =KAN-BiLSTM-Transformer(X i ;θ)

[0247] 5:

[0248] 6:

[0249] 7:g=clip(g,1.0)

[0250] 8:θ=θ-η t ·RMSprop(g,β,∈)

[0251] 9:end for

[0252] 10:

[0253] 11:if score>best_score then

[0254] 12:best_score=score

[0255] 13:θ best =θ

[0256] 14:no improve-0

[0257] 15:else

[0258] 16:no improve+-1

[0259] 17:if no_improve>=10 then

[0260] 18:break

[0261] 19:end if

[0262] 20:end if

[0263] 21:end for

[0264] 22:

[0265] 23:return θ best

[0266] Among them, N cpochs , is the maximum number of training rounds, η t is the learning rate at step t, which is dynamically adjusted by the Cosine Annealing strategy, clip(·, 1.0) represents the gradient clipping operation, and θ best are the model parameters with the best performance.

[0267] 3.4 Application of Intelligent Prediction of Sleep Stages:

[0268] Once you have a trained KAN-BiLSTM-Transformer model, you can use it to automatically predict sleep stages for new sleep data. Consider a new sleep data sample containing time series of various physiological signals (such as EEG, EOG, and EMG). You want to use the trained model to predict the sleep stage for each time step (e.g., a 30-second window) of this new sample.

[0269] The specific prediction process is as follows:

[0270] (1) Data quality enhancement: First, the new samples are subjected to the same data quality enhancement operations as the training data, including denoising, filtering, normalization, etc., to obtain samples with enhanced data quality.

[0271] (2) Feature extraction: Next, the samples with enhanced data quality are input into the trained KAN-BiLSTM-Transformer model. The model automatically extracts the adaptive feature representation of each modal signal and learns the temporal dependency through BiLSTM, finally obtaining a fused feature representation matrix.

[0272] (3) Stage probability prediction: The feature representation matrix is ​​input into the last layer of the fully connected network of the model to obtain the probability value of each time step belonging to each sleep stage and form a probability matrix.

[0273] (4) Stage label decision: According to the probability matrix, different decision strategies can be used to obtain the final sleep stage label. The best strategy is to select the stage category with the highest probability as the predicted label for each time step.

[0274] (5) Result visualization: Finally, the predicted sleep stage labels can be aligned with the original physiological signal waveform to generate an intuitive sleep stage prediction result graph.

[0275] Sleep is an integral part of human life and is closely linked to our physical and mental health. Objectively, accurately, and comprehensively assessing sleep quality has long been a key concern. Traditional sleep monitoring and staging methods rely primarily on manual interpretation of polysomnography (PSG) data, a process that is not only time-consuming and labor-intensive but also susceptible to subjective factors.

[0276] Related artificial intelligence technologies have been applied to sleep quality monitoring and assessment. This paper introduces the KAN-BiLSTM-Transformer into the field of sleep staging. By carefully designing the acquisition scheme, preprocessing process, network architecture, training paradigm, and application process, a complete intelligent sleep staging diagnosis system has been constructed. This system can automatically learn the discriminative features contained in multimodal sleep signals, reveal the inherent connections between different physiological indicators, and output objective and accurate staging prediction results in an end-to-end manner.

Claims

1. A sleep quality detection and evaluation method, characterized in that: The method is based on KAN-BiLSTM-Transformer model.

2. The sleep quality detection and evaluation method according to claim 1, characterized in that: The method comprises the following steps: Step 1: multimodal sleep signal acquisition and quality enhancement; Step 2: based on Adaptive spatiotemporal feature learning network design of KAN-BiLSTM-Transformer; Step 3: Based on Construction of multi-task self-supervised pre-training paradigm of KAN-BiLSTM-Transformer; Step 4: Application of intelligent prediction of sleep stages.

3. A sleep quality detection and evaluation method according to claim 2, characterized in that: The step 1 specifically includes: Enhance the quality of EEG, EOG, EMG, ECG, respiration, SpO2, body motion and environmental signals; For EEG and EOG signals, an adaptive filtering algorithm based on empirical mode decomposition (EMD) is used to remove noise. The formula is: in, is the denoised signal, c i (l) is the i-th intrinsic mode function (IMF) component, β i is the weight coefficient of the ith IMF component, and n is the total number of IMF components; Then, the adaptive threshold denoising algorithm based on wavelet packet decomposition (WPD) is used to further improve the signal-to-noise ratio. The wavelet coefficients after soft threshold processing are: in, is the i-th wavelet coefficient after processing, w i is the original i-th wavelet coefficient, τ i is the threshold of the ith subband, sign(·) is the sign function; Finally, data enhancement is performed through random truncation, cyclic shift, and additive Gaussian noise perturbation to balance the category distribution and improve the generalization of the model; The step 2 specifically includes: KAN is used to extract the adaptive feature representation of each modal signal. The formula is: in, represents the value of the d-th adaptive feature at the t-th time step; P is the number of expansion items of KAN; is the combination coefficient of the d-th adaptive feature on the p-th item; is a unary function of the d-th adaptive feature on the p-th item, using the Swish activation function: in, is the shape parameter of the d-th adaptive feature on the p-th item; is the projection vector of the pth item; is the original feature vector of the tth time step; Bidirectional long short-term memory network: Use BiLSTM to learn the temporal dependency of feature sequences. The forward and backward hidden state update formulas are: in, and are the forward and backward hidden states of the t-th time step, is the adaptive feature vector of the tth time step; Multi-information interactive fusion module: Use the multi-head self-attention mechanism to achieve interactive fusion of different modal features. The formula is: Among them, A h is the self-attention matrix of the h-th attention head; Q h , K h are the query matrix and key matrix of the h-th attention head, respectively, which are obtained from the multimodal feature matrix X through linear transformation: in, and is the projection matrix of the h-th attention head; D h is the subspace dimension of the h-th attention head, used to scale the dot product result; Finally, high-level features are further extracted through a feedforward neural network (FFN): F = ReLU(Y′W1+b1)W2+b2; Among them, Y′ is the multimodal interaction feature matrix that integrates body motion and environmental information, W1, b1, W2, b2 are the parameters of FFN; At the end of the model, a fully connected layer is used to map F to the sleep stage label space: P=softmax(W cls F+b cls ); Among them, W cls and b cls is the parameter of the classification layer, F is the feature matrix output by the multivariate information interaction fusion module; The step 3 specifically includes: Using weighted Dice loss and time series smoothing loss The weighted sum of is used as the loss function; the formula for weighted Dice loss is: in, is the weighted Dice loss of the cth class, w c is the weight coefficient of the cth class, p ct is the probability that the model predicts the cth class at the tth time step, y ct is the cth element of the one-hot vector of the true label at the lth time step, is a smoothing term; the formula for time series smoothing loss is: Among them, N c is the total number of categories, T is the total number of time steps; Optimization algorithm and hyperparameter selection: The RMSprop optimization algorithm is used, and the Cosine Annealing strategy is used to adjust the learning rate. The formula is: Among them, η t is the learning rate at step t, η min and η max are the minimum and maximum learning rates, T car is the current training step number, T max is the total number of training steps; Training process and evaluation: K-fold cross validation was used, and accuracy, macro-average F1 value, and Cohen's Kappa coefficient were used to evaluate model performance; the calculation formula for the macro-average F1 value is: Among them, precision c and recall c are the precision and recall of the cth class respectively; the calculation formula of Cohen's Kappa coefficient is: Among them, p o is the observation consistency, p e for chance consistency; The step 4 specifically includes: The new sleep data samples are quality enhanced and feature extracted, and then the trained model is used to predict the sleep stage probability of each time step, and the final stage label is determined based on the probability value to generate a sleep stage prediction result graph; the calculation formula of the prediction probability matrix is: P=softmax(W cls F+b cls ); Among them, W cls and b cls is the parameter of the classification layer, and F is the feature moment output by the multivariate information interaction fusion module.

4. A sleep quality detection and evaluation system, the system comprising a data acquisition module, a data quality enhancement module, a feature extraction module, a sequence learning module, a feature fusion module, a stage prediction module and a data visualization module, and also comprising storage resources and computing resources, for implementing the method as claimed in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method and device for measuring resting heart rate as well as wearable equipment comprising device

    CN106343979A

  • Transform model and comparative learning-based sleep staging method and system

    CN114881105A

Cited By

  • Cutter wear prediction method and system

    CN119910504A

  • Battery simulator health diagnosis method based on gating input weight self-adaption

    CN120011831A

  • Intelligent sleep regulation and control system based on infrared ray and sound monitoring

    CN120143612A

  • Escape optimization algorithm EA-based model optimization method and system

    CN120216937A

  • A model optimization method and system based on escape optimization algorithm EA

    CN120216937B