Sleep quality analysis method, device and equipment and storage medium
By collecting and analyzing the brain waves, body movements and snoring data during sleep, using machine learning models to predict and generate sleep quality reports, the problem of insufficient accuracy and comprehensiveness of sleep quality analysis in the prior art is solved, and a more accurate and objective sleep quality assessment is achieved.
Patent Information
- Application Number
- CN202411999190.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-09
AI Technical Summary
The existing sleep quality analysis methods have limitations in terms of accuracy, comprehensiveness and objectivity, and cannot provide accurate and reliable sleep quality assessments.
By collecting brain wave data, body movement data and snoring data when the user is sleeping, the characteristic data of these data is extracted, and the characteristic data is generated, and inputting them into the pre-trained sleep analysis model for prediction, generating sleep analysis results, and finally generating a sleep quality report based on these results.
The accuracy of user sleep quality analysis is improved, and the user's sleep status is comprehensively evaluated through the collection and feature extraction of a variety of physiological data, combined with the prediction and analysis of machine learning algorithms.
Smart Images

Figure CN119949758A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of sleep quality analysis technology, and in particular to sleep quality analysis methods, apparatus, devices and storage media. Background Technology
[0002] Traditional sleep quality analysis primarily relies on questionnaires, self-reports, or the analysis of single physiological signals. While questionnaires and self-reports are simple and easy to use, they are often limited by users' subjective feelings and memory biases, making it difficult to ensure the accuracy and objectivity of the analysis. Sleep quality analysis methods based on single physiological signals, such as assessing sleep state solely through electroencephalogram (EEG) data, can provide a degree of objectivity in sleep quality analysis, but their comprehensiveness and accuracy are limited due to the lack of consideration for other physiological signals that may affect sleep quality.
[0003] Therefore, common sleep quality analysis methods have obvious limitations in terms of accuracy, comprehensiveness, and objectivity, and cannot provide users with accurate and reliable sleep quality assessments. Summary of the Invention
[0004] The main purpose of this application is to provide sleep quality analysis methods, devices, equipment and storage media, with the aim of improving the accuracy of sleep quality analysis for users.
[0005] To achieve the above objectives, this application provides a sleep quality analysis method, which includes the following steps:
[0006] Collects brainwave data, body movement data, and snoring data when the user is asleep;
[0007] Extract feature data from the electroencephalogram data, the body movement data, and the snoring data to generate a feature dataset;
[0008] The feature dataset is input into a pre-trained sleep analysis model for prediction, generating the user's sleep analysis results;
[0009] A sleep quality report is generated for the user based on the sleep analysis results.
[0010] In one embodiment, the step of extracting feature data from the electroencephalogram data, the body movement data, and the snoring data to generate a feature dataset includes:
[0011] Extract the frequency domain features, time domain features, and nonlinear features of the electroencephalogram (EEG) data to obtain an EEG feature dataset;
[0012] Extract the body movement intensity information and body movement pattern information from the body movement data to obtain a body movement feature dataset;
[0013] Extract the acoustic and temporal features of the snoring data to obtain a snoring feature dataset;
[0014] The brainwave feature dataset, body movement feature dataset, and snoring feature dataset are aligned according to a preset time window to integrate and generate a feature dataset.
[0015] In one embodiment, the step of extracting feature data from the electroencephalogram data, the body movement data, and the snoring data to generate a feature dataset includes:
[0016] The brainwave data, body movement data, and snoring data are subjected to noise reduction and standardization processing.
[0017] In one embodiment, the step of inputting the feature dataset into a pre-trained sleep analysis model for prediction and generating the user's sleep analysis results includes:
[0018] The feature dataset, segmented according to a preset time window, is input into a pre-trained sleep analysis model;
[0019] Using a pre-trained sleep analysis model, the probability that the user is in any sleep stage within each time window is calculated, and the probability is used to label the corresponding sleep stage within each time window. The sleep stages include light sleep, deep sleep, and REM sleep.
[0020] Using a pre-trained sleep analysis model, labels for sleep disorders existing within each time window are generated.
[0021] The sleep stage tags and sleep disorder tags are organized according to a preset time window to generate a sequence of sleep analysis results.
[0022] In one embodiment, the step of inputting the feature dataset into a pre-trained sleep analysis model for prediction and generating the user's sleep analysis results includes:
[0023] Acquire sleep sample data that is matched with sleep tags. The sleep sample data is collected from EEG data, body movement data and snoring data of different users when they are in a sleep state. The sleep tags include sleep stage tags and sleep disorder tags.
[0024] Extract the sample feature data from the sleep sample data to obtain the sample feature dataset;
[0025] The training set and test set are constructed using the sample feature dataset and corresponding sleep labels. The training dataset is input into the pre-constructed sleep analysis model. The model parameters are optimized through iterative training until the preset training termination condition is reached.
[0026] The model's performance was evaluated using the test set to obtain a fully trained sleep analysis model.
[0027] In one embodiment, the step of generating a sleep status report for the user based on the sleep analysis results includes:
[0028] Based on the sleep analysis result sequence, obtain the user's sleep stage distribution information and sleep disorder analysis results;
[0029] The sleep stage distribution information and the sleep disorder analysis results are quantitatively evaluated using a preset sleep quality assessment algorithm to obtain the user's sleep quality score;
[0030] The sleep stage distribution information, the sleep disorder analysis results, and the sleep quality score are integrated to generate a sleep status report for the user.
[0031] In one embodiment, the step of obtaining the user's sleep stage distribution information and sleep disorder analysis results based on the sleep analysis result sequence includes:
[0032] The duration of each sleep stage in the sleep analysis result sequence within the entire sleep cycle is statistically analyzed to obtain the user's sleep stage distribution information.
[0033] Based on the sleep analysis result sequence, the sleep disorder type and frequency of the user are statistically analyzed to obtain the sleep disorder analysis result of the user.
[0034] Furthermore, to achieve the above objectives, this application also provides a sleep quality analysis device, the sleep quality analysis device comprising:
[0035] The data acquisition module is used to collect brainwave data, body movement data, and snoring data when the user is asleep.
[0036] The extraction module is used to extract feature data from the electroencephalogram data, the body movement data, and the snoring data to generate a feature dataset;
[0037] The prediction module is used to input the feature dataset into a pre-trained sleep analysis model for prediction and generate the user's sleep analysis results.
[0038] The generation module is used to generate a sleep quality report for the user based on the sleep analysis results.
[0039] In addition, to achieve the above objectives, this application also provides a terminal device, which includes a memory, a processor, and a sleep quality analysis program stored in the memory and executable on the processor. When the sleep quality analysis program is executed by the processor, it implements the steps of the sleep quality analysis method as described above.
[0040] In addition, to achieve the above objectives, this application also provides a computer-readable storage medium storing a sleep quality analysis program, which, when executed by a processor, implements the steps of the sleep quality analysis method as described above.
[0041] One or more technical solutions proposed in this application have at least the following technical effects:
[0042] This application simultaneously collects brainwave data, body movement data, and snoring data from users while they are asleep. These data reflect the user's sleep state from different perspectives. Brainwave data reveals the activity patterns of the user's brain during sleep and is an important basis for determining sleep stages; body movement data reflects the user's physical activity during sleep and helps identify sleep disorders such as insomnia and excessive dreaming; while snoring data provides information about the user's breathing status, which is of great significance for identifying sleep disorders related to breathing.
[0043] Furthermore, by extracting feature data from the aforementioned data and generating a feature dataset, key information related to sleep quality is extracted. Subsequently, the feature dataset is input into a pre-trained sleep analysis model to predict and generate sleep analysis results for the user. This sleep analysis model, based on machine learning algorithms, automatically identifies and classifies different sleep stages and identifies potential sleep disorders. This application improves the accuracy of user sleep quality analysis by collecting various physiological data, extracting key features, and using machine learning algorithms for prediction and analysis. Attached Figure Description
[0044] Figure 1 This is a flowchart illustrating a first exemplary embodiment of the sleep quality analysis method of this application;
[0045] Figure 2 This is a flowchart illustrating a second exemplary embodiment of the sleep quality analysis method of this application;
[0046] Figure 3 This is a schematic diagram of the module structure of the sleep quality analysis device according to an embodiment of this application;
[0047] Figure 4 This is a schematic diagram of the hardware operating environment involved in the sleep quality analysis method in the embodiments of this application.
[0048] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0049] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0050] The main technical solution of this application is as follows: collecting brainwave data, body movement data, and snoring data of a user when the user is asleep; extracting feature data from the brainwave data, body movement data, and snoring data to generate a feature dataset; inputting the feature dataset into a pre-trained sleep analysis model for prediction to generate the user's sleep analysis results; and generating a sleep quality report of the user based on the sleep analysis results.
[0051] This application takes into account that current common sleep quality analysis methods mainly rely on analyzing single or limited data sources of sleep states, which cannot fully capture the complex changes in the sleep process. This results in inaccurate and incomplete assessment of sleep quality. When processing sleep data, these methods often fail to fully explore and utilize the features related to sleep quality, which are crucial for a deeper understanding of sleep patterns.
[0052] Based on this, this application proposes a solution: collecting brainwave data, body movement data, and snoring data of a user while they are asleep; extracting frequency domain features, time domain features, and nonlinear features from the brainwave data to obtain a brainwave feature dataset; extracting body movement intensity information and body movement pattern information from the body movement data to obtain a body movement feature dataset; extracting acoustic features and temporal features from the snoring data to obtain a snoring feature dataset; aligning the brainwave feature dataset, body movement feature dataset, and snoring feature dataset according to a preset time window to integrate and generate a feature dataset; inputting the feature dataset into a pre-trained sleep analysis model for prediction to generate the user's sleep analysis results; and generating a sleep quality report for the user based on the sleep analysis results.
[0053] Specifically, the following are detailed steps of the first exemplary embodiment of the sleep quality analysis method of this application:
[0054] See Figure 1 , Figure 1 This is a flowchart illustrating a first exemplary embodiment of the sleep quality analysis method of this application. In this embodiment, the sleep quality analysis method includes steps S10 to S40:
[0055] Step S10: Collect EEG data, body movement data, and snoring data of the user while they are asleep;
[0056] Specifically, an electroencephalogram (EEG) device is used to collect brainwave data. This device typically consists of multiple electrodes placed on the user's scalp to capture electrical signals generated by the brain during sleep. These signals are then amplified, filtered, and digitized for further analysis. The acquisition of EEG data is crucial because it reveals patterns of brain activity during sleep, a key indicator for determining sleep stages.
[0057] Motion recorders or other motion sensors are used to collect motion data. These devices can detect a user's physical activity during sleep, including turning over and limb movement. Collecting motion data helps identify sleep disorders such as insomnia and vivid dreams, as these disorders are often accompanied by abnormal patterns of physical activity.
[0058] Microphones or other acoustic sensors are used to collect snoring data. These sensors capture the sounds of a user's breathing during sleep, including the intensity, frequency, and pattern of the snoring. Collecting snoring data is crucial for identifying sleep disorders related to breathing, as these disorders can affect sleep quality and even pose health threats.
[0059] During the data collection process, it is crucial to ensure the accuracy and reliability of the equipment, as well as the synchronization of the data. This means that all data must be recorded within the same time window so that subsequent feature extraction and analysis can accurately reflect the user's sleep state. Furthermore, user comfort and privacy must be considered during the collection process, ensuring that the equipment does not interfere with the user's normal sleep and that the user's personal information is not leaked.
[0060] Step S20: Extract feature data from the EEG data, the body movement data, and the snoring data to generate a feature dataset;
[0061] In one feasible implementation, before step S20, the method further includes: performing noise reduction and standardization processing on the electroencephalogram data, the body movement data, and the snoring data.
[0062] It should be noted that the purpose of denoising is to reduce or eliminate noise in the data to improve the accuracy of subsequent feature extraction and model training. EEG data, body movement data, and snoring data can all be affected by various noise sources, including environmental noise, equipment noise, and physiological noise.
[0063] For EEG data, common noise includes electromyography (EMG) interference, eye movement artifacts, and power supply interference. Denoising methods can include bandpass filtering, wavelet denoising, and independent component analysis (ICA). Bandpass filtering removes frequency components outside the EEG signal, wavelet denoising removes singularities, and ICA separates and removes noise components from the signal.
[0064] Denoising of body movement and snoring data includes filtering out low-frequency drift and high-frequency noise, as well as using signal processing techniques such as spectral subtraction to reduce the impact of environmental noise.
[0065] Furthermore, the EEG data, body movement data, and snoring data were standardized through normalization and scaling.
[0066] Normalization typically involves scaling data to a fixed range, such as 0 to 1, or using Z-score standardization to convert the data into a distribution with a mean of 0 and a standard deviation of 1. For EEG data, normalization is performed based on the amplitude range of the EEG waves; for body motion data, scaling is performed based on the range of the motion sensor; and for snoring data, normalization is performed based on the intensity range of the sound signal.
[0067] In one feasible implementation, step S20 may include steps S21 to S24:
[0068] Step S21: Extract the frequency domain features, time domain features, and nonlinear features of the EEG data to obtain an EEG feature dataset;
[0069] Specifically, firstly, frequency domain analysis is performed on the EEG data to extract frequency components associated with sleep stages. Key frequency components include: delta waves (0.5–4 Hz), theta waves (4–8 Hz), alpha waves (8–13 Hz), beta waves (13–30 Hz), and sleep spindles (12–14 Hz). These frequency bands are associated with different sleep stages; for example, delta waves are associated with deep sleep, and sleep spindles are characteristic of light sleep.
[0070] By performing Fast Fourier Transform (FFT) or Power Spectral Density (PSD) analysis on EEG signals, the power of the aforementioned frequency components can be quantified, thereby extracting frequency domain features associated with different sleep stages.
[0071] Furthermore, time-domain analysis is performed on the EEG data to extract features such as peaks, troughs, and amplitude. These features reflect the amplitude and temporal characteristics of the EEG signal. Time-domain features can be extracted by calculating statistics such as the mean, standard deviation, maximum, and minimum values of the EEG signal. These statistics can provide intuitive information about the signal's volatility.
[0072] Furthermore, nonlinear analysis is performed on the EEG data to extract nonlinear features such as Lempel-Ziv complexity, approximate entropy, and sample entropy. These nonlinear features can reveal the complexity and unpredictability of EEG signals. Nonlinear feature extraction can be achieved by calculating the signal's autocorrelation function, cross-correlation function, etc.
[0073] Through the feature extraction in the above three stages, a brainwave feature dataset containing frequency domain, time domain, and nonlinear features can be obtained.
[0074] Step S22: Extract the body movement intensity information and body movement pattern information from the body movement data to obtain a body movement feature dataset;
[0075] The extraction of body movement intensity information can be achieved by analyzing data collected by a body movement recorder or other motion sensors. These devices can detect a user's body activity during sleep, including movements such as turning over and limb movement. The extraction of body movement intensity information typically involves quantifying these activity signals, which can be achieved by calculating the number of movements, the duration of movements, or the intensity of movements within a certain time window. For example, the number of movements within each hourly interval or the total duration of movements can be calculated; these indicators can reflect the user's activity level during sleep.
[0076] Body movement pattern information can be extracted using time series analysis techniques, such as autoregressive models, hidden Markov models, or machine learning algorithms, to identify patterns in body movement data. Body movement pattern information can include features such as the frequency, rhythm, and periodicity of movements. Analyzing periodic fluctuations in body movement data can identify a user's turning-over patterns, or analyzing the frequency distribution of movements can identify a user's activity patterns. This pattern information is helpful in identifying sleep disorders, such as insomnia and excessive dreaming, because these disorders are often accompanied by abnormal body movement patterns.
[0077] Step S23: Extract the acoustic and temporal features of the snoring data to obtain a snoring feature dataset;
[0078] It should be noted that the purpose of extracting the acoustic features of the snoring data is to capture the sound quality attributes of the snoring signal, which can reflect the characteristics of sleep apnea. Specifically, Fourier transform is used to convert the snoring signal from the time domain to the frequency domain to analyze the frequency components of the snoring. The frequency components of the snoring can provide information about the degree of airway obstruction. Next, the power spectral density of the snoring signal is calculated to quantify the energy distribution of different frequency components. In addition, features such as pitch, timbre, and intensity of the snoring are extracted by calculating the fundamental frequency, harmonic content, and energy envelope of the signal.
[0079] Extracting temporal features from snoring data focuses on the temporal attributes of the snoring signal, including the duration, intervals, and periodicity of snoring. These features help identify patterns and regularities in snoring. For example, calculating the duration of a snoring event can reveal the severity of airway obstruction, while the intervals between snoring events can reflect the frequency of apnea. Periodicity can be extracted by analyzing the time series of snoring events to identify the presence of regular apnea patterns. These temporal features can be achieved by calculating statistical parameters of snoring events, such as the mean, standard deviation, maximum, and minimum values.
[0080] Step S24: Align the EEG feature dataset, body movement feature dataset, and snoring feature dataset according to a preset time window to integrate and generate a feature dataset.
[0081] First, a suitable time window is determined to ensure accurate alignment of data across different datasets. The choice of time window should be based on the characteristics of the sleep cycle and the frequency of data acquisition. For example, if EEG data is acquired at a frequency of 1000 samples per second, while body movement and snoring data are acquired at a frequency of 100 samples per second, then the time window should be chosen to cover the least common multiple of one cycle for all data types. This ensures that the data within each time window represents the physiological state during the same time period. Further, the feature datasets of EEG, body movement, and snoring are aligned according to the determined time window. This means that for each time window, corresponding data points need to be extracted from the three feature datasets.
[0082] Before alignment, the EEG feature dataset, body movement feature dataset, and snoring feature dataset were normalized to ensure consistent dimensions across the different datasets, facilitating subsequent analysis. Furthermore, missing data were interpolated to ensure data integrity within each time window.
[0083] Furthermore, the preprocessed EEG feature dataset, body movement feature dataset, and snoring feature dataset are merged. Specifically, the feature data within each time window are mapped together to form a comprehensive feature dataset. For example, if the time window is set to 30 seconds, then each time window will contain EEG features, body movement features, and snoring features for 30 seconds. These feature data will be integrated into a unified data structure, such as an array or data frame, to facilitate subsequent analysis.
[0084] Step S30: Input the feature dataset into a pre-trained sleep analysis model for prediction and generate the user's sleep analysis results;
[0085] In one feasible implementation, step S30 may include steps S31 to S34:
[0086] Step S31: Input the feature dataset segmented according to a preset time window into the pre-trained sleep analysis model;
[0087] It should be noted that the step of segmenting the feature dataset according to the preset time window can refer to the implementation process of aligning the feature datasets of EEG, body movement and snoring according to the determined time window in step S24 above.
[0088] Additionally, the feature dataset for each time window is input into a pre-trained sleep analysis model. This model can be based on machine learning algorithms such as random forests, support vector machines, or deep learning networks, and has been trained to identify different sleep stages and sleep disorders. Before inputting the feature dataset, it is necessary to ensure that the data format and dimensions are consistent with those used during model training to avoid input errors.
[0089] Step S32: Using a pre-trained sleep analysis model, calculate the probability that the user is in any sleep stage within each time window, and use the probability to label the corresponding sleep stage within each time window. The sleep stages include light sleep, deep sleep, and REM sleep.
[0090] Specifically, a sleep analysis model is used to analyze data for each time window, outputting the probability of each sleep stage, including light sleep, deep sleep, and REM sleep. The model's output is a probability distribution representing the likelihood of being in each sleep stage within a given time window. Using a deep learning model, the probability calculation involves multiple layers of neurons and complex nonlinear transformations. The calculation formula can be expressed as:
[0091]
[0092] Wherein, P(S) i |X) is the sleep stage S given a feature dataset X. i The probability, W i and b i These are the model's weights and biases, and n is the total number of sleep stages.
[0093] Furthermore, the probabilities of each sleep stage calculated in the above steps are converted into specific sleep stage labels. The probabilities of each sleep stage within each time window are compared, and the stage with the highest probability is selected as the dominant sleep stage for that time window.
[0094] For example, if the probabilities of light sleep, deep sleep, and REM sleep stages output by the sleep analysis model are 0.4, 0.3, and 0.3, respectively, a threshold can be set, such as 0.5. Only when the probability of a certain stage exceeds this threshold can it be identified as the primary sleep stage. If no stage exceeds the threshold, the stage with the highest probability can be selected, or the labels of adjacent time windows can be used to assist in the decision-making.
[0095] Step S33: Using a pre-trained sleep analysis model, label the sleep disorders present in each time window.
[0096] It's important to note that sleep disorders refer to illnesses that affect a person's ability to perform normal activities while awake, primarily impacting sleep quality, timing, and duration. Common sleep disorders include insomnia, sleep apnea, periodic limb movement disorder, and hypersomnia. These disorders not only affect sleep quality but can also impact overall health, safety, and quality of life.
[0097] Snoring, as an acoustic signal, possesses significant acoustic characteristics, such as frequency components, power spectral density, fundamental frequency, harmonic content, and energy envelope. These characteristics provide information about the degree of airway obstruction and are crucial for identifying sleep-disordered breathing, such as sleep apnea syndrome. Temporal characteristics, such as the duration, intervals, and periodicity of snoring, help identify patterns and regularities in snoring, further revealing the frequency and severity of apnea. Body movement intensity information reflects the user's activity level during sleep. Body movement pattern information, including the frequency, rhythm, and periodicity of movements, can be used to identify patterns in body movement data through time series analysis techniques. This information helps identify sleep disorders, such as insomnia and vivid dreams, because these disorders are often accompanied by abnormal body movement patterns.
[0098] The sleep analysis model utilizes the aforementioned snoring, body movement, and electroencephalogram (EEG) data to identify sleep disorders and label them with specific tags. By analyzing the acoustic and temporal characteristics of snoring, combined with the intensity and pattern information of body movement data, and the characteristics of EEG data, sleep disorders such as sleep apnea and periodic limb movement disorder can be identified. For example, the model might detect frequent snoring and body movement events, and by combining this with abnormal patterns in EEG data, determine that the user may have sleep apnea and label the corresponding sleep disorder within each time window. This analysis allows the model to provide detailed sleep analysis results, supporting further clinical diagnosis and treatment.
[0099] Step S34: Organize the sleep stage tags and sleep disorder tags according to a preset time window to generate a sleep analysis result sequence.
[0100] The sleep stage labels and sleep disorder labels are organized according to time windows to generate a sequence of sleep analysis results. Specifically, a time series data structure can be created where each element contains the sleep stage label and sleep disorder label for the corresponding time window. For example, a list can be created where each element is a tuple containing the start time, end time, sleep stage label, and sleep disorder label for the time window.
[0101] Step S40: Generate a sleep quality report for the user based on the sleep analysis results.
[0102] In one feasible implementation, step S40 may include steps S41 to S43:
[0103] Step S41: Based on the sleep analysis result sequence, obtain the user's sleep stage distribution information and sleep disorder analysis results;
[0104] In one feasible implementation, step S41 may include steps S411 to S412:
[0105] Step S411: Calculate the duration of each sleep stage in the sleep analysis result sequence throughout the entire sleep cycle to obtain the user's sleep stage distribution information;
[0106] Specifically, the entire sequence of sleep analysis results is traversed, and for each identified sleep stage, the duration of that time window is added to the corresponding stage counter. For example, if a time window is marked as a light sleep stage and its duration is 30 seconds, then the total duration of the light sleep stage will be increased by 30 seconds.
[0107] Next, the total duration of each stage is divided by the total time of the entire sleep cycle to obtain the proportion of each stage, which can reflect the user's sleep structure and quality.
[0108] Step S412: Based on the sleep analysis result sequence, statistically analyze the user's sleep disorder type and frequency to obtain the user's sleep disorder analysis result.
[0109] Specifically, all time windows marked as sleep disorders are identified, and the frequency of each disorder is counted. For example, if sleep apnea is marked in multiple time windows, the counts of these time windows are summed to obtain the total frequency of sleep apnea.
[0110] Then, the frequency of each sleep disorder is calculated as a percentage of the total sleep cycle, or the number of times a sleep disorder occurs per hour. This helps to assess the severity of the disorder and its impact on the user's sleep quality.
[0111] Step S42: Quantitatively evaluate the sleep stage distribution information and the sleep disorder analysis results using a preset sleep quality assessment algorithm to obtain the user's sleep quality score;
[0112] Based on medical standards and research, the distribution of sleep stages and the frequency of sleep disorders are converted into a numerical score. For example, the proportion of deep sleep may be given a higher weight because it is crucial for restoring physical and mental well-being. The frequency and severity of sleep disorders may be given a negative weight based on their negative impact on sleep quality.
[0113] The quantitative evaluation formula is as follows:
[0114] S=ω1·S1+ω2·S2+...+ω n ·S n -p1·D1-p2·D2-...-p m ·D m
[0115] Where S represents the sleep quality score, S i ω represents the percentage score for each sleep stage. i The corresponding weights, D j Frequency scores representing various sleep disorders, p j This refers to the corresponding penalty weight.
[0116] Then, based on the rating results, sleep quality is divided into different levels, such as "excellent", "good", "average", and "poor".
[0117] Step S43: Integrate the sleep stage distribution information, the sleep disorder analysis results, and the sleep quality score to generate the user's sleep status report.
[0118] Specifically, the sleep stage distribution information and sleep disorder analysis results obtained above are compiled into easy-to-understand charts and text descriptions. Then, the calculated sleep quality score is added to the report to provide an overall assessment of sleep quality.
[0119] The report will include the duration of each sleep stage, the type and frequency of sleep disturbances, and a sleep quality score. Additionally, the report may include an interpretation of the sleep quality score and possible suggestions for improvement.
[0120] Further, see Figure 2 , Figure 2This is a flowchart illustrating a second exemplary embodiment of the dynamic scalp abnormality detection method of this application. In this second exemplary embodiment, before step S30: inputting the feature dataset into a pre-trained sleep analysis model for prediction and generating the user's sleep analysis results, steps S51 to S54 are further included:
[0121] Step S51: Obtain sleep sample data that matches sleep tags. The sleep sample data is collected from EEG data, body movement data and snoring data of different users when they are in a sleep state. The sleep tags include sleep stage tags and sleep disorder tags.
[0122] Specifically, sleep sample data is collected from different users, including electroencephalogram (EEG) data, body movement data, and snoring data. The purpose of collecting this data is to train and validate the sleep analysis model, enabling it to accurately identify sleep stages and detect sleep disorders. Sleep sample data collection should be conducted in a controlled medical environment to ensure data quality and accuracy. Each set of sample data needs to be matched with corresponding sleep tags, including sleep stage tags and sleep disorder tags. Sleep stage tags include light sleep, deep sleep, and REM sleep stages, while sleep disorder tags include tags such as sleep apnea and periodic limb movement disorder. These tags are typically manually labeled by professional sleep technicians or doctors according to standard scoring rules to ensure accuracy and consistency.
[0123] Step S52: Extract the sample feature data from the sleep sample data to obtain the sample feature dataset;
[0124] Specifically, the collected raw sleep sample data undergoes preprocessing and feature extraction to generate a sample feature dataset. The feature extraction step involves identifying and extracting key information representing sleep states from the raw data, including but not limited to extracting frequency domain features, time domain features, and nonlinear features from EEG data; extracting body movement intensity and pattern information from body movement data; and extracting acoustic and temporal features from snoring data. These features can capture important physiological changes during sleep, providing valuable input for subsequent model training.
[0125] Feature extraction may involve signal processing techniques such as filtering, Fourier transform, and wavelet analysis, as well as statistical analysis methods such as calculating the mean, standard deviation, maximum, and minimum values. The extracted feature dataset needs to be normalized to eliminate the influence of different units and magnitudes, ensuring the effectiveness of model training.
[0126] Step S53: Construct training and testing sets using the sample feature dataset and corresponding sleep labels. Input the training dataset into the pre-built sleep analysis model and optimize the model parameters through iterative training until the preset training termination condition is reached.
[0127] Specifically, the aforementioned sample feature dataset and corresponding sleep labels are used to construct training and testing sets. The training set is used for iterative model training, while the testing set is used to evaluate model performance. When constructing the training and testing sets, it is necessary to ensure the representativeness and balance of the data to avoid overfitting or underfitting. Furthermore, the data needs to be appropriately split to ensure that data within each time window can be independently used for model training and testing. During model training, model parameters, such as the weights and biases of the neural network, are adjusted using optimization algorithms to minimize the difference between the predicted results and the actual labels. This process typically involves calculating the loss function and optimization techniques such as gradient descent. Training termination conditions can include reaching a preset accuracy, the loss value falling below a certain threshold, or reaching a certain number of iterations.
[0128] Step S54: Use the test set to evaluate the performance of the model to obtain the trained sleep analysis model.
[0129] Specifically, after model training, a test set is used to evaluate its performance. The test set contains sleep sample data and corresponding labels not used during training, thus validating the model's generalization ability. Performance evaluation involves multiple metrics, such as accuracy, recall, precision, and F1 score, which comprehensively reflect the model's ability to identify sleep stages and detect sleep disorders. Furthermore, a confusion matrix can be used to visualize model performance, where the number of true positives, false positives, true negatives, and false negatives provides intuitive information about model performance. The results of the performance evaluation will guide subsequent model tuning and optimization to improve the model's accuracy and reliability.
[0130] Furthermore, this application also proposes a sleep quality analysis device, the sleep quality analysis device comprising:
[0131] The acquisition module 10 is used to collect brainwave data, body movement data and snoring data when the user is in a sleep state;
[0132] Extraction module 20 is used to extract feature data from the electroencephalogram data, the body movement data, and the snoring data to generate a feature dataset;
[0133] Prediction module 30 is used to input the feature dataset into a pre-trained sleep analysis model for prediction and generate the user's sleep analysis results;
[0134] The generation module 40 is used to generate a sleep quality report for the user based on the sleep analysis results.
[0135] The sleep quality analysis device provided in this application employs the sleep quality analysis method described in the above embodiments, aiming to improve the accuracy of sleep quality analysis for users. Compared with the prior art, the beneficial effects of the sleep quality analysis device provided in this application are the same as those of the sleep quality analysis method provided in the above embodiments, and other technical features in the sleep quality analysis device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0136] This application provides a sleep quality analysis device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the sleep quality analysis method in Embodiment 1 above.
[0137] The sleep quality analysis device in this application embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 4 The sleep quality analysis device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this application.
[0138] like Figure 4As shown, the sleep quality analysis device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the sleep quality analysis device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. The communication device 1009 allows the sleep quality analysis device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows sleep quality analysis devices with various systems, it should be understood that implementing or having all of the systems shown is not required. More or fewer systems may be implemented alternatively.
[0139] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0140] The sleep quality analysis device provided in this application employs the sleep quality analysis method described in the above embodiments, aiming to improve the accuracy of sleep quality analysis for users. Compared with the prior art, the beneficial effects of the sleep quality analysis device provided in this application are the same as those of the sleep quality analysis method provided in the above embodiments, and other technical features of this sleep quality analysis device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0141] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0142] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
[0143] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the sleep quality analysis method in the above embodiments.
[0144] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0145] The aforementioned computer-readable storage medium may be included in the sleep quality analysis device; or it may exist independently and not assembled into the sleep quality analysis device.
[0146] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0148] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0149] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described sleep quality analysis method, aiming to improve the accuracy of user sleep quality analysis. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the sleep quality analysis method provided in the above embodiments, and will not be repeated here.
[0150] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the sleep quality analysis method described above.
[0151] The computer program product provided in this application aims to improve the accuracy of sleep quality analysis for users. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the sleep quality analysis method provided in the above embodiments, and will not be repeated here.
[0152] Compared to existing technologies, the sleep quality analysis method, apparatus, device, medium, and computer product proposed in this application extracts the business characteristic information of the target business, standardizes the business characteristic information to obtain standard characteristic data, hashes the standard characteristic data to obtain unique characteristic data, numerically processes and concatenates the unique characteristic data to obtain a first business characteristic value, accumulates the first business characteristic value of the target business to obtain a target business characteristic value, and finally compares the target business characteristic value with the characteristic value set to obtain the sleep quality analysis result. This is more efficient, flexible, and reliable than the traditional method of generating unique keys or consecutive serial numbers for each business transaction to identify duplicate transactions. Based on the solution of this application, by transforming complex scenarios into a series of simple transformations, the comparison process is ultimately reduced to a comparison of two numbers, making the comparison process very intuitive and efficient. The system only needs to simply compare whether these two values are equal to quickly determine whether two transactions are completely identical.
[0153] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0154] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0155] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the methods of each embodiment of this application.
[0156] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A sleep quality analysis method, characterized in that: The sleep quality analysis method comprises: Collect brain wave data, body movement data and snoring data of the user when he is sleeping; Extracting feature data of the brain wave data, the body movement data, and the snoring data to generate a feature data set; Inputting the feature data set into a pre-trained sleep analysis model for prediction to generate a sleep analysis result for the user; A sleep quality report of the user is generated based on the sleep analysis result.
2. The sleep quality analysis method according to claim 1, characterized in that: The step of extracting the characteristic data of the brain wave data, the body movement data and the snoring data to generate a characteristic data set comprises: Extracting frequency domain features, time domain features and nonlinear features of the brain wave data to obtain a brain wave feature data set; Extracting body motion intensity information and body motion pattern information from the body motion data to obtain a body motion feature data set; Extracting acoustic features and time features of the snoring data to obtain a snoring feature data set; The brain wave feature data set, the body movement feature data set and the snoring feature data set are aligned according to a preset time window to integrate and generate a feature data set.
3. The sleep quality analysis method according to claim 1, characterized in that: The step of extracting the characteristic data of the brain wave data, the body movement data and the snoring data to generate a characteristic data set includes: The brain wave data, the body movement data and the snoring data are subjected to denoising and standardization processing.
4. The sleep quality analysis method according to claim 1, characterized in that: The step of inputting the feature data set into a pre-trained sleep analysis model for prediction to generate the sleep analysis result of the user comprises: Inputting the feature data set segmented according to a preset time window into a pre-trained sleep analysis model; Using a pre-trained sleep analysis model, the probability of the user being in any sleep stage in each time window is calculated, and the corresponding sleep stage label in each time window is labeled using the probability, wherein the sleep stages include light sleep stage, deep sleep stage and rapid eye movement sleep stage; Using the pre-trained sleep analysis model, label the sleep disorder labels in each time window; The sleep stage labels and the sleep disorder labels are sorted according to a preset time window to generate a sleep analysis result sequence.
5. The sleep quality analysis method according to claim 1, characterized in that: Before the step of inputting the feature data set into a pre-trained sleep analysis model for prediction and generating the sleep analysis result of the user, the step includes: Acquire sleep sample data matched with sleep tags, wherein the sleep sample data is collected from brain wave data, body movement data and snoring data of different users in a sleeping state, and the sleep tags include sleep stage tags and sleep disorder tags; Extracting sample feature data of the sleep sample data to obtain a sample feature data set; Using the sample feature data set and the corresponding sleep labels to construct a training set and a test set, inputting the training data set into a pre-built sleep analysis model, and optimizing the model parameters through an iterative training process until a preset training termination condition is reached; The performance of the model is evaluated using the test set to obtain a trained sleep analysis model.
6. The sleep quality analysis method according to claim 4, characterized in that: The step of generating the user's sleep status report based on the sleep analysis result comprises: Based on the sleep analysis result sequence, obtaining the sleep stage distribution information and sleep disorder analysis result of the user; Using a preset sleep quality assessment algorithm to quantitatively assess the sleep stage distribution information and the sleep disorder analysis results to obtain a sleep quality score for the user; The sleep stage distribution information, the sleep disorder analysis result and the sleep quality score are integrated to generate a sleep status report of the user.
7. The sleep quality analysis method according to claim 6, characterized in that: The step of obtaining the sleep stage distribution information and the sleep disorder analysis result of the user based on the sleep analysis result sequence comprises: Counting the duration of each sleep stage in the sleep analysis result sequence in the entire sleep cycle to obtain sleep stage distribution information of the user; The sleep disorder type and disorder frequency of the user are counted according to the sleep analysis result sequence to obtain the sleep disorder analysis result of the user.
8. A sleep quality analysis device, characterized in that: The device comprises: A collection module is used to collect brain wave data, body movement data and snoring data of the user when he is in a sleeping state; An extraction module, used for extracting feature data of the brain wave data, the body movement data and the snoring data, and generating a feature data set; A prediction module, used for inputting the feature data set into a pre-trained sleep analysis model for prediction, and generating a sleep analysis result for the user; A generating module is used to generate a sleep quality report of the user based on the sleep analysis result.
9. A sleep quality analysis device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the sleep quality analysis method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the sleep quality analysis method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Sleep quality monitoring and analysis method, device and equipment based on non-invasive brain-computer interface and storage medium
CN121845615A