Self-attention Sleep System and Method for Polymorphic Sleep Data Fusion
The multi-modal sleep data fusion system with FDM and self-attention mechanisms improves sleep stage identification and quality assessment, offering precise feedback and alerts, addressing the inaccuracy of traditional sleep stage recognition methods.
Patent Information
- Application Number
- CN202411861848.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2044-12-17
AI Technical Summary
Traditional techniques cannot accurately identify and classify different sleep stages when identifying sleep stages, resulting in inaccurate evaluation results.
The self-attention sleep system fusion with polymorphic sleep data is adopted to accurately identify and classify sleep stages through steps such as data collection, signal preprocessing, frequency division multiplexing, feature extraction, model training, sleep staging, sleep quality evaluation and correlation analysis, combined with the multi-head self-attention mechanism and early warning system.
It realizes accurate identification and classification of different sleep stages, provides more accurate sleep quality feedback, can monitor and trigger early warning mechanisms in real time or offline, and improves the accuracy of sleep quality assessment.
Smart Images

Figure CN119792762B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of plateau sleep, and particularly to a self-attention sleep system and method for multi-state sleep data fusion. Background Art
[0002] Sleep is a basic activity necessary for organisms and has an undeniable impact on health and quality of life. Good sleep helps to restore physical strength, consolidate memory, regulate emotions, etc. In modern society, people's attention to sleep quality is constantly increasing, and the demand for personalized and precise sleep solutions has surged.
[0003] When traditional technologies identify sleep stages, they often adopt relatively rough methods, such as simple threshold judgment or template matching. These methods cannot accurately identify and classify different sleep stages, resulting in inaccurate evaluation results. Therefore, a self-attention sleep system and method for multi-state sleep data fusion are proposed. Summary of the Invention
[0004] The purpose of the present invention is to solve the problem existing in the prior art that when traditional technical solutions identify sleep stages, they cannot accurately identify and classify different sleep stages, resulting in inaccurate evaluation results, and to propose a self-attention sleep system and method for multi-state sleep data fusion.
[0005] In order to achieve the above purpose, the present invention adopts the following technical solutions:
[0006] A self-attention sleep system for multi-state sleep data fusion, comprising:
[0007] A data acquisition module: responsible for collecting environmental data and the physiological data of users. The physiological data includes EEG (electroencephalogram) and EOG (electrooculogram) signals, and the EEG (electroencephalogram) and EOG (electrooculogram) signals are transmitted to the signal preprocessing module.
[0008] A signal preprocessing module: performs segmentation, normalization, and denoising processing on the collected EEG and EOG signals. The preprocessed signals are transmitted to the frequency division multiplexing (FDM) module.
[0009] A frequency division multiplexing (FDM) module: uses frequency division multiplexing (FDM) technology to decompose the preprocessed signal frames into multiple narrowband signals. The narrowband signals contain different frequency components in the original signal, and the decomposed narrowband signals are transmitted to the feature extraction module.
[0010] A feature extraction module: extracts features from the decomposed narrowband signals, such as measures of non-stationarity (MNS), energy, and Hjorth parameters, etc. The features form a feature set and are transmitted to the model training module and the sleep staging module.
[0011] Model training module: Utilize the feature set to train a model, and the trained model is used in the sleep staging module to stage the input EEG and EOG signals.
[0012] Sleep staging module: Use the trained model to perform real-time or offline sleep staging on the input EEG and EOG signals, output the results of the sleep stages, where the results reflect the sleep states in different time periods, and the results are transmitted to the sleep quality evaluation module for calculating sleep quality indicators.
[0013] Sleep quality evaluation module: Based on the results of sleep staging, calculate sleep quality indicators such as sleep efficiency, number of awakenings, and REM sleep proportion, etc. The sleep quality indicators are used in the early warning system module to set warning thresholds and trigger the warning mechanism.
[0014] Correlation analysis module: Conduct correlation analysis on the relationship between different sleep stages and sleep quality indicators to determine the associations between different physiological parameters, and generate a quality evaluation model according to the analysis results and sleep quality monitoring data.
[0015] Early warning system module: According to the sleep quality evaluation results and the quality evaluation model, set warning thresholds and trigger the warning mechanism when the sleep quality is below the threshold.
[0016] The above technical solution further includes:
[0017] Furthermore, the frequency division multiplexing (FDM) module uses frequency division multiplexing (FDM) technology to decompose the preprocessed signal frames into multiple narrowband signals. The specific steps are as follows:
[0018] Determine the frequency band division: The core of FDM technology is to divide the signal in the frequency domain, that is, divide the entire frequency band into multiple narrowbands, determine the frequency range of each narrowband and the interval between narrowbands. The division of the narrowbands is determined according to the spectral characteristics of the signal and application requirements.
[0019] Use a filter bank for frequency band decomposition: After determining the frequency band division, use a filter bank to perform frequency band decomposition on the preprocessed signal frames. The filter bank contains multiple filters, each filter corresponds to a narrowband and has a frequency response matching that narrowband. The formula for frequency band decomposition can be expressed as
[0020] X FB,i,k (f) = H k (f) · X i (f)
[0021] where, X i (f) represents the spectrum of the i-th signal frame, H k(f) represents the frequency response of the k-th filter, X FB,i,k (f) represents the spectrum of the narrowband signal obtained after the i-th signal frame passes through the k-th filter.
[0022] Extracting narrowband signals: After being processed by the filter bank, each signal frame is decomposed into multiple narrowband signals. The narrowband signals are extracted by performing an inverse Fourier transform (IFFT) on the filtered spectrum. The formula for extracting narrowband signals can be expressed as
[0023] x FB,i,k (t) = IFFT{X FB,i,k (f)}
[0024] where X FB,i,k (f) represents the spectrum of the narrowband signal obtained after the i-th signal frame passes through the k-th filter, and x FB,i,k (t) represents the representation of the corresponding narrowband signal in the time domain.
[0025] Furthermore, the sleep staging module performs real-time or offline sleep staging on the input EEG and EOG signals through a trained model. The specific steps are as follows:
[0026] Sleep segmentation: Receiving a multivariate time-series sleep stage S = (s1, s2, …, s L ) data and outputting a predicted label sequence. Any sleep stage is defined as where n is the number of samples in a sleep stage, C is the number of channels of the sleep stage, and each stage corresponds to a label in Σ = {W, N1, N2, N3, REM}. W represents wakefulness, REM represents rapid eye movement, N1 represents non-rapid eye movement stage 1, N2 represents non-rapid eye movement stage 2, and N3 represents non-rapid eye movement stage 3. The corresponding relationship is f θ : x → y, θ represents all the parameters of the network, then the label sequence is P = (f θ (s1), f θ (s2), …, f θ (s L ))).
[0027] Physiological parameter collection: Collecting physiological parameters related to sleep, including electroencephalogram, electrooculogram, electromyogram, respiration, blood oxygen, body temperature, etc.
[0028] Environmental factor recording: Recording relevant factors of the sleep environment, such as temperature, humidity, air pressure, radiation, pollutants, and day time.
[0029] Data preprocessing: Preprocessing the collected physiological parameter and environmental factor data, including multi-scale analysis, multi-modal fusion, etc.
[0030] Feature extraction and enhancement: Extract features that have an important impact on sleep behavior, and process them through multi-scale convolutional kernels and feature enhancement to improve the expressive ability of the features.
[0031] Multi-head self-attention layer processing: Use the multi-head self-attention mechanism to process and analyze the extracted features to capture the dependency relationships between the features.
[0032] Segmented classifier judgment: Use a segmented classifier to classify and judge the processed features to determine the category to which each sleep stage belongs.
[0033] Loss function evaluation: Calculate the loss function value between the classification result and the true label to evaluate the performance of the model.
[0034] Furthermore, based on the results of sleep staging, the sleep quality evaluation module calculates sleep quality indicators. The specific steps are as follows:
[0035] Segmented label word embedding representation: Use word embedding representation to convert the segmented labels into vector representations. The segmented labels are identifiers for segmenting the sleep process (such as non-rapid eye movement period, rapid eye movement period, etc.). Word embedding representation is a technique for converting discrete labels into a continuous vector space for processing in machine learning models. Through word embedding representation, the segmented labels can be converted into vectors with semantic information, thereby better capturing the features in the sleep process.
[0036] Multi-head self-attention weighting of sequence patterns: Use the multi-head self-attention mechanism to extract important features in the sleep behavior sequence and assign weights to these features.
[0037] Multi-head attention fusion: Fuse the outputs of multiple heads by concatenating or averaging the outputs of multiple heads to obtain the final fusion result.
[0038] Rating classifier: Use the fusion result as the input to the rating classifier to predict the sleep quality level. Predict the sleep quality level (such as good, medium, poor, etc.) based on the input features (such as sleep efficiency, number of awakenings, REM sleep ratio, etc.).
[0039] Loss function evaluation: Use the loss function and backpropagation to train the rating classifier so that it can accurately predict the sleep quality level.
[0040] Furthermore, the specific steps of the multi-head self-attention weighting of the sequence pattern are as follows:
[0041] Calculate the matrix representations of the query Q, key K, and value V.
[0042] Use the dot product attention mechanism to calculate the correlation scores between each query and all keys.
[0043] Perform softmax normalization on the relevance scores to obtain the attention weights for each query.
[0044] Use the attention weights to perform a weighted sum of the values to obtain the weighted output.
[0045] Furthermore, the correlation analysis module performs a correlation analysis on the relationship between different sleep stages and sleep quality indicators. The specific steps are as follows:
[0046] Collect data: Collect data on different sleep stages and physiological parameters.
[0047] Data cleaning: Clean the collected data to remove outliers, missing values, or duplicate data.
[0048] Calculate the correlation coefficient: Use the Pearson correlation coefficient to calculate the correlation coefficient between different physiological parameters.
[0049] The calculation formula is
[0050]
[0051] where x i and y i represent the values of two variables at the i-th observation respectively, and represent the means of the two variables respectively.
[0052] Interpret the correlation coefficient: According to the range of values of the correlation coefficient (usually between -1 and 1), interpret the degree of association between different physiological parameters. Values close to 1 or -1 indicate strong correlation, while values close to 0 indicate weak or no correlation.
[0053] Plot a scatter plot: Use a scatter plot to visualize the relationship between different physiological parameters. The points in the scatter plot represent the observations, and the distribution of the points can intuitively reflect the correlation between the variables.
[0054] Plot a heatmap: For multiple physiological parameters, use a heatmap to display the correlation coefficient matrix between the physiological parameters. The darkness of the color in the heatmap represents the strength of the correlation coefficient.
[0055] Feature selection: Based on the results of the correlation analysis, select the physiological parameters that have a significant impact on sleep quality as the features for model training.
[0056] Model training: Use the selected features to train the sleep quality evaluation model.
[0057] Model evaluation: Evaluate the performance of the model through cross-validation or a test set, and optimize the model according to the evaluation results.
[0058] Further, the warning system module sets a warning threshold according to the sleep quality evaluation result and the quality rating model. The specific steps are as follows:
[0059] Determine warning indicators: Determine physiological parameters or sleep quality indicators that serve as the basis for warnings. These indicators should be able to accurately reflect the user's sleep quality and have a certain degree of sensitivity and specificity. For example, specific frequency components in electroencephalogram (EEG), amplitude changes in electrooculogram (EOG), heart rate (HR) variability, respiratory rate (RR) stability, and sleep efficiency can be selected as warning indicators.
[0060] Collect historical data: Collect a large amount of historical data, including sleep quality monitoring data of different users and corresponding physiological parameter values. These data will be used to analyze the relationship between each indicator and sleep quality and determine a reasonable warning threshold.
[0061] Data preprocessing and feature extraction: Preprocess the historical data, including data cleaning, missing value processing, outlier detection, etc., to ensure the accuracy and reliability of the data. Then, extract features from the preprocessed data. These features will be used for subsequent analysis and modeling.
[0062] Correlation analysis and causal inference: Accept the quality evaluation model generated by the correlation analysis module for the correlation analysis and causal inference of the relationship between different sleep stages and sleep quality indicators.
[0063] Determine the warning threshold: Based on the sleep quality evaluation result and the quality evaluation model, determine the warning threshold. The calculation formula for the warning threshold is
[0064] T = μ + kσ
[0065] where T represents the warning threshold, μ represents the mean value of the corresponding indicator in the historical data, σ represents the standard deviation, and k represents the coefficient set according to the quality evaluation model.
[0066] Verification and optimization: Verify and optimize the set warning threshold through methods such as cross-validation and simulation experiments to ensure that the warning system can have a low false alarm rate and missed alarm rate while ensuring accuracy.
[0067] The method of the self-attention sleep system with polymorphic sleep data fusion includes the following steps:
[0068] Data acquisition: Acquire environmental data and the user's physiological data. The physiological data includes EEG (electroencephalogram) and EOG (electrooculogram) signals.
[0069] Signal preprocessing: The collected EEG and EOG signals are segmented into non-overlapping frames, which are then normalized to eliminate the dimensional differences between different signals, and denoised to ensure the accuracy and reliability of the signals.
[0070] Frequency-division multiplexing (FDM): The preprocessed signal frames are decomposed into multiple narrowband signals using frequency-division multiplexing (FDM) technology.
[0071] Feature extraction: Features such as the measure of non-stationarity (MNS), energy, and Hjorth parameters are extracted from the decomposed narrowband signals, which can reflect the dynamic and statistical characteristics of the signals.
[0072] Model training: Different machine learning models are trained using the extracted feature set, and different machine learning models identify and classify different sleep stages, such as the wakefulness stage, non-rapid eye movement (NREM) stage, and rapid eye movement (REM) stage, etc.
[0073] Sleep staging: Real-time or offline sleep staging is performed on the input collected environmental data and the user's physiological data through different machine learning models to monitor the user's sleep stage.
[0074] Sleep quality evaluation: Based on the results of sleep staging, sleep quality indicators such as sleep efficiency, number of awakenings, and REM sleep proportion are calculated.
[0075] Correlation analysis: Causal analysis is performed on the relationship between different sleep stages and sleep quality indicators to explore the associations between different physiological parameters, identify the factors affecting sleep quality, including physiological factors (such as EEG, EOG, etc.) and environmental factors (such as temperature, humidity, etc.), classify the identified influencing factors to better understand their impact degrees, and generate a quality evaluation model based on the classification results and sleep quality monitoring data to evaluate the user's sleep quality.
[0076] Early warning system: According to the sleep quality evaluation results and the quality evaluation model, an early warning threshold is set. When the sleep quality is lower than the threshold, the early warning mechanism is triggered to remind the user or doctor to intervene.
[0077] The present invention has the following beneficial effects:
[0078] In the present invention, the signals are decomposed into multiple narrowband signals through frequency-division multiplexing (FDM) technology, and combined with feature extraction methods such as the measure of non-stationarity, energy, Hjorth parameters, etc., which can more accurately identify and classify different sleep stages. This refined processing enables the system to provide more accurate sleep quality feedback for users. Description of the drawings
[0079] Figure 1System block diagram of the self-attention sleep system for polymorphic sleep data fusion and the method proposed by the present invention;
[0080] Figure 2 Flowchart of the self-attention sleep system for polymorphic sleep data fusion and the method proposed by the present invention. Detailed implementation manners
[0081] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0082] Please refer to Figure 1 - Figure 2 As shown, the present invention is a self-attention sleep system for polymorphic sleep data fusion, including:
[0083] Data acquisition module: responsible for acquiring environmental data and the physiological data of the user. The physiological data includes EEG (electroencephalogram) and EOG (electrooculogram) signals, and the EEG (electroencephalogram) and EOG (electrooculogram) signals are transmitted to the signal preprocessing module.
[0084] Signal preprocessing module: performs segmentation, normalization, and denoising processing on the acquired EEG and EOG signals. The preprocessed signals are transmitted to the frequency division multiplexing (FDM) module.
[0085] Frequency division multiplexing (FDM) module: uses frequency division multiplexing (FDM) technology to decompose the preprocessed signal frames into multiple narrowband signals. The narrowband signals contain different frequency components in the original signal, and the decomposed narrowband signals are transmitted to the feature extraction module.
[0086] Feature extraction module: extracts features from the decomposed narrowband signals, such as measures of non-stationarity (MNS), energy, and Hjorth parameters, etc. The features form a feature set and are transmitted to the model training module and the sleep staging module.
[0087] Model training module: trains the model using the feature set. The trained model is used in the sleep staging module to perform sleep staging on the input EEG and EOG signals.
[0088] Sleep staging module: performs real-time or offline sleep staging on the input EEG and EOG signals through the trained model, outputs the results of the sleep stages, and the results reflect the sleep states in different time periods. The results are transmitted to the sleep quality evaluation module for calculating sleep quality indicators.
[0089] Sleep quality evaluation module: Based on the results of sleep staging, calculate sleep quality indicators such as sleep efficiency, number of awakenings, and REM sleep proportion. The sleep quality indicators are used in the early warning system module to set early warning thresholds and trigger the early warning mechanism.
[0090] Correlation analysis module: Conduct a correlation analysis on the relationship between different sleep stages and sleep quality indicators, determine the associations between different physiological parameters, and generate a quality evaluation model based on the analysis results and sleep quality monitoring data.
[0091] Early warning system module: Set early warning thresholds according to the sleep quality evaluation results and the quality evaluation model, and trigger the early warning mechanism when the sleep quality is lower than the threshold.
[0092] In one embodiment, for the above frequency division multiplexing (FDM) module, the frequency division multiplexing (FDM) module uses frequency division multiplexing (FDM) technology to decompose the preprocessed signal frame into multiple narrowband signals. The specific steps are as follows:
[0093] Determine the frequency band division: The core of FDM technology is to divide the signal in the frequency domain, that is, divide the entire frequency band into multiple narrowbands, determine the frequency range of each narrowband and the interval between narrowbands. The division of the narrowbands is determined according to the spectral characteristics of the signal and application requirements.
[0094] Use a filter bank for frequency band decomposition: After determining the frequency band division, use a filter bank to perform frequency band decomposition on the preprocessed signal frame. The filter bank contains multiple filters, each filter corresponding to a narrowband and having a frequency response matching that narrowband. The formula for frequency band decomposition can be expressed as
[0095] X FB,i,k (f) = H k (f) · X i (f)
[0096] where X i (f) represents the spectrum of the i-th signal frame, H k (f) represents the frequency response of the k-th filter, and X FB,i,k (f) represents the spectrum of the narrowband signal obtained after the i-th signal frame passes through the k-th filter.
[0097] Extract narrowband signals: After being processed by the filter bank, each signal frame is decomposed into multiple narrowband signals. The narrowband signals are extracted by performing an inverse Fourier transform (IFFT) on the filtered spectrum. The formula for extracting narrowband signals can be expressed as
[0098] x FB,i,k (t) = IFFT{X FB,i,k (f)}
[0099] Among them, X FB,i,k (f) represents the spectrum of the narrowband signal obtained after the i-th signal frame passes through the k-th filter, and x FB,i,k (t) represents the representation of the corresponding narrowband signal in the time domain.
[0100] Suppose we have a composite signal containing multiple frequency components, and we hope to decompose it into multiple narrowband signals using FDM technology.
[0101] Determine the frequency band division: According to the spectral characteristics and application requirements of the composite signal, determine the frequency range and interval of each narrowband.
[0102] Use a filter bank for frequency band decomposition: Design and apply a filter bank to decompose the preprocessed signal into frequency bands. Each filter corresponds to a narrowband and has a frequency response matching that narrowband. Extract the narrowband signal: Perform an inverse Fourier transform on the filtered spectrum to extract the representation of each narrowband signal in the time domain.
[0103] Subsequent processing: Perform subsequent processing steps such as noise removal and feature extraction on the extracted narrowband signals.
[0104] In one embodiment, for the above-mentioned sleep staging module, the sleep staging module performs real-time or offline sleep staging on the input EEG and EOG signals through a trained model. The specific steps are as follows:
[0105] Sleep segmentation: Receive a multivariate time series of sleep stages S = (s1, s2,..., s L ) data and output a predicted label sequence. Any sleep stage is defined as Among them, n is the number of samples in a sleep stage, C is the number of channels of the sleep stage, and each stage corresponds to one label in Σ = {W, N1, N2, N3, REM}, where W represents wakefulness, REM represents rapid eye movement, N1 represents non-rapid eye movement stage 1, N2 represents non-rapid eye movement stage 2, and N3 represents non-rapid eye movement stage 3. The corresponding relationship is f θ : x → y, θ represents all the parameters of the network, then the label sequence is P = (f θ (s1), f θ (s2),..., f θ (s L ))).
[0106] A user's sleep is divided into a deep sleep stage in the first half of the night and a light sleep and REM sleep stage in the second half of the night.
[0107] Physiological parameter collection: Collect physiological parameters related to sleep, including electroencephalogram (EEG), electrooculogram (EOG), electromyogram (EMG), respiration, blood oxygen, body temperature, etc.
[0108] During sleep, the system records the user's brain wave changes, eye movements, muscle activities, respiratory rate, blood oxygen saturation, and body temperature fluctuations.
[0109] Environmental factor recording: Record relevant factors of the sleep environment, such as temperature, humidity, air pressure, radiation, pollutants, and day / night time.
[0110] When the user is sleeping, the environmental humidity is maintained at about 50%, the temperature is appropriate, the air pressure is stable, the radiation and pollutant levels are within the safe range, and the day / night time information indicates that the user is in the night sleep period.
[0111] Data preprocessing: Preprocess the collected physiological parameter and environmental factor data, including multi-scale analysis, multi-modal fusion, etc.
[0112] The system performs multi-scale analysis on physiological signals such as EEG and EOG to capture the characteristics of different frequency components. At the same time, it performs multi-modal fusion of environmental factors and physiological parameters to form more comprehensive sleep data.
[0113] Feature extraction and enhancement: Extract features that have an important impact on sleep behavior, and process them through multi-scale convolutional kernels and feature enhancement to improve the expression ability of the features.
[0114] The system extracts features such as respiratory rate variability and blood oxygen saturation fluctuations from the preprocessed data, and enhances these features through kernel transformation to make them better reflect the changes in sleep behavior.
[0115] Multi-head self-attention layer processing: Use the multi-head self-attention mechanism to process and analyze the extracted features to capture the dependence relationships between the features.
[0116] The multi-head self-attention layer can capture the association between respiratory rate and blood oxygen saturation, as well as the change trends of these features in different time periods.
[0117] Segmented classifier judgment: Use a segmented classifier to classify and judge the processed features to determine the category to which each sleep stage belongs.
[0118] Based on the extracted features and the results of the multi-head self-attention layer, the segmented classifier divides the user's sleep process into different stages, and gives the duration and quality assessment of each stage.
[0119] Loss function evaluation: Calculate the loss function value between the classification result and the true label to evaluate the performance of the model.
[0120] By calculating the error between the sleep stages output by the classifier and the true sleep stages, the value of the loss function is obtained. The smaller this value is, the better the performance of the model.
[0121] In one embodiment, for the above sleep quality evaluation module, based on the results of sleep staging, the sleep quality evaluation module calculates sleep quality metrics. The specific steps are as follows:
[0122] Segmented label word embedding representation: Use word embedding representation to convert segmented labels into vector representations. Segmented labels are identifiers for segmenting the sleep process (such as non-rapid eye movement period, rapid eye movement period, etc.). Word embedding representation is a technique for converting discrete labels into a continuous vector space for processing in machine learning models. Through word embedding representation, segmented labels can be converted into vectors with semantic information, thus better capturing the characteristics in the sleep process.
[0123] Multi-head self-attention weighting for sequence patterns: Use the multi-head self-attention mechanism to extract important features in the sleep behavior sequence and assign weights to these features.
[0124] Multi-head attention fusion: Fuse the outputs of multiple heads by concatenating or averaging the outputs of multiple heads to obtain the final fusion result.
[0125] Rating classifier: Use the fusion result as the input to the rating classifier to predict the sleep quality level. Predict the sleep quality level (such as good, medium, poor, etc.) based on the input features (such as sleep efficiency, number of awakenings, REM sleep ratio, etc.).
[0126] Loss function evaluation: Use the loss function and backpropagation to train the rating classifier so that it can accurately predict the sleep quality level.
[0127] In one embodiment, for the above multi-head self-attention weighting for sequence patterns, the multi-head self-attention weighting for sequence patterns has the following specific steps:
[0128] Calculate the matrix representations of the query Q, key K, and value V.
[0129] Use the dot product attention mechanism to calculate the correlation scores between each query and all keys.
[0130] Perform softmax normalization on the correlation scores to obtain the attention weights for each query.
[0131] Use the attention weights to perform weighted summation on the values to obtain the weighted output.
[0132] In one embodiment, for the above correlation analysis module, the correlation analysis module performs correlation analysis on the relationships between different sleep stages and sleep quality metrics. The specific steps are as follows:
[0133] Data collection: Collect data on different sleep stages and physiological parameters.
[0134] Data cleaning: Clean the collected data to remove outliers, missing values, or duplicate data.
[0135] Calculate correlation coefficients: Calculate the correlation coefficients between different physiological parameters using the Pearson correlation coefficient.
[0136] The calculation formula is calculated as
[0137]
[0138] where x i and y i represent the values of two variables at the i-th observation respectively, and represent the means of the two variables respectively.
[0139] Interpret correlation coefficients: According to the range of values of the correlation coefficient (usually between -1 and 1), interpret the degree of association between different physiological parameters. Values close to 1 or -1 indicate strong correlation, while values close to 0 indicate weak or no correlation.
[0140] Plot scatter plots: Use scatter plots to visualize the relationships between different physiological parameters. The points in the scatter plot represent observations, and the distribution of the points can intuitively reflect the correlation between variables.
[0141] Plot heatmaps: For multiple physiological parameters, use heatmaps to display the correlation coefficient matrix between physiological parameters. The depth of color in the heatmap indicates the strength of the correlation coefficient.
[0142] Feature selection: Based on the results of the correlation analysis, select the physiological parameters that have a significant impact on sleep quality as the features for model training.
[0143] Model training: Use the selected features to train a sleep quality evaluation model.
[0144] Model evaluation: Evaluate the performance of the model through cross-validation or a test set, and optimize the model according to the evaluation results.
[0145] Suppose we have a sleep dataset containing the following physiological parameters: electroencephalogram (EEG), electrooculogram (EOG), electromyogram (EMG), heart rate (HR), and respiratory rate (RR). Our goal is to analyze the correlation between these physiological parameters and sleep quality indicators (such as sleep efficiency, number of awakenings, etc.).
[0146] Data preparation: Collect a dataset containing the above physiological parameters and sleep quality indicators from a sleep monitoring device.
[0147] Correlation analysis: Calculate the correlation between each physiological parameter and the sleep quality index using the Pearson correlation coefficient. We may find a strong positive correlation between EEG and sleep efficiency, while a weak negative correlation between HR and the number of awakenings.
[0148] Result visualization: Plot a scatter plot to show the relationship between EEG and sleep efficiency, and a heat map to show the correlation coefficient matrix between all physiological parameters.
[0149] Optimize model training: Select EEG, EOG, and HR as the features for model training, and use these features to train a machine learning algorithm to predict the sleep quality index. Evaluate the performance of the model through cross-validation and tune the model according to the evaluation results.
[0150] In one embodiment, for the above warning system module, the warning system module sets a warning threshold according to the sleep quality evaluation result and the quality rating model. The specific steps are as follows:
[0151] Determine warning indicators: Determine the physiological parameters or sleep quality indicators that serve as the basis for warnings. These indicators should be able to accurately reflect the user's sleep quality and have a certain degree of sensitivity and specificity. For example, specific frequency components in electroencephalogram (EEG), amplitude changes in electrooculogram (EOG), heart rate (HR) variability, respiratory rate (RR) stability, and sleep efficiency can be selected as warning indicators.
[0152] Collect historical data: Collect a large amount of historical data, including sleep quality monitoring data of different users and corresponding physiological parameter values. These data will be used to analyze the relationship between each indicator and sleep quality and determine a reasonable warning threshold.
[0153] Data preprocessing and feature extraction: Preprocess the historical data, including data cleaning, missing value handling, outlier detection, etc., to ensure the accuracy and reliability of the data. Then, extract features from the preprocessed data, and these features will be used for subsequent analysis and modeling.
[0154] Correlation analysis and causal inference: Accept the quality evaluation model generated by the correlation analysis module for the correlation analysis and causal inference of the relationship between different sleep stages and sleep quality indicators.
[0155] Determine the warning threshold: Based on the sleep quality evaluation result and the quality evaluation model, determine the warning threshold. The calculation formula for the warning threshold is
[0156] T = μ + kσ
[0157] Among them, T represents the warning threshold, μ represents the mean value of the corresponding index in historical data, σ represents the standard deviation, and k represents the coefficient set according to the quality evaluation model.
[0158] Verification and optimization: Through methods such as cross-validation and simulation experiments, verify and optimize the set warning threshold to ensure that the warning system can have a low false alarm rate and missed alarm rate while ensuring accuracy.
[0159] Suppose we choose heart rate variability (HRV) as one of the warning indicators and collect sleep quality monitoring data and corresponding heart rate variability values of 100 users. After data preprocessing and feature extraction, we calculate the mean and standard deviation of heart rate variability and set the coefficient k to 1.5.
[0160] According to the formula T = μ + kσ, we can calculate the warning threshold of heart rate variability. Suppose the mean μ is 50 milliseconds and the standard deviation σ is 10 milliseconds, then the warning threshold T is:
[0161] T = 50 + 1.5×10 = 65 milliseconds
[0162] This means that when the user's heart rate variability exceeds 65 milliseconds, the warning system will issue an abnormal warning.
[0163] The method of the self-attention sleep system for polymorphic sleep data fusion includes the following steps:
[0164] Data collection: Collect environmental data and the user's physiological data, and the physiological data includes EEG (electroencephalogram) and EOG (electrooculogram) signals.
[0165] Signal preprocessing: Divide the collected EEG and EOG signals into non-overlapping frames, perform normalization processing on the non-overlapping frames, eliminate the dimensional difference between different signals, and perform denoising processing to ensure the accuracy and reliability of the signals.
[0166] Frequency division multiplexing (FDM): Use frequency division multiplexing (FDM) technology to decompose the preprocessed signal frames into multiple narrowband signals.
[0167] Feature extraction: Extract features from the decomposed narrowband signals, such as measures of non-stationarity (MNS), energy, and Hjorth parameters, etc., which can reflect the dynamic and statistical characteristics of the signals.
[0168] Model training: Use the extracted feature set to train different machine learning models, and different machine learning models identify and classify different sleep stages, such as the wake stage, non-rapid eye movement stage (NREM), and rapid eye movement stage (REM), etc.
[0169] Sleep staging: Real-time or offline sleep staging is performed on the input collected environmental data and the user's physiological data through different machine learning models to monitor the user's sleep stages.
[0170] Sleep quality evaluation: Based on the results of sleep staging, sleep quality indicators are calculated, such as sleep efficiency, number of awakenings, and REM sleep proportion, etc.
[0171] Correlation analysis: Causal analysis is carried out on the relationship between different sleep stages and sleep quality indicators to explore the associations between different physiological parameters, identify the factors affecting sleep quality, including physiological factors (such as electroencephalogram, electrooculogram, etc.) and environmental factors (such as temperature, humidity, etc.), classify the identified influencing factors to better understand their influence degrees, and generate a quality evaluation model based on the classification results and sleep quality monitoring data to evaluate the user's sleep quality.
[0172] Early warning system: According to the sleep quality evaluation results and the quality evaluation model, an early warning threshold is set. When the sleep quality is lower than the threshold, the early warning mechanism is triggered to remind the user or the doctor to intervene.
[0173] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A self-attention sleep system for polymorphic sleep data fusion, characterized in that Including: Data acquisition module: responsible for collecting environmental data and the physiological data of users, where the physiological data includes EEG and EOG signals, and the EEG and EOG signals are transmitted to the signal preprocessing module; Signal preprocessing module: performs segmentation, normalization, and denoising on the collected EEG and EOG signals, and the preprocessed signals are transmitted to the frequency division multiplexing module; Frequency division multiplexing module: uses frequency division multiplexing technology to decompose the preprocessed signal frames into multiple narrowband signals, where the narrowband signals contain different frequency components in the original signal, and the decomposed narrowband signals are transmitted to the feature extraction module; Feature extraction module: extracts features from the decomposed narrowband signals, and the features form a feature set that is transmitted to the model training module and the sleep staging module; Model training module: trains a model using the feature set, and the trained model is used in the sleep staging module to perform sleep staging on the input EEG and EOG signals; Sleep staging module: performs real-time or offline sleep staging on the input EEG and EOG signals through the trained model, outputs the results of the sleep stages, where the results reflect the sleep states in different time periods, and the results are transmitted to the sleep quality evaluation module for calculating sleep quality indicators; Sleep quality evaluation module: calculates sleep quality indicators based on the results of sleep staging, and the sleep quality indicators are used in the early warning system module to set warning thresholds and trigger the warning mechanism; Correlation analysis module: conducts correlation analysis on the relationship between different sleep stages and sleep quality indicators, determines the associations between different physiological parameters, and generates a quality evaluation model according to the analysis results and sleep quality monitoring data; Early warning system module: sets warning thresholds according to the sleep quality evaluation results and the quality evaluation model, and triggers the warning mechanism when the sleep quality is lower than the threshold; The frequency division multiplexing module uses frequency division multiplexing technology to decompose the preprocessed signal frames into multiple narrowband signals. The specific steps are as follows: Determine the frequency band division: determine the frequency range of each narrowband and the interval between narrowbands, where the division of the narrowbands is determined according to the spectral characteristics of the signal and application requirements; Use a filter bank for frequency band decomposition: after determining the frequency band division, use a filter bank to perform frequency band decomposition on the preprocessed signal frames. The filter bank contains multiple filters, each filter corresponding to a narrowband and having a frequency response matching that narrowband. The formula for frequency band decomposition is X FB,i,k (f) = H k (f)·X i (f) Among them, X i (f) represents the spectrum of the i-th signal frame, and H k (f) represents the frequency response of the k-th filter, and X FB,i,k (f) represents the spectrum of the narrowband signal obtained after the i-th signal frame passes through the k-th filter; Extract narrowband signals: after being processed by the filter bank, each signal frame is decomposed into multiple narrowband signals, and the narrowband signals are extracted by performing an inverse Fourier transform on the filtered spectrum. The formula for extracting narrowband signals is x FB,i,k (t) = IFFT{X FB,i,k (f)} Among them, X FB,i,k (f) represents the spectrum of the narrowband signal obtained after the i-th signal frame passes through the k-th filter, and x FB,i,k (t) represents the time-domain representation of the corresponding narrowband signal, and IFFT represents the inverse fast Fourier transform operation.
2. The self-attention sleep system for polymorphic sleep data fusion according to claim 1, characterized in that, The sleep staging module performs real-time or offline sleep staging on the input EEG and EOG signals through the trained model. The specific steps are as follows: Sleep segmentation: Accept a multivariate time series of sleep stages S = (s1, s2,..., s L ) data, where s L is the data value in the L-th time period, and output a predicted label sequence. Any sleep stage is defined as where R represents the set of real numbers, n is the number of samples in a sleep stage, C is the number of channels of the sleep stage, and each stage corresponds to a label in ∑ = {W, N1, N2, N3, REM}. W represents wakefulness, REM represents rapid eye movement, N1 represents non-rapid eye movement stage 1, N2 represents non-rapid eye movement stage 2, and N3 represents non-rapid eye movement stage 3. The corresponding relationship is f θ : x → y, f θ represents the corresponding relationship, x represents the input data, specifically the multivariate time series of sleep stage data, y represents the output label sequence, that is, the sleep stage label. The sleep stage label is selected from ∑ = {W, N1, N2, N3, REM}. θ represents all the parameters of the network. Then the label sequence is P = (f θ (s1), f θ (s2),..., f θ (s L )); Physiological parameter acquisition: acquire physiological parameters related to sleep; Environmental factor recording: record the relevant factors of the sleep environment; Data preprocessing: perform preprocessing on the collected physiological parameter and environmental factor data; Feature extraction and enhancement: Extract features that affect sleep behavior and process them through multi-scale convolutional kernels and feature enhancement; Multi-head self-attention layer processing: Use the multi-head self-attention mechanism to process and analyze the extracted features to capture the dependencies between features; Segmented classifier judgment: Use a segmented classifier to classify and judge the processed features to determine the category to which each sleep stage belongs; Loss function evaluation: Calculate the loss function value between the classification result and the true label to evaluate the performance of the model.
3. The self-attention sleep system for polymorphic sleep data fusion according to claim 2, wherein Based on the results of sleep staging, the sleep quality evaluation module calculates sleep quality indicators. The specific steps are as follows: Segmented label word embedding representation: Use word embedding representation to convert segmented labels into vector representations; Multi-head self-attention weighting of sequence patterns: Use the multi-head self-attention mechanism to extract important features in the sleep behavior sequence and assign weights to these features; Multi-head attention fusion: Fuse the outputs of multiple heads to obtain the final fusion result by concatenating or averaging the outputs of multiple heads; Rating classifier: Use the fusion result as the input of the rating classifier to predict the sleep quality level; Loss function evaluation: Use the loss function and backpropagation to train the rating classifier so that it can accurately predict the sleep quality level.
4. The self-attention sleep system for polymorphic sleep data fusion according to claim 3, characterized in that, The multi-head self-attention weighting of the sequence pattern, the specific steps are as follows: Calculate the matrix representations of query Q, key K, and value V. Query Q, key K, and value V are three matrices obtained from the input sequence through linear transformation. Query Q represents the information of the current position or element being processed, key K provides information in the sequence, and value V represents the actual information content in the sequence; Use the dot product attention mechanism to calculate the correlation score between each query and all keys; Perform softmax normalization on the correlation scores. Softmax normalization is used to convert the dot product scores between query Q and key K into a probability distribution to obtain the attention weights for each query; Use the attention weights to perform weighted summation on the values to obtain the weighted output.
5. The self-attention sleep system for polymorphic sleep data fusion according to claim 1, characterized in that, The correlation analysis module performs a correlation analysis on the relationship between different sleep stages and sleep quality indicators. The specific steps are as follows: Data collection: Collect data on different sleep stages and physiological parameters; Data cleaning: Clean the collected data to remove outliers, missing values, or duplicate data; Calculate the correlation coefficient: Use the Pearson correlation coefficient to calculate the correlation coefficient between different physiological parameters. The calculation formula is where x i and y i represent the values of two variables at the i-th observation respectively, and represent the means of the two variables respectively; Interpret the correlation coefficient: According to the value range of the correlation coefficient, interpret the degree of association between different physiological parameters. Values close to 1 or -1 indicate strong correlation, while values close to 0 indicate weak correlation or no correlation; Plot a scatter plot: Use a scatter plot to visualize the relationship between different physiological parameters; Plot a heat map: For multiple physiological parameters, use a heat map to display the correlation coefficient matrix between physiological parameters. The color depth in the heat map indicates the strength of the correlation coefficient; Feature selection: According to the results of the correlation analysis, select physiological parameters that have a significant impact on sleep quality as features for model training; Model training: Use the selected features to train the sleep quality evaluation model; Model evaluation: Evaluate the performance of the model through cross-validation or a test set, and optimize the model according to the evaluation results.
6. The self-attention sleep system for polymorphic sleep data fusion according to claim 1, wherein The early warning system module sets an early warning threshold based on the sleep quality evaluation result and the quality rating model. The specific steps are as follows: Determine the early warning indicators: Determine the physiological parameters or sleep quality indicators that serve as the basis for early warning. Collect historical data: Collect a large amount of historical data, including sleep quality monitoring data of different users and corresponding physiological parameter values. Data preprocessing and feature extraction: Preprocess the historical data, and then extract features from the preprocessed data. Correlation analysis and causal inference: Accept the quality evaluation model generated by the correlation analysis of the relationship between different sleep stages and sleep quality indicators and causal inference by the correlation analysis module. Determine the early warning threshold: Based on the sleep quality evaluation result and the quality evaluation model, determine the early warning threshold. The calculation formula for the early warning threshold is T = μ + kσ where T represents the early warning threshold, μ represents the mean value of the corresponding indicator in the historical data, σ represents the standard deviation, and k represents the coefficient set according to the quality evaluation model. Verification and optimization: Verify and optimize the set early warning threshold.
7. The method of the self-attention sleep system for polymorphic sleep data fusion according to claim 1, characterized in that Include the following steps: Data collection: Collect environmental data and the user's physiological data. The physiological data includes EEG and EOG signals. Signal preprocessing: Divide the collected EEG and EOG signals into non-overlapping frames, perform normalization processing on the non-overlapping frames to eliminate the dimensional difference between different signals, and perform denoising processing. Frequency division multiplexing: Use frequency division multiplexing technology to decompose the preprocessed signal frames into multiple narrowband signals. Feature extraction: Extract features from the decomposed narrowband signals. Model training: Use the extracted feature set to train different machine learning models. Different machine learning models identify and classify different sleep stages. Sleep staging: Perform real-time or offline sleep staging on the input collected environmental data and the user's physiological data through different machine learning models to monitor the user's sleep stage. Sleep quality evaluation: Calculate sleep quality indicators based on the results of sleep staging. Correlation analysis: Conduct causal analysis on the relationship between different sleep stages and sleep quality indicators, explore the association between different physiological parameters, identify the factors affecting sleep quality, including physiological factors and environmental factors, classify the identified influencing factors, and generate a quality evaluation model based on the classification results and sleep quality monitoring data to evaluate the user's sleep quality. Early warning system: Set an early warning threshold according to the sleep quality evaluation result and the quality evaluation model. When the sleep quality is lower than the threshold, trigger the early warning mechanism to remind the user or doctor to intervene.
Citation Information
Patent Citations
Automatic sleep staging method, system and device and storage medium
CN118986274A
Intelligent sleep monitoring blanket based on multi-modal physiological signal fusion and optimization method thereof
CN119112105A