[go: up one dir, main page]

CN117731238A - Sleep stage detection method, system and readable storage medium - Google Patents

Sleep stage detection method, system and readable storage medium Download PDF

Info

Publication number
CN117731238A
CN117731238A CN202311677342.2A CN202311677342A CN117731238A CN 117731238 A CN117731238 A CN 117731238A CN 202311677342 A CN202311677342 A CN 202311677342A CN 117731238 A CN117731238 A CN 117731238A
Authority
CN
China
Prior art keywords
sleep
result
data
minutes
heart rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311677342.2A
Other languages
Chinese (zh)
Inventor
王春丽
孔庆达
杨志远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Spaceon Electronics Co Ltd
Original Assignee
Chengdu Spaceon Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Spaceon Electronics Co Ltd filed Critical Chengdu Spaceon Electronics Co Ltd
Priority to CN202311677342.2A priority Critical patent/CN117731238A/en
Publication of CN117731238A publication Critical patent/CN117731238A/en
Pending legal-status Critical Current

Links

Landscapes

  • Measurement Of The Respiration, Hearing Ability, Form, And Blood Characteristics Of Living Organisms (AREA)

Abstract

The invention provides a sleep stage detection method, a sleep stage detection system and a readable storage medium, which relate to the technical field of sleep automatic detection and stage detection and comprise the steps of collecting acceleration data in real time based on wrist strap equipment, and detecting a sleep window according to the collected acceleration data to obtain a detection result; judging whether the detection result enters a sleep state, and if so, collecting the heart rate; if the sleep window is not entered, continuing to detect the sleep window until the sleep state is detected; training and verifying the feature data by adopting a lightGBM gradient lifting decision tree model to obtain sleep stage results, wherein the sleep stage results comprise wakefulness, shallow sleep, deep sleep and rapid eye movement. The sleep detection method has the beneficial effects that the accuracy of sleep detection of the wearable equipment is improved, and meanwhile, the sleep stage of the wearable equipment can be realized with a certain accuracy.

Description

Sleep stage detection method, system and readable storage medium
Technical Field
The invention relates to the technical field of sleep automatic detection and stage detection, in particular to a sleep stage detection method, a sleep stage detection system and a readable storage medium.
Background
Currently, a "gold standard" for sleep monitoring and assessment is Polysomnography (PSG), which requires that a subject wear an electroencephalogram (EEG) electrode, an Electromyography (EMG) electrode, an Electrocardiograph (ECG) electrode, a respiration sensor, an oximeter, etc. in a sleep laboratory to continuously and synchronously acquire more than 10 signals of EEG, ECG, EMG, eye movement, respiration, blood oxygen, etc. All records are automatically analyzed by an instrument, then corrected manually item by item, and finally the sleeping process is staged by taking 30s as a unit. Because EEG signals have significant features and periodic changes at various stages of sleep, PSG sleep stages are dominated by EEG and other physiological signals are secondary. The PSG has the advantages of reliable measurement result and accurate sleep stage. However, there are many limitations in performing sleep monitoring through the PSG, such as high price, low efficiency, interference with sleep quality, limited sites, etc., and due to these limitations, PSG-based sleep examinations can only be performed in a sleep laboratory.
With the rapid development of sensor technology, wearable equipment provides a new idea for sleep monitoring. Many wearable devices currently on the market are equipped with sleep monitoring functions, which use multiple sensors for data acquisition, typically MEMS accelerometers and PPG (Photoplethysmography). MEMS accelerometers are sensors commonly used in wearable devices for measuring motion and are widely used to assess physical activity and energy expenditure. PPG is an optical technique that measures changes in blood volume and has been demonstrated to accurately measure heart rate in many situations. Although sleep stages are typically assessed by changes in the central nervous system (CNS, measured from electroencephalogram), the activity of the Autonomic Nervous System (ANS) also changes with changes in sleep stages and can be reflected by heart rate and changes in heart rate over time. The ANS is divided into two categories, the sympathetic and parasympathetic, with lower Heart Rate (HR) and higher Heart Rate Variability (HRV) when parasympathetic regulation is dominant. When sympatholytic regulation predominates, HR increases, while HRV generally decreases from the baseline level of the individual. In the awake state, parasympathetic activity decreases and sympathetic activity increases. Parasympathetic regulation should predominate during sleep to ensure physical recovery. The deeper sleep (light or deep sleep), the stronger the modulation of parasympathetic nerves. However, when in sleep restlessness or awakening from sleep, modulation of the sympathetic nerves predominates.
Disclosure of Invention
The present invention aims to provide a sleep stage detection method, a sleep stage detection system, a sleep stage detection device and a readable storage medium, so as to solve the above problems. In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
in a first aspect, the present application provides a sleep stage detection method, including:
acquiring acceleration data in real time based on wrist strap equipment, wherein the acceleration data are acceleration data in the x direction, the y direction and the z direction, and detecting a sleep window according to the acquired acceleration data to obtain a detection result;
judging whether the detection result enters a sleep state, if so, collecting heart rate, and extracting characteristic data, wherein the characteristic data comprises time characteristic data, acceleration characteristic data and heart rate characteristic data; if the sleep window is not entered, continuing to detect the sleep window until the sleep state is detected;
training and verifying the feature data by adopting a lightGBM gradient lifting decision tree model to obtain sleep stage results, wherein the sleep stage results comprise wakefulness, shallow sleep, deep sleep and rapid eye movement.
Preferably, the detecting the sleep window according to the collected acceleration data to obtain a detection result includes:
according to acceleration data in the x, y and z directions in each second, carrying out average calculation, and calculating a sliding median value with the window length of 5 based on an average result to obtain a sliding median value result;
solving the angle of the z-axis based on the sliding median result to obtain an angle result, and calculating a sliding average value with the window length of 5 and the absolute value of the difference value of the two adjacent sliding average value results to obtain a first result;
and carrying out sliding median filtering with the window length of 300 on the first result, judging a second result after sliding median filtering with the window length of 300, and if the second result is larger than a threshold value, considering that the user is awake, otherwise, considering that the user is asleep.
Preferably, the taking is awake, otherwise taking is sleeping, wherein the taking comprises:
if at least 4 minutes of wakefulness is detected, the next 1 minute sleep is reset to wakefulness; if at least 10 minutes of wakefulness is detected, the next 3 minutes of sleep is reset to wakefulness; if at least 15 minutes of wakefulness is detected, the next 4 minutes of sleep is reset to wakefulness; if the front or the back has wakefulness for more than 10 minutes, rejecting sleep for less than 6 minutes; rejecting sleep windows less than 5 minutes; in the sleep state, if the awake state is detected for 15 minutes or longer, the awake state is considered to be detected.
Preferably, the training and verification of feature data is performed by using a lightGBM gradient boost decision tree model, wherein:
determining the super parameters of the model according to a cross verification mode, setting a group of super parameters each time, obtaining a model result by adopting a ten-fold cross verification method, extracting a group of super parameters with the largest kappa coefficient in the model result, and taking the largest group of super parameters as optimal super parameters;
the mode of model training by the ten-fold cross validation method is as follows: during training of each fold, the characteristic data are divided into a training set, a verification set and a test set, and the data proportion is 0.8:0.1:0.1, training a model by using a training set, realizing early stop in the training process by using a verification set, and evaluating the accuracy of the model by using a test set; adding the test results of each fold to obtain a total test result;
and training a model on all the feature sets by adopting the optimal super parameters, and storing the model as a final model.
Preferably, the method for calculating the parameters of the acceleration characteristic data includes:
carrying out band-pass filtering treatment on the z-axis acceleration, and solving the absolute value of a filtering result to obtain a first treatment result;
carrying out box division treatment on the first treatment result according to a division mode of 0-5g 128 bins to obtain a second treatment result;
based on the second processing result, counting the number of data in each sub-box, extracting the maximum number, accumulating with a window with the length of 15 to obtain an accumulated value sum_temp, calculating according to a formula, performing Gaussian smoothing filtering processing to obtain a third processing result, and recording the third processing result as acceleration characteristic data.
Preferably, the time characteristic data is a time interval when the current window starts relative to sleep; calculating the heart rate characteristic data, including: the heart rate sequence is divided into data segments in steps of 2 minutes, 5 minutes and 10 minutes respectively and 30 seconds for characteristic calculation.
In a second aspect, the present application further provides a sleep stage detection system, including:
and a detection module: the system is used for acquiring acceleration data in real time based on the wrist strap equipment, wherein the acceleration data are acceleration data in the x direction, the y direction and the z direction, and detecting a sleep window according to the acquired acceleration data to obtain a detection result;
and a judging module: the method comprises the steps of judging whether a detection result enters a sleep state, if so, collecting heart rate, and extracting characteristic data, wherein the characteristic data comprise time characteristic data, acceleration characteristic data and heart rate characteristic data; if the sleep window is not entered, continuing to detect the sleep window until the sleep state is detected;
training module: the method is used for training and verifying the feature data by adopting a lightGBM gradient lifting decision tree model to obtain sleep stage results, wherein the sleep stage results comprise wakefulness, shallow sleep, deep sleep and rapid eye movement.
In a third aspect, the present application further provides a readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the sleep stage detection method described above.
The beneficial effects of the invention are as follows: in the aspect of sleep monitoring, the acceleration data is supplemented by adopting the PPG data, so that the accuracy of sleep detection of the wearable equipment is improved, and meanwhile, the wearable equipment can realize sleep stage with a certain accuracy.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a sleep stage detection method according to an embodiment of the invention;
fig. 2 is a schematic diagram of sleep window detection in the sleep stage detection method according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Example 1:
outside the sleep center, a body movement recorder (actg) is a well-known PSG alternative method, which recognizes body movement through an accelerometer, and monitoring indexes generally include a time to get on bed and a time to wake up, and also devices can monitor sleep latency, a time to wake up after sleep, sleep efficiency and the like, so as to further understand the regularity of sleep/wake of a subject. The ACT is small, light, continuous to monitor and reliable in result (research shows that the detection accuracy of the ACT on the sleeping time is close to PSG, and the accuracy of estimating the total sleeping time exceeds 90%). However, ACT lacks the ability to describe sleep architecture and cannot stage sleep stages, since it relies entirely on rough body movement measurements. Furthermore, many research results indicate that ACT overestimates sleep time because the device does not detect wakefulness well while the subject is lying quietly.
Therefore, the embodiment provides a sleep stage detection method, and the technical scheme adopted by the invention comprises the following steps: based on the triaxial acceleration data collected by the wrist strap equipment, detecting a sleep window; calculating time, acceleration and heart rate characteristics; training, verifying and predicting by adopting a lightGBM model, and realizing sleep four-stage classification.
Referring to fig. 1, the method is shown to include steps S100, S200, S300, and S400 and S500.
S100, acquiring acceleration data in real time based on the wrist strap device, wherein the acceleration data are acceleration data in the x direction, the y direction and the z direction, and detecting a sleep window according to the acquired acceleration data to obtain a detection result.
It will be appreciated that the present step S100 includes S101, S102 and S103, where:
s101, carrying out average calculation on acceleration data in the x, y and z directions according to each second, and calculating a sliding median value with the window length of 5 based on an average result to obtain a sliding median value result;
it should be noted that, due to power consumption, the PPG heart rate sensor of the wrist-worn device is not always in an on state, but the acceleration sensor has low power consumption, and it is generally required to support a daily monitoring function such as step counting, so continuous acceleration data can be provided. Therefore, the scheme adopts acceleration data to detect the sleep window.
S102, solving the angle of a z-axis based on a sliding median result to obtain an angle result, and calculating a sliding average value with the window length of 5 and the absolute value of the difference value of two adjacent sliding average value results to obtain a first result;
s103, sliding median filtering with the window length of 300 is carried out on the first result, a second result after sliding median filtering with the window length of 300 is judged, if the second result is larger than a threshold value, the user is considered to be awake, and otherwise, the user is considered to be asleep.
It should be noted that, the sleep window detection method improves the Van-hes method to facilitate real-time detection in the wrist-worn device. The improvement points comprise: a) Averaging acceleration data in the x, y and z directions according to seconds to reduce the calculation amount of real-time calculation; b) Setting an experience threshold value to detect sleep and wakefulness; c) Based on the purpose of real-time detection, the post-processing logic of the optimization algorithm comprises the steps of eliminating a sleep window smaller than 5 minutes and considering that processing strategies such as awakening and the like are detected if the duration of the detected awake state is longer than or equal to 15 minutes under the sleep state.
Acceleration data in the x, y, z directions are first averaged in seconds. Since the acceleration data sampling rate is generally high, the second average can effectively reduce the subsequent calculation amount; secondly, calculating a sliding median value with a window length of 5, and calculating a z-axis angle based on the result; then, carrying out sliding average filtering with the window length of 5, and calculating the absolute value of the difference value of the adjacent values; the above results are then subject to a sliding median filter with a window length of 300. And if the filtered result is larger than the threshold value, the user is regarded as awake, otherwise, the user is regarded as sleeping. In the scheme, the threshold value is selected from an empirical threshold value of 0.09.
Note that, in step S103, the user considers that the user is awake, otherwise, the user considers that the user is asleep, wherein the method includes: if at least 4 minutes of wakefulness is detected, the next 1 minute sleep is reset to wakefulness; if at least 10 minutes of wakefulness is detected, the next 3 minutes of sleep is reset to wakefulness; if at least 15 minutes of wakefulness is detected, the next 4 minutes of sleep is reset to wakefulness; if the front or the back has wakefulness for more than 10 minutes, rejecting sleep for less than 6 minutes; rejecting sleep windows less than 5 minutes; in the sleep state, if the awake state is detected for 15 minutes or longer, the awake state is considered to be detected.
S200, judging whether a detection result enters a sleep state, if so, collecting heart rate, and extracting characteristic data, wherein the characteristic data comprises time characteristic data, acceleration characteristic data and heart rate characteristic data; if the sleep window is not entered, the sleep window is continuously detected until the sleep state is detected.
Note that, the feature calculation of sleep quartile period comprehensively considers 3 dimensions of time, motion amount and heart rate. The exercise amount information is calculated according to the acceleration data, the feature can improve the wakefulness detection, and the heart rate feature plays an important role in distinguishing sleep stages.
It will be understood that the parameter calculation method for adding velocity characteristic data in this step S200 includes S201, S202, S203, and S204, in which:
s201, carrying out band-pass filtering processing on the z-axis acceleration, and obtaining an absolute value of a filtering result to obtain a first processing result;
s202, carrying out box division on the first processing result according to a dividing mode of 0-5g 128 bins to obtain a second processing result;
s203, based on a second processing result, counting the number of data in each sub-box, extracting the maximum number, and accumulating the maximum number by using a window with the length of 15 to obtain an accumulated value sum_temp;
and S204, calculating according to a formula sum_temp= (sum_temp-18.0) x 3.07 based on the accumulated value sum_temp, performing Gaussian smoothing filtering processing to obtain a third processing result, and recording the third processing result as acceleration characteristic data.
It should be noted that, the feature extraction mainly considers the time feature, the acceleration time domain feature, specifically, the motion count, the HR feature, and the HRV time-frequency domain feature. And finally, 20 features are screened out by adopting a REF (recursive feature elimination) mode. The method comprises the following steps: 5 acceleration characteristic data: comprising a motion count, a time interval greater than Thr1 from the last motion count, a time interval greater than Thr1 from the next motion count, a time interval greater than Thr2 from the last motion count, and a time interval greater than Thr2 from the next motion count. The motion counting parameter calculating method comprises the following steps of firstly, carrying out band-pass filtering on the acceleration of a z-axis (g is unit) at 3-11 Hz; secondly, solving an absolute value, and carrying out box division on the result according to a dividing mode of 0-5g 128 bins; counting the number of data in each sub-box, finding out the maximum number, and accumulating by using a window with the length of 15 to obtain sum_temp; finally, sum_temp= (sum_temp-18.0 f) ×3.07f is calculated, and gaussian smoothing filtering is performed as a motion count result.
It should be noted that, specifically, the time characteristic data is a time interval when the current window is relative to the sleep start.
Wherein calculating the heart rate characteristic data comprises: the heart rate sequence is divided into data segments in steps of 2 minutes, 5 minutes and 10 minutes respectively and 30 seconds for characteristic calculation.
Extracted heart rate characteristic data, including: the average value, standard deviation and minimum value of the whole heart rate sequence, the average value and maximum value of the whole heart rate difference value sequence, the sum of the power spectrums of the very low frequency bands of the whole heart rate sequence, the sum of the power spectrums of the low frequency bands of the whole heart rate sequence and the sum of the power spectrums of the high frequency bands of the whole heart rate sequence.
And S300, training and verifying the feature data by adopting a lightGBM gradient lifting decision tree model to obtain sleep stage results, wherein the sleep stage results comprise wakefulness, shallow sleep, deep sleep and rapid eye movement.
Note that, the sleep data is divided into a awake period, a light sleep period, a deep sleep period, and a fast eye movement period in units of 30s, but the feature extraction unit is not limited to the current 30s, and when calculating the HRV parameters, a unit that takes a specific length around the current 30s is selected as the feature extraction unit.
The invention comprehensively considers the feature calculation efficiency and the classification performance, and finally selects three feature extraction windows of 2 minutes, 5 minutes and 10 minutes; the shorter time window describes the current state and the longer time window helps to explore the changing relationship between states.
It will be appreciated that in this step S300, S301 and S302 are included, wherein:
s301, determining a model super-parameter according to a cross verification mode, setting a set of super-parameters each time, obtaining a model result by adopting a ten-fold cross verification method, extracting a set of super-parameters with the largest kappa coefficient in the model result, and taking the largest set of super-parameters as optimal super-parameters;
the mode of model training by the ten-fold cross validation method is as follows: during training of each fold, the characteristic data are divided into a training set, a verification set and a test set, and the data proportion is 0.8:0.1:0.1, training a model by using a training set, realizing early stop in the training process by using a verification set, and evaluating the accuracy of the model by using a test set; adding the test results of each fold to obtain a total test result;
s302, training a model on all feature sets by adopting the optimal super parameters, and storing the model as a final model.
It should be noted that the calculated features were trained and predicted using the lightGBM classifier, resulting in wakefulness, shallow sleep, deep sleep, and rapid eye movement. During model training, the data set is divided into a training set, a verification set and a test set. And performing model training and super-parameter adjustment by adopting a cross-validation method. And finally, verifying the performance of the training model in the test set, and storing the training model to perform model deployment and four-stage prediction.
In summary, the acceleration data is supplemented in the aspect of PPG data, so that the accuracy of sleep detection of the wearable equipment is improved, and meanwhile, the wearable equipment can realize four stages of sleep with a certain accuracy.
Example 2:
as shown in fig. 2, the present embodiment provides a sleep stage detection system, and the system described with reference to fig. 2 includes a detection module, a judgment module, and a training module, where the detection module includes:
and a detection module: the system is used for acquiring acceleration data in real time based on the wrist strap equipment, wherein the acceleration data are acceleration data in the x direction, the y direction and the z direction, and detecting a sleep window according to the acquired acceleration data to obtain a detection result;
and a judging module: the method comprises the steps of judging whether a detection result enters a sleep state, if so, collecting heart rate, and extracting characteristic data, wherein the characteristic data comprise time characteristic data, acceleration characteristic data and heart rate characteristic data; if the sleep window is not entered, continuing to detect the sleep window until the sleep state is detected;
training module: the method is used for training and verifying the feature data by adopting a lightGBM gradient lifting decision tree model to obtain sleep stage results, wherein the sleep stage results comprise wakefulness, shallow sleep, deep sleep and rapid eye movement.
Specifically, the detection module comprises a calculation unit, a solving unit and a judging unit, wherein:
a calculation unit: according to acceleration data in the x, y and z directions in each second, carrying out average calculation, and calculating a sliding median value with the window length of 5 based on an average result to obtain a sliding median value result;
and a solving unit: solving the angle of the z-axis based on the sliding median result to obtain an angle result, and calculating a sliding average value with the window length of 5 and the absolute value of the difference value of the two adjacent sliding average value results to obtain a first result;
a judging unit: and carrying out sliding median filtering with the window length of 300 on the first result, judging a second result after sliding median filtering with the window length of 300, and if the second result is larger than a threshold value, considering that the user is awake, otherwise, considering that the user is asleep.
Specifically, the judging unit includes:
if at least 4 minutes of wakefulness is detected, the next 1 minute sleep is reset to wakefulness; if at least 10 minutes of wakefulness is detected, the next 3 minutes of sleep is reset to wakefulness; if at least 15 minutes of wakefulness is detected, the next 4 minutes of sleep is reset to wakefulness; if the front or the back has wakefulness for more than 10 minutes, rejecting sleep for less than 6 minutes; rejecting sleep windows less than 5 minutes; in the sleep state, if the awake state is detected for 15 minutes or longer, the awake state is considered to be detected.
Specifically, the training module comprises an extraction unit, a training unit and a storage unit, wherein:
extraction unit: the method comprises the steps of determining super parameters of a model according to a cross verification mode, setting a group of super parameters each time, obtaining a model result by adopting a ten-fold cross verification method, extracting a group of super parameters with the largest kappa coefficient in the model result, and taking the largest group of super parameters as optimal super parameters;
training unit: when the training set is used for training each fold, the characteristic data is divided into a training set, a verification set and a test set, and the data proportion is 0.8:0.1:0.1, training a model by using a training set, realizing early stop in the training process by using a verification set, and evaluating the accuracy of the model by using a test set; adding the test results of each fold to obtain a total test result;
a storage unit: the method is used for training the model on all feature sets by adopting the optimal super parameters and storing the model as a final model.
Specifically, the parameter calculation method of the acceleration characteristic data in the judging module comprises a first processing unit, a second processing unit, an extraction number unit and a calculation unit:
a first processing unit: the method comprises the steps of performing band-pass filtering processing on z-axis acceleration, and obtaining an absolute value of a filtering result to obtain a first processing result;
a second processing unit: the method comprises the steps of carrying out box division on a first processing result according to a dividing mode of 0-5g 128 bins to obtain a second processing result;
extracting a number unit: the method comprises the steps of counting the number of data in each sub-box based on a second processing result, extracting the maximum number, and accumulating the maximum number by using a window with the length of 15 to obtain an accumulated value sum_temp;
a calculation unit: and the method is used for calculating according to a formula sum_temp= (sum_temp-18.0) x 3.07 based on the accumulated value sum_temp, performing Gaussian smoothing filtering processing to obtain a third processing result, and recording the third processing result as acceleration characteristic data.
Specifically, the time characteristic data in the judging module is the time interval when the current window starts relative to sleep.
Specifically, the heart rate characteristic data in the judging module comprises: the heart rate sequence is divided into data segments in steps of 2 minutes, 5 minutes and 10 minutes respectively and 30 seconds for characteristic calculation.
Specifically, the extracted heart rate characteristic data in the judging module comprises: the average value, standard deviation and minimum value of the whole heart rate sequence, the average value and maximum value of the whole heart rate difference value sequence, the sum of the power spectrums of the very low frequency bands of the whole heart rate sequence, the sum of the power spectrums of the low frequency bands of the whole heart rate sequence and the sum of the power spectrums of the high frequency bands of the whole heart rate sequence.
It should be noted that, regarding the system in the above embodiment, the specific manner in which the respective modules perform the operations has been described in detail in the embodiment regarding the method, and will not be described in detail herein.
Example 3:
corresponding to the above method embodiment, there is also provided a readable storage medium in this embodiment, and a readable storage medium described below and a sleep stage detection method described above may be referred to correspondingly with each other.
The readable storage medium stores a computer program which, when executed by a processor, implements the steps of the sleep stage detection method of the above method embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, and the like.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (10)

1. A sleep stage detection method, comprising:
acquiring acceleration data in real time based on wrist strap equipment, wherein the acceleration data are acceleration data in the x direction, the y direction and the z direction, and detecting a sleep window according to the acquired acceleration data to obtain a detection result;
judging whether the detection result enters a sleep state, if so, collecting heart rate, and extracting characteristic data, wherein the characteristic data comprises time characteristic data, acceleration characteristic data and heart rate characteristic data; if the sleep window is not entered, continuing to detect the sleep window until the sleep state is detected;
training and verifying the feature data by adopting a lightGBM gradient lifting decision tree model to obtain sleep stage results, wherein the sleep stage results comprise wakefulness, shallow sleep, deep sleep and rapid eye movement.
2. The sleep stage detection method according to claim 1, wherein the detecting the sleep window according to the collected acceleration data to obtain a detection result includes:
according to acceleration data in the x, y and z directions in each second, carrying out average calculation, and calculating a sliding median value with the window length of 5 based on an average result to obtain a sliding median value result;
solving the angle of the z-axis based on the sliding median result to obtain an angle result, and calculating a sliding average value with the window length of 5 and the absolute value of the difference value of the two adjacent sliding average value results to obtain a first result;
and carrying out sliding median filtering with the window length of 300 on the first result, judging a second result after sliding median filtering with the window length of 300, and if the second result is larger than a threshold value, considering that the user is awake, otherwise, considering that the user is asleep.
3. The sleep stage detection method according to claim 2, wherein the believing is awake, otherwise believing sleep, wherein the taking comprises:
if at least 4 minutes of wakefulness is detected, the next 1 minute sleep is reset to wakefulness; if at least 10 minutes of wakefulness is detected, the next 3 minutes of sleep is reset to wakefulness; if at least 15 minutes of wakefulness is detected, the next 4 minutes of sleep is reset to wakefulness; if the front or the back has wakefulness for more than 10 minutes, rejecting sleep for less than 6 minutes; rejecting sleep windows less than 5 minutes; in the sleep state, if the awake state is detected for 15 minutes or longer, the awake state is considered to be detected.
4. The sleep stage detection method according to claim 1, wherein the feature data is trained and validated using a lightGBM gradient boost decision tree model, wherein:
determining the super parameters of the model according to a cross verification mode, setting a group of super parameters each time, obtaining a model result by adopting a ten-fold cross verification method, extracting a group of super parameters with the largest kappa coefficient in the model result, and taking the largest group of super parameters as optimal super parameters;
the mode of model training by the ten-fold cross validation method is as follows: during training of each fold, the characteristic data are divided into a training set, a verification set and a test set, and the data proportion is 0.8:0.1:0.1, training a model by using a training set, realizing early stop in the training process by using a verification set, and evaluating the accuracy of the model by using a test set; adding the test results of each fold to obtain a total test result;
and training a model on all the feature sets by adopting the optimal super parameters, and storing the model as a final model.
5. The sleep stage detection method according to claim 1, wherein the parameter calculation method of the acceleration characteristic data includes:
carrying out band-pass filtering treatment on the z-axis acceleration, and solving the absolute value of a filtering result to obtain a first treatment result;
carrying out box division treatment on the first treatment result according to a division mode of 0-5g 128 bins to obtain a second treatment result;
based on the second processing result, counting the number of data in each sub-box, extracting the maximum number, and accumulating by using a window with the length of 15 to obtain an accumulated value sum_temp;
based on the accumulated value sum_temp, calculation is performed according to a formula sum_temp= (sum_temp-18.0) 3.07, gaussian smoothing filter processing is performed, a third processing result is obtained, and the third processing result is recorded as acceleration characteristic data.
6. The sleep stage detection method according to claim 1, wherein the time characteristic data is a time interval when a current window is relative to a start of sleep.
7. The sleep stage detection method according to claim 1, wherein calculating the heart rate characteristic data includes: the heart rate sequence is divided into data segments in steps of 2 minutes, 5 minutes and 10 minutes respectively and 30 seconds for characteristic calculation.
8. The sleep stage detection method according to claim 7, wherein the extracted heart rate characteristic data includes: the average value, standard deviation and minimum value of the whole heart rate sequence, the average value and maximum value of the whole heart rate difference value sequence, the sum of the power spectrums of the very low frequency bands of the whole heart rate sequence, the sum of the power spectrums of the low frequency bands of the whole heart rate sequence and the sum of the power spectrums of the high frequency bands of the whole heart rate sequence.
9. A sleep stage detection system, comprising:
and a detection module: the system is used for acquiring acceleration data in real time based on the wrist strap equipment, wherein the acceleration data are acceleration data in the x direction, the y direction and the z direction, and detecting a sleep window according to the acquired acceleration data to obtain a detection result;
and a judging module: the method comprises the steps of judging whether a detection result enters a sleep state, if so, collecting heart rate, and extracting characteristic data, wherein the characteristic data comprise time characteristic data, acceleration characteristic data and heart rate characteristic data; if the sleep window is not entered, continuing to detect the sleep window until the sleep state is detected;
training module: the method is used for training and verifying the feature data by adopting a lightGBM gradient lifting decision tree model to obtain sleep stage results, wherein the sleep stage results comprise wakefulness, shallow sleep, deep sleep and rapid eye movement.
10. A readable storage medium, characterized by: the readable storage medium has stored thereon a computer program which, when executed by a processor, implements the sleep stage detection method according to any one of claims 1 to 8.
CN202311677342.2A 2023-12-08 2023-12-08 Sleep stage detection method, system and readable storage medium Pending CN117731238A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311677342.2A CN117731238A (en) 2023-12-08 2023-12-08 Sleep stage detection method, system and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311677342.2A CN117731238A (en) 2023-12-08 2023-12-08 Sleep stage detection method, system and readable storage medium

Publications (1)

Publication Number Publication Date
CN117731238A true CN117731238A (en) 2024-03-22

Family

ID=90253623

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311677342.2A Pending CN117731238A (en) 2023-12-08 2023-12-08 Sleep stage detection method, system and readable storage medium

Country Status (1)

Country Link
CN (1) CN117731238A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119649440A (en) * 2024-12-09 2025-03-18 广东工业大学 Method, device and equipment for constructing decision prediction model based on visual information
CN119632550A (en) * 2025-01-21 2025-03-18 上海交通大学苏州人工智能研究院 A multifunctional system based on a single accelerometer
CN119700045A (en) * 2025-02-28 2025-03-28 内蒙古孚宝医疗科技有限公司 Sleep monitoring system and method of human physiological signals

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119649440A (en) * 2024-12-09 2025-03-18 广东工业大学 Method, device and equipment for constructing decision prediction model based on visual information
CN119632550A (en) * 2025-01-21 2025-03-18 上海交通大学苏州人工智能研究院 A multifunctional system based on a single accelerometer
CN119700045A (en) * 2025-02-28 2025-03-28 内蒙古孚宝医疗科技有限公司 Sleep monitoring system and method of human physiological signals

Similar Documents

Publication Publication Date Title
CN107106085B (en) Apparatus and method for sleep monitoring
CN117731238A (en) Sleep stage detection method, system and readable storage medium
Adnane et al. Sleep–wake stages classification and sleep efficiency estimation using single-lead electrocardiogram
US8292819B2 (en) Sleep analysis system and method for analyzing sleep thereof
KR100954817B1 (en) System and method for testing blood vessel's health and stress through signal analysis of pluse wave
CN109328034B (en) Determination system and method for determining sleep stage of a subject
US20150245777A1 (en) Detection of emotional states
Piryatinska et al. Automated detection of neonate EEG sleep stages
US20110054279A1 (en) Diagnosis of periodic breathing
CN112930139B (en) System and method for analyzing sleep disordered breathing events
WO2007149553A2 (en) Alertness/drowsiness and cognitive capacity index
CN110831492A (en) Method and apparatus for determining sleep statistics
CN113907707B (en) Epileptic seizure time period detection system and method based on multi-modal information
WO2016031650A1 (en) Method for assessing depressive state and device for assessing depressive state
Renevey et al. Optical wrist-worn device for sleep monitoring
JP6813837B2 (en) Activity rhythm judgment method and activity rhythm judgment device
Dehkordi et al. Sleep stage classification in children using photoplethysmogram pulse rate variability
Motin et al. Sleep-wake classification using statistical features extracted from photoplethysmographic signals
JP7216408B2 (en) Device for determining sleep apnea syndrome, method for determining sleep apnea syndrome, and program for determining sleep apnea syndrome
CN112089413A (en) Blocking type sleep apnea syndrome screening system
Suzuki et al. Development of a sleep monitoring system with wearable vital sensor for home use
US20240252122A1 (en) Sleep apnea-hypopnea index estimation apparatus, method, and computer-executable instructions
Zhang et al. Rass: A portable real-time automatic sleep scoring system
Fujimoto et al. Sleep stage detection using a wristwatch-type physiological sensing device
CN118633951B (en) A method for monitoring sleep disorders in neurology

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination