Sleep cycle division method based on multi-condition extraction and multi-stage correction
By employing a multi-condition extraction and multi-level correction method, the problems of automation and robustness in sleep cycle segmentation were solved, generating a sleep cycle sequence that conforms to physiological significance, thereby improving the accuracy of sleep structure analysis and its clinical application value.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU HAIGE COMMUNICATION GROUP INCORPORATED COMPANY
- Filing Date
- 2026-05-15
- Publication Date
- 2026-07-03
AI Technical Summary
Existing technologies for sleep cycle segmentation suffer from low automation, poor robustness, and a lack of physiologically meaningful structured output, leading to difficulties in clinical application. In particular, the segmentation results are inaccurate when dealing with micro-arousals, REM absence, and brief repetitions of phases.
By employing a multi-condition extraction and multi-level correction method, a physiologically meaningful sleep cycle sequence is generated through preprocessing of sleep stage labels, detection of cycle start and end points, identification of cycle transition points, and merging, segmentation, and screening of candidate cycles.
It enables automated construction of sleep cycles, improves the stability and structured representation of the segmentation results, accurately identifies complex sleep dynamics, and generates sleep cycle sequences that can be used for clinical assessment.
Smart Images

Figure CN122320484A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of sleep health monitoring technology, and more specifically, relates to a sleep cycle division method based on multi-condition extraction and multi-level correction. Background Technology
[0002] Sleep cycles are a core concept in sleep structure analysis, referring to the cyclical process that begins in non-rapid eye movement (NREM) sleep, progresses through light sleep (N1, N2), deep sleep (N3), and ends in rapid eye movement (REM) sleep. Healthy adults typically experience nighttime sleep consisting of 4-6 such orderly cycles. Macroscopic structural analysis of sleep cycles, compared to isolated sleep stages (such as 30-second segments), provides a more direct reflection of the brain's recovery process, memory consolidation efficiency, and overall sleep quality. Therefore, accurately delineating sleep cycles from continuous physiological signals is a key issue in sleep medicine and intelligent health monitoring. Precise sleep cycle segmentation has irreplaceable clinical and research value for assessing sleep quality, diagnosing sleep disorders (such as insomnia and sleep apnea), and studying the physiological and cognitive functions of sleep.
[0003] In professional clinical settings, sleep cycle segmentation relies heavily on manual interpretation of polysomnography (PSG) by specialists, which is time-consuming, labor-intensive, subjective, and difficult to scale. In consumer-grade scenarios (such as smart bracelets), due to limited sensor accuracy, extremely simplified heuristic rules are often used for symbolic cycle estimation, resulting in low accuracy and weak interpretability. Therefore, developing automated, objective, and reliable sleep cycle segmentation methods is a key prerequisite and urgent need for achieving intelligent and scalable sleep analysis.
[0004] Existing technologies mainly focus on the following two levels, and have not yet systematically solved the problem of automated division "from phases to cycles":
[0005] The first type of technology is sleep staging, which is a preliminary step in period segmentation. Current mainstream research focuses on using machine learning (such as support vector machines) or deep learning (such as convolutional neural networks and Transformers) models to classify physiological signals such as EEG into time-segment categories, outputting a "Wake, N1, N2, N3, REM" label sequence. These technologies aim for higher staging accuracy on public datasets, but their output is only a continuous stream of stage labels, not discrete periodic units; essentially, they are classifiers rather than structure parsers.
[0006] The second category of techniques involves quantifying the macroscopic characteristics and trends of sleep. Some studies attempt to bypass explicit periodic boundaries and quantify sleep structure holistically. For example, sleep stability / stabilization analysis extracts trend components of sleep depth using methods such as modal decomposition to calculate a stabilization index for the entire night. Another example is sleep periodicity quantification, which uses time-frequency analysis methods such as wavelet transform to calculate a "sleep periodicity index" from sleep characteristic curves, describing the intensity of oscillations in sleep stages. The output of these methods is a continuous index curve or macroscopic statistical value, without identifying and outputting the specific periodic sequence information required for clinical interpretation. Their concept of "period" is mathematical and statistical, rather than an independent event with a definite beginning and end in physiology.
[0007] Furthermore, while macroscopic long-sequence deep learning methods and continuous biomarker methods that bypass discrete staged sleep patterns can characterize the overall sleep structure changes throughout the night, they lack a clear mechanism for identifying cycle boundaries, making it difficult to directly generate sleep cycle sequences suitable for clinical interpretation. Therefore, they still have significant limitations in practical applications. Overall, although existing sleep staging technologies, macroscopic feature quantification technologies, and rule engine methods based on staging results have made some progress, they still have significant shortcomings in achieving automated and robust sleep cycle segmentation, creating a technological gap between "staging results" and "cycle structure." Specifically: (1) Functional disconnect of “staging without period”: The existing automated technology chain is interrupted after the staging labels are produced. How to aggregate these labels into discrete periods that conform to physiological meaning is a key downstream task that still lacks a reliable engineering solution, resulting in a heavy reliance on manual interpretation in clinical practice.
[0008] (2) Lack of robust processing logic for the inherent complex dynamics of sleep: 1) Normal fluctuations exist during sleep, such as micro-awakening (especially for people with sleep apnea, insomnia, or the elderly, whose sleep is interrupted by a large number of awakenings) and short-term repetition of stages (such as rapid switching between REM and N1 / N2). If existing schemes attempt to make simple divisions, they usually rely on only a few rigid rules or threshold rules (such as "the occurrence of REM is regarded as the end of the cycle"). Their rule system is too simple and fragile, and cannot effectively distinguish between "real cycle transitions" and "normal fluctuations within the cycle". This results in a large number of oversegmentation or undersegmentation errors in the real data, with extremely low reliability and no practical value. It cannot be directly used for clinical or health assessment. 2) The failure of cycle identification caused by the "missing REM" phenomenon. A complete sleep cycle includes the NREM stage and the REM stage (NREM-REM cycle). In healthy individuals (especially during their first sleep cycle) or children, after an NREM period ends, a distinct REM period may not occur. Instead, sleep may become "shallow" and enter the next NREM period, resulting in an incomplete cycle (NREM-only cycle) without effective REM sleep. Traditional automatic cycle segmentation algorithms based on "must end with REM" will fail 100% in this case, leading to incorrect cycle calculations.
[0009] (3) Lack of interpretable structured outputs that align with clinical thinking: Whether it is an end-to-end deep learning model or a mathematical transformation that derives abstract quantitative indicators, the process and results are difficult to align with the physiological logic and structural concepts used by clinical experts. They cannot provide interpretable structured reports with direct diagnostic and assessment significance, such as "whether the first sleep cycle was complete" or "how deep sleep evolves during the cycle," thus limiting their clinical application.
[0010] This invention addresses the shortcomings of existing technologies, which primarily focus on outputting sleep staging results or performing only macroscopic structural quantitative analysis, lacking a stable and reliable automatic sleep cycle segmentation mechanism. It proposes a sleep cycle segmentation method based on multi-condition extraction and multi-level correction. Building upon existing sleep staging results, this method introduces rules for cycle transition point identification, abnormal cycle processing, and invalid cycle removal. This enables step-by-step correction and structural reconstruction of candidate sleep cycles, thereby obtaining a physiologically meaningful sleep cycle sequence and providing a reliable basis for sleep structure analysis and related clinical assessments. Summary of the Invention
[0011] This invention proposes a sleep cycle segmentation method based on multi-condition extraction and multi-level correction, including acquiring physiological signals during the user's sleep and performing sleep staging based on the physiological signals to obtain a staging sequence composed of sleep staging labels. The method further includes the following steps: S1: Preprocess the phase sequence and standardize the labels of each time period into preset discrete category identifiers; S2: Scan the preprocessed stage sequence, detect the sleep start point and sleep end point, and extract the stage sequence between the two as sleep period data; S3: Start scanning from the first period of sleep, taking the non-rapid eye movement (NREM) sleep stage as the start of a new cycle. When the cycle end condition is met, end the current cycle and calculate the cycle duration. If the preset minimum cycle duration threshold is met, save the current cycle and then continue to search for the next candidate sleep cycle until the end of sleep is reached. The cycle termination conditions include: detecting sleep termination, detecting sleep interruption, and detecting a continuous NREM segment after a continuous rapid eye movement (REM) segment with a duration longer than a preset NREM duration threshold, or a continuous NREM and wake mixed segment with a duration longer than a preset NREM and wake mixed segment duration threshold as cycle transition points. S4: Post-process all candidate sleep cycles initially retained. The post-processing includes: merging cycles that meet preset conditions, identifying and segmenting fragmented light sleep segments in the cycles, segmenting abnormally long cycles that meet preset conditions, and deleting invalid cycles. S5: Perform statistical analysis on the effective sleep cycles obtained from post-processing and output the results.
[0012] In step S1 of this invention, the sleep stage labels are processed for discrete category standardization. In step S2, the stage sequence between the sleep start point and the end point is extracted, so that the cycle division is limited to the actual sleep interval. The wakefulness segment before falling asleep and the terminal wakefulness segment are not included in the cycle calculation, and the start and end positions of the cycle are more in line with the actual sleep process. In step S3, the NREM stage is used as the cycle start point, and candidate cycles are screened in combination with the minimum cycle duration threshold. Short-term fluctuations will not be misidentified as independent cycles. At the same time, by setting NREM segments with a continuous duration greater than the preset NREM duration threshold after continuous REM segments, or NREM and Wake mixed segments with a continuous duration greater than the preset NREM and Wake mixed segment duration threshold, as the basis for cycle conversion, this invention can still identify the boundary position between adjacent sleep cycles even in the absence of REM stages.
[0013] In step S4, adjacent cycles segmented by short-term awakenings are merged, and fragmented segments formed by alternating light sleep and wake, as well as long cycles with abnormal durations, are segmented. At the same time, candidate cycles with incomplete stage structures are deleted, so that the remaining cycle structure is more consistent with the actual sleep process. Finally, in step S5, the cycle boundary and cycle duration information are output to obtain a cycle sequence that can be used for overnight sleep structure analysis.
[0014] Furthermore, in step S3, after detecting a continuous REM segment, the search begins from the next NREM period after the end of the continuous REM segment to determine whether there is an NREM segment with a duration longer than a preset NREM duration threshold, or an NREM and Wake mixed segment with a duration longer than a preset NREM and Wake mixed segment duration threshold, before the REM segment reappears or the sleep is interrupted. If such a segment exists, it is taken as the cycle transition point.
[0015] After a continuous REM segment ends, the current cycle is not immediately considered over. Instead, the sleep cycle is observed to see if subsequent sleep stages enter a stable NREM process. This approach prevents brief stage transitions from being directly identified as new cycle boundaries. Even if REM activity is not significant, the boundary between adjacent cycles can be determined based on the continuity of subsequent NREM or NREM-Wake mixed segments.
[0016] Furthermore, when calculating the duration of the NREM segment, a brief Wake segment is allowed, and the brief Wake segment is not included in the NREM segment duration; at the same time, the duration of the mixed NREM and Wake segment is calculated separately to determine whether the cycle transition point condition is met.
[0017] The inclusion of brief wake segments within the NREM segment is designed to account for the frequent occurrence of short awakenings during actual sleep. These brief wake segments are not included in the NREM duration, preventing the calculation of an interrupted NREM segment as a complete NREM segment. Simultaneously, the duration of the mixed NREM and wake segments is calculated separately, allowing for the inclusion of alternating light sleep and brief awakenings within the overall sleep progression process in the cycle transition assessment, reducing missegmentation caused by brief wake segments.
[0018] Furthermore, the period for merging that meets preset conditions includes: If any of the candidate sleep cycles ends with a miscarriage REM segment, and the interval between the candidate sleep cycle and the next candidate sleep cycle is less than a preset sleep interruption duration threshold, then the candidate sleep cycle and the next candidate sleep cycle are merged into one candidate sleep cycle.
[0019] A miscarriage REM segment typically indicates a very short REM process that does not form a complete cycle end characteristic. If the interval between it and the next candidate sleep cycle is very short, it is more like a brief fluctuation within the same cycle than a true sleep interruption. Combining such adjacent candidate cycles can prevent a complete sleep cycle from being split into two cycles by miscarriage REMs and short intervals.
[0020] Furthermore, the merging of cycles that meet the preset conditions also includes: when two adjacent candidate sleep cycles are in a situation where the first candidate sleep cycle contains NREM sleep with a duration longer than a preset NREM duration threshold and does not contain effective REM sleep, the second candidate sleep cycle is dominated by REM sleep and the duration of NREM sleep before REM sleep is less than the preset NREM duration threshold, and the interval between the two candidate sleep cycles is less than a preset interval threshold, the two adjacent candidate sleep cycles are merged.
[0021] The previous candidate period already has a relatively complete NREM process, but lacks effective REM; the subsequent candidate period is mainly REM, but the NREM duration before REM is insufficient. When the interval between the two is short, merging them can re-incorporate the originally separated NREM and REM parts into the same period, reducing the period splitting caused by the delayed occurrence of REM.
[0022] Furthermore, the identification and segmentation of fragmented light sleep segments in the cycle includes: identifying continuous segments consisting of light sleep stages and wake stages within a candidate sleep cycle; when the duration of the continuous segment is greater than a preset fragment duration threshold and the proportion of the wake stage is greater than a preset wake proportion threshold, the continuous segment is identified as a fragmented light sleep segment, and the candidate sleep cycle is segmented into candidate sleep cycles before and after the fragmented light sleep segment, using the fragmented light sleep segment as the boundary.
[0023] When light sleep and wake stages alternate continuously for an extended period, it usually indicates that the sleep process before and after that point is no longer continuous and stable. Using this fragmented light sleep segment as a dividing line allows for the separate processing of the two sleep stages, reducing the mismerization of cycles caused by repeated alternations between light sleep and brief awakenings.
[0024] Furthermore, the segmentation of abnormally long cycles that meet preset conditions includes: when the total duration of the candidate sleep cycle exceeds a preset abnormally long cycle threshold, and there is a Wake segment within the candidate sleep cycle with a duration greater than the dynamic interruption threshold, the candidate sleep cycle is segmented into two candidate sleep cycles using the Wake segment as the segmentation point.
[0025] When a candidate sleep cycle is significantly longer than expected, and includes a long wake segment, it usually indicates that the sleep processes before and after the wake segment should not be counted as the same cycle. Using the wake segment as a dividing point, the mistakenly merged long cycles can be separated.
[0026] Furthermore, the deletion of invalid cycles includes deleting at least one of the following candidate sleep cycles: candidate sleep cycles with a duration lower than a preset minimum cycle duration threshold; candidate sleep cycles containing only NREM sleep and with a deep sleep duration lower than a preset deep sleep duration threshold; and candidate sleep cycles containing effective REM sleep, but with the NREM sleep duration before the start of REM sleep lower than a preset NREM duration threshold.
[0027] Candidate cycles that are too short, those that contain only NREM but lack deep sleep, and those with insufficient pre-REM NREM duration typically lack the stage structure that a complete sleep cycle should have. Removing these types of cycles can prevent short-term sleep stage changes, isolated NREM segments, or REM segments from being mistakenly output as complete sleep cycles, making the final retained cycle closer to a complete cycle in the actual sleep process.
[0028] This invention also provides a sleep cycle segmentation system based on multi-condition extraction and multi-level correction. The system is based on the aforementioned sleep cycle segmentation method based on multi-condition extraction and multi-level correction, and is characterized by comprising: The sleep staging sequence acquisition module is used to acquire physiological signals during the user's sleep and perform sleep staging based on the physiological signals to obtain a staging sequence composed of sleep staging tags. The preprocessing module is used to preprocess the periodic sequence and standardize the labels of each time period into preset discrete category identifiers; The sleep phase extraction module is used to scan the preprocessed phase sequence, detect the sleep start point and sleep end point, and extract the phase sequence between the two as sleep phase data. The candidate cycle segmentation module is used to start scanning from the first period of sleep, taking the non-rapid eye movement sleep (NREM) stage as the start of a new cycle. When the cycle end condition is met, the current cycle ends and the cycle duration is calculated. If the preset minimum cycle duration threshold is met, the current cycle is saved, and then the search for the next candidate sleep cycle continues until the end of sleep is reached. The cycle post-processing module is used to post-process all candidate sleep cycles initially retained. The post-processing includes: merging cycles that meet preset conditions, identifying and segmenting fragmented light sleep segments in the cycle, segmenting abnormally long cycles that meet preset conditions, and deleting invalid cycles. The results output module is used to perform statistical analysis on the effective sleep cycles obtained from post-processing and output the results.
[0029] The present invention also includes a computer-readable storage medium storing a computer program that performs the above-described sleep cycle segmentation method based on multi-condition extraction and multi-level correction.
[0030] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) Automated construction of sleep cycles. Based on the existing sleep stage label sequence, the continuous stage labels are automatically organized into a discrete sleep cycle sequence with clear physiological boundaries by identifying cycle transition points and screening candidate cycles, thereby improving the automation level of sleep structure analysis.
[0031] (2) Improve the stability of period segmentation results. In view of the complex dynamic situation in sleep, such as micro-awakening, brief and repeated switching of stages and REM absence, candidate periods are merged, segmented and screened by setting multi-condition judgment rules and multi-level correction processing mechanism, thereby improving the stability of period boundary identification and reducing the occurrence of missegmentation.
[0032] (3) Improve the structured expression of results. By outputting sleep cycle sequences that include information such as the location of cycle boundaries, cycle type, and the composition of internal stages of the cycle, the analysis results are more consistent with the physiological structure of sleep, which is beneficial for subsequent sleep quality assessment and related analysis applications. Attached Figure Description
[0033] Figure 1 This is a schematic diagram of the overall process of the sleep cycle segmentation method based on multi-condition extraction and multi-level correction of the present invention.
[0034] Figure 2 This is a flowchart of the overall methodology for intelligent sleep monitoring and analysis.
[0035] Figure 3 This is a flowchart of the data preprocessing method.
[0036] Figure 4 This is a flowchart of the sleep period extraction method.
[0037] Figure 5 The flowchart shows the method for extracting candidate sleep cycles.
[0038] Figure 6 Flowchart for post-processing optimization method.
[0039] Figure 7 This is a flowchart of the sleep cycle statistics method. Detailed Implementation
[0040] Example 1 This embodiment provides a specific hardware and software implementation of a sleep cycle segmentation method based on multi-condition extraction and multi-level correction. This method can run in an intelligent sleep monitoring and analysis system. Figure 2As shown, the intelligent sleep monitoring and analysis system includes a perception layer, a transmission layer, a data layer, an algorithm layer, and an application layer. The perception layer includes a user-wearable multi-physiological parameter monitoring device, such as a head-mounted intelligent monitoring device integrating EEG, body movement, and blood oxygen sensors, used to collect raw physiological signals during the user's sleep. The transmission layer transmits the raw physiological signals to a backend data processing center via wireless communication methods such as Bluetooth or Wi-Fi. The data layer is located on a cloud server or local server, used to store the raw physiological signals, preprocessed feature data, sleep staging results, and sleep cycle division results, and provides a data access interface to the algorithm layer. The algorithm layer includes a sleep staging module, a sleep cycle division module, and a sleep quality assessment module. The sleep staging module converts the raw physiological signals into sleep staging label sequences; the sleep cycle division module performs cycle division and statistical analysis on the sleep staging label sequences; and the sleep quality assessment module performs sleep quality analysis or sleep disorder screening based on the sleep cycle division results. The application layer includes a software interface for users or physicians, used to display sleep cycle division results, cycle statistical analysis results, and sleep quality assessment results.
[0041] In the aforementioned sleep monitoring and analysis system, the sleep staging module of the algorithm layer first generates a sleep staging tag sequence based on the user's physiological signals during sleep, and the sleep cycle division module then divides the sleep staging tag sequence into cycles. For example... Figure 1 As shown, the sleep cycle segmentation method based on multi-condition extraction and multi-level correction provided in this embodiment includes the following steps: S1: Preprocess the phase sequence and standardize the labels of each time period into preset discrete category identifiers; like Figure 3 As shown, in step S1, to facilitate subsequent algorithm processing, the textual sleep stage labels are converted into discrete category identifiers. For example, Wake, N1, N2, N3, and REM can be mapped to 0, 1, 2, 3, and 4, respectively, thus obtaining a numerical staging sequence. The above mapping relationship is only one example; those skilled in the art can also use other numbering methods, as long as different sleep stages can be distinguished. For unknown labels or null values in the staging sequence, they can be uniformly marked with the category identifier corresponding to Wake to avoid unknown labels affecting subsequent cycle division.
[0042] S2: Scan the preprocessed stage sequence, detect the sleep start point and sleep end point, and extract the stage sequence between the two as sleep period data; like Figure 4As shown, in step S2, the sleep start point and sleep end point can be detected based on a sliding window. Specifically, scanning backward from the starting position of the numerically segmented sequence, if the proportion of the wake phase is less than 20% within a consecutive 5-minute window starting from a certain time period, then that time period is determined as the sleep start point. The sleep end point can be determined using a reverse scanning method, that is, scanning backward from the end of the segmented sequence to find the position that meets the above sleep determination conditions, and determining the sleep end point accordingly. After determining the sleep start point and sleep end point, the segmented sequence between them is extracted as sleep period data. If no sleep start point is detected, it is determined that there is no valid sleep in that segment of data.
[0043] S3: Start scanning from the first period of sleep, taking the non-rapid eye movement (NREM) sleep stage as the start of a new cycle. When the cycle end condition is met, end the current cycle and calculate the cycle duration. If the preset minimum cycle duration threshold is met, save the current cycle and then continue to search for the next candidate sleep cycle until the end of sleep is reached. The cycle termination conditions include: detecting the end of sleep, detecting sleep interruption, and detecting a continuous NREM segment after a continuous rapid eye movement (REM) segment with a duration longer than a preset NREM duration threshold or a continuous NREM and wake mixed segment with a duration longer than a preset NREM and wake mixed segment duration threshold as cycle transition points. like Figure 5 As shown, in step S3, sleep data is scanned sequentially, and candidate sleep cycles are obtained according to cycle start and cycle end rules. For cycle start, when N1, N2, or N3 is first encountered during the scan, that period is taken as the starting point of a candidate sleep cycle.
[0044] For the end of a cycle, the current candidate sleep cycle terminates when any of the following conditions are met: First, the scan reaches the end of the sleep phase data; Second, detect wake segments with a continuous duration greater than or equal to a preset sleep interruption duration threshold; Third, after detecting a continuous REM segment, if there is an NREM segment with a duration longer than the preset NREM duration threshold, or if there is an NREM and Wake mixed segment with a duration longer than the preset NREM and Wake mixed segment duration threshold, then use it as the periodic transition point.
[0045] In this embodiment, the preset threshold for sleep interruption duration is 5 minutes, the preset threshold for NREM duration is 6 minutes, and the preset threshold for the duration of the mixed NREM and Wake segment is 8 minutes. When detecting cycle transition points, after the scan enters the REM segment, the subsequent NREM stage of that REM segment is checked. If, before the reappearance of a REM segment or the occurrence of a sleep interruption, there is an NREM segment with a duration meeting the above threshold requirements, or a mixed NREM and Wake segment with a duration meeting the above threshold requirements, then it is determined that the current candidate sleep cycle should end near that REM segment.
[0046] When determining the end point of a cycle, adjustments can be made based on the interval between the end position of a consecutive REM segment and the start position of the next NREM segment. If there is no interval, the current candidate sleep cycle ends at the end point of the consecutive REM segment; if there is an interval and the interval duration is less than a preset sleep interruption duration threshold, the current candidate sleep cycle ends at the last REM segment within that interval; if the interval duration is greater than or equal to the preset sleep interruption duration threshold and a sleep interruption occurs within the interval, the current candidate sleep cycle ends before the start of that sleep interruption; if the interval duration is greater than or equal to the preset sleep interruption duration threshold but no sleep interruption occurs within the interval, the current candidate sleep cycle ends at the last REM segment within that interval.
[0047] The candidate sleep cycles obtained from the initial segmentation need to meet a preset minimum cycle duration threshold. If the current cycle duration is less than the preset minimum cycle duration threshold, the cycle is not saved; if the current cycle duration is greater than or equal to the preset minimum cycle duration threshold, it is saved as a candidate sleep cycle. In this embodiment, the preset minimum cycle duration threshold is 1 minute.
[0048] S4: Post-process all candidate sleep cycles initially retained. The post-processing includes: merging cycles that meet preset conditions, identifying and segmenting fragmented light sleep segments in the cycles, segmenting abnormally long cycles that meet preset conditions, and deleting invalid cycles. like Figure 6 As shown, in step S4, all initially retained candidate sleep cycles are sequentially processed through cycle merging, fragmented light sleep segment segmentation, abnormally long cycle segmentation, and invalid cycle deletion. Cycle merging is used to correct excessive cycle segmentation caused by brief awakenings, short REM segments, or delayed REM episodes. Specifically, if a previous candidate sleep cycle ends with a REM segment whose duration is less than a preset effective REM duration threshold, and the interval between this candidate sleep cycle and the next candidate sleep cycle is less than a preset sleep interruption duration threshold, then these two candidate sleep cycles are merged into one candidate sleep cycle. In this embodiment, the preset effective REM duration threshold is 3 minutes, and the preset sleep interruption duration threshold is 5 minutes.
[0049] If the preceding candidate sleep cycle contains NREM sleep with a duration longer than a preset NREM duration threshold but does not contain effective REM sleep, and the following candidate sleep cycle is dominated by REM sleep with the preceding NREM sleep duration less than the preset NREM duration threshold, and the interval between the two candidate sleep cycles is less than a preset interval threshold, then the two adjacent candidate sleep cycles are merged. In this embodiment, the preset NREM duration threshold is 6 minutes, and the preset interval threshold is 10 minutes; "dominated by REM sleep" means that the REM sleep duration in the following candidate sleep cycle is greater than 50%.
[0050] S5: Perform statistical analysis on the effective sleep cycles obtained from post-processing and output the results.
[0051] like Figure 7 As shown, in step S5, the effective sleep cycles obtained after post-processing are statistically analyzed, and the sleep cycle sequence and cycle statistics results are output. The sleep cycle sequence includes the start time, end time, total duration, duration and proportion of each sleep stage within each effective sleep cycle, cycle type identifier, and relative position of the cycle.
[0052] The cycle statistics include the total number of cycles, average cycle duration, standard deviation of cycle duration, longest cycle duration, shortest cycle duration, average percentage of N1 stage, average percentage of N2 stage, average percentage of N3 stage, average percentage of REM stage, average percentage of Wake stage, and the number and percentage of NREM-REM cycles. Cycle evolution can also be assessed based on the order of effective sleep cycles throughout the night. For example, by comparing the total duration of N3 stage and the total duration of REM stage in the first and second halves of the night, it can be determined whether the sleep structure shows a trend of gradually decreasing N3 stage and gradually increasing REM stage.
[0053] In step S1 of this invention, the sleep stage labels are processed for discrete category standardization. In step S2, the stage sequence between the sleep start point and the end point is extracted, so that the cycle division is limited to the actual sleep interval. The wakefulness segment before falling asleep and the terminal wakefulness segment are not included in the cycle calculation, and the start and end positions of the cycle are more in line with the actual sleep process. In step S3, the NREM stage is used as the cycle start point, and candidate cycles are screened in combination with the minimum cycle duration threshold. Short-term fluctuations will not be misidentified as independent cycles. At the same time, by setting NREM segments with a continuous duration greater than the preset NREM duration threshold after continuous REM segments, or NREM and Wake mixed segments with a continuous duration greater than the preset NREM and Wake mixed segment duration threshold, as the cycle conversion basis, through this step, this invention can still identify the boundary position between adjacent sleep cycles even when the duration of continuous REM segments at the end of the sleep cycle may be very short after frequent conversion between REM and NREM.
[0054] In step S4, adjacent cycles segmented by short-term awakenings are merged, and fragmented segments formed by alternating light sleep and wake, as well as long cycles with abnormal durations, are segmented. At the same time, candidate cycles with incomplete stage structures are deleted, so that the remaining cycle structure is more consistent with the actual sleep process. Finally, in step S5, the cycle boundary and cycle duration information are output to obtain a cycle sequence that can be used for overnight sleep structure analysis.
[0055] Furthermore, in step S3, after detecting a continuous REM segment, the search begins from the next NREM period after the end of the continuous REM segment to determine whether there is an NREM segment with a duration longer than a preset NREM duration threshold, or an NREM and Wake mixed segment with a duration longer than a preset NREM and Wake mixed segment duration threshold, before the REM segment reappears or the sleep is interrupted. If such a segment exists, it is taken as the cycle transition point.
[0056] After a continuous REM segment ends, the current cycle is not immediately considered over. Instead, the sleep cycle is observed to see if subsequent sleep stages enter a stable NREM process. This approach prevents brief stage transitions from being directly identified as new cycle boundaries. Even if REM activity is not significant, the boundary between adjacent cycles can be determined based on the continuity of subsequent NREM or NREM-Wake mixed segments.
[0057] Furthermore, when calculating the duration of the NREM segment, a brief Wake segment is allowed, and the brief Wake segment is not included in the NREM segment duration; at the same time, the duration of the mixed NREM and Wake segment is calculated separately to determine whether the cycle transition point condition is met.
[0058] The inclusion of brief wake segments within the NREM segment is designed to account for the frequent occurrence of short awakenings during actual sleep. These brief wake segments are not included in the NREM duration, preventing the calculation of an interrupted NREM segment as a complete NREM segment. Simultaneously, the duration of the mixed NREM and wake segments is calculated separately, allowing for the inclusion of alternating light sleep and brief awakenings within the overall sleep progression process in the cycle transition assessment, reducing missegmentation caused by brief wake segments.
[0059] Furthermore, the period for merging that meets preset conditions includes: If any of the candidate sleep cycles ends with a miscarriage REM segment, and the interval between the candidate sleep cycle and the next candidate sleep cycle is less than a preset sleep interruption duration threshold, then the candidate sleep cycle and the next candidate sleep cycle are merged into one candidate sleep cycle.
[0060] A miscarriage REM segment typically indicates a very short REM process that does not form a complete cycle end characteristic. If the interval between it and the next candidate sleep cycle is very short, it is more like a brief fluctuation within the same cycle than a true sleep interruption. Combining such adjacent candidate cycles can prevent a complete sleep cycle from being split into two cycles by miscarriage REMs and short intervals.
[0061] Furthermore, the merging of cycles that meet the preset conditions also includes: when two adjacent candidate sleep cycles are in a situation where the first candidate sleep cycle contains NREM sleep with a duration longer than a preset NREM duration threshold and does not contain effective REM sleep, the second candidate sleep cycle is dominated by REM sleep and the duration of NREM sleep before REM sleep is less than the preset NREM duration threshold, and the interval between the two candidate sleep cycles is less than a preset interval threshold, the two adjacent candidate sleep cycles are merged.
[0062] The previous candidate period already has a relatively complete NREM process, but lacks effective REM; the subsequent candidate period is mainly REM, but the NREM duration before REM is insufficient. When the interval between the two is short, merging them can re-incorporate the originally separated NREM and REM parts into the same period, reducing the period splitting caused by the delayed occurrence of REM.
[0063] Furthermore, the identification and segmentation of fragmented light sleep segments in the cycle includes: identifying continuous segments consisting of light sleep stages and wake stages within a candidate sleep cycle; when the duration of the continuous segment is greater than a preset fragment duration threshold and the proportion of the wake stage is greater than a preset wake proportion threshold, the continuous segment is identified as a fragmented light sleep segment, and the candidate sleep cycle is segmented into candidate sleep cycles before and after the fragmented light sleep segment, using the fragmented light sleep segment as the boundary.
[0064] After cycle merging, fragmented light sleep segments within each candidate sleep cycle are identified. These fragmented light sleep segments are continuous segments consisting of N1, N2, and Wake stages. If a continuous segment begins and ends with a Wake stage, its duration exceeds a preset fragment duration threshold, the proportion of the Wake stage is greater than a preset Wake proportion threshold, and the continuous segment does not contain N3 or REM stages, then it is identified as a fragmented light sleep segment.
[0065] In this embodiment, the preset fragment duration threshold is 10 minutes, and the preset Wake percentage threshold is 35%. Specifically, during identification, all Wake events within a candidate sleep cycle can be identified first. Then, using different Wake events as the segment start and end points, multiple candidate segments starting and ending with the Wake phase are generated and traversed from longest to shortest. If a candidate segment meets the conditions of duration, Wake phase percentage, and not containing N3 and REM phases, then that candidate segment is identified as a fragmented light sleep segment.
[0066] After identifying the fragmented light sleep segment, the original candidate sleep cycle is divided into two candidate sleep cycles, one before and one after the segment, using the segment as the boundary; the fragmented light sleep segment itself is not saved as a candidate sleep cycle.
[0067] When light sleep and wake stages alternate continuously for an extended period, it usually indicates that the sleep process before and after that point is no longer continuous and stable. Using this fragmented light sleep segment as a dividing line allows for the separate processing of the two sleep stages, reducing the mismerization of cycles caused by repeated alternations between light sleep and brief awakenings.
[0068] Furthermore, the segmentation of abnormally long cycles that meet preset conditions includes: when the total duration of the candidate sleep cycle exceeds a preset abnormally long cycle threshold, and there is a Wake segment within the candidate sleep cycle with a duration greater than the dynamic interruption threshold, the candidate sleep cycle is segmented into two candidate sleep cycles using the Wake segment as the segmentation point.
[0069] Abnormally long sleep cycles within candidate sleep cycles are segmented. If the total duration of a candidate sleep cycle exceeds a preset abnormally long cycle threshold, and the candidate sleep cycle contains a wake segment with a duration exceeding a dynamic interruption threshold, then the candidate sleep cycle is segmented into two candidate sleep cycles using this wake segment as the segmentation point. In this embodiment, the preset abnormally long cycle threshold is 130 minutes, and the dynamic interruption threshold is 3 minutes.
[0070] Furthermore, for candidate sleep cycles with a total duration exceeding a preset abnormally long cycle threshold, the presence of a light sleep mixed zone can be identified. This light sleep mixed zone consists of a mixture of N1, N2, and wake stages and does not coincide with the start or end point of the candidate sleep cycle. If the duration of the light sleep mixed zone exceeds a preset mixed zone duration threshold, and the portion before the light sleep mixed zone includes an N3 stage with a duration exceeding a preset deep sleep threshold, and the portion after the light sleep mixed zone includes a REM stage with a duration exceeding a preset REM threshold or an N3 stage with a duration exceeding a preset deep sleep threshold, then it is determined that the abnormally long cycle may be formed by the erroneous merging of two independent sleep cycles.
[0071] In this embodiment, the preset mixed-sleep duration threshold is 20 minutes, the preset deep sleep judgment threshold is 1 minute, and the preset REM judgment threshold is 3 minutes. After determining the light sleep mixed zone, the position of the lightest sleep within this light sleep mixed zone can be selected as the segmentation point. Specifically, the N1 and Wake mixed segment with a duration greater than or equal to 3 minutes within the light sleep mixed zone can be preferentially selected as the segmentation point; if such a mixed segment does not exist, a continuous segment with a duration greater than or equal to 0.5 minutes and consisting only of the Wake phase can be selected as the segmentation point; if no segmentation point that meets the conditions still does not exist, the abnormally long cycle will not be segmented.
[0072] When a candidate sleep cycle is significantly longer than expected, and includes a long wake segment, it usually indicates that the sleep processes before and after the wake segment should not be counted as the same cycle. Using the wake segment as a dividing point, the mistakenly merged long cycles can be separated.
[0073] Furthermore, the deletion of invalid cycles includes deleting at least one of the following candidate sleep cycles: candidate sleep cycles with a duration lower than a preset minimum cycle duration threshold; candidate sleep cycles containing only NREM sleep and with a deep sleep duration lower than a preset deep sleep duration threshold; and candidate sleep cycles containing effective REM sleep, but with the NREM sleep duration before the start of REM sleep lower than a preset NREM duration threshold.
[0074] After completing the above merging and segmentation processes, invalid sleep cycles are deleted from the candidate sleep cycles. The invalid cycles include at least one of the following: First, candidate sleep cycles with a duration lower than a preset minimum cycle duration threshold. In this embodiment, different deletion conditions can be set based on the relative position of the candidate sleep cycle within the entire night's sleep. For example, when a candidate sleep cycle is located in the early stage of sleep and its duration is less than or equal to 40 minutes, the candidate sleep cycle is deleted; when a candidate sleep cycle is located in the later stage of sleep and its duration is less than or equal to 30 minutes, the candidate sleep cycle is deleted. The early stage of sleep is defined as an interval with a relative position less than or equal to 0.6, and the relative position can be determined based on the starting or center position of the candidate sleep cycle in the sleep data.
[0075] Second, only candidate sleep cycles containing NREM sleep with a deep sleep duration below a preset deep sleep duration threshold are selected. For example, for a candidate sleep cycle whose total REM stage duration is less than a preset effective REM stage duration threshold, if its total N3 stage duration is less than a preset deep sleep duration threshold, the candidate sleep cycle is deleted. In this embodiment, the preset effective REM stage duration threshold is 3 minutes, and the preset deep sleep duration threshold is 1 minute. Furthermore, if the total N3 stage duration is 1 to 3 minutes, but the wake stage accounts for more than or equal to 10%, the candidate sleep cycle can also be deleted.
[0076] Third, candidate sleep cycles that include effective REM sleep but whose NREM sleep duration before the start of REM sleep is less than a preset NREM duration threshold. For example, for a candidate sleep cycle whose total REM stage duration is greater than or equal to a preset effective REM stage threshold, if the total NREM stage duration before the start of REM sleep is less than the preset NREM stage threshold, then the candidate sleep cycle is deleted.
[0077] Candidate cycles that are too short, those that contain only NREM but lack deep sleep, and those with insufficient pre-REM NREM duration typically lack the stage structure that a complete sleep cycle should have. Removing these types of cycles can prevent short-term sleep stage changes, isolated NREM segments, or REM segments from being mistakenly output as complete sleep cycles, making the final retained cycle closer to a complete cycle in the actual sleep process.
[0078] Example 2 Based on Example 1, this embodiment further introduces sleep staging confidence to reduce the impact of sleep staging errors on the sleep cycle division results.
[0079] In this embodiment, the sleep staging model outputs the sleep stage label for each time period, and simultaneously outputs the staging confidence score corresponding to that sleep stage label. The staging confidence score represents the probability value that the corresponding time period is classified as that sleep stage label, and its value ranges from [0,1]. For example, the sleep staging model can output the probability values corresponding to Wake, N1, N2, N3, and REM through a softmax layer, and take the category with the highest probability value as the sleep stage label for that time period, while taking the highest probability value as the staging confidence score for that time period.
[0080] In step S1, during the preprocessing of the staging sequence, in addition to standardizing the sleep stage labels into discrete category identifiers, the staging confidence score and corresponding discrete category identifier for each time period are also saved. For time periods with a staging confidence score lower than a preset confidence threshold, their labels are marked as pending confirmation labels. The preset confidence threshold is 0.6, but it can also be adjusted according to the output distribution of different sleep staging models.
[0081] In step S3, when determining whether an NREM segment or a mixed NREM and Wake segment exists after a continuous REM segment, a confidence-weighted duration can be used instead of the actual duration. Specifically, for the continuous segment to be determined, the confidence-weighted duration is calculated according to the following formula:
[0082] Where Tw represents the confidence-weighted duration, n represents the number of time periods within the continuous segment, pi represents the stage confidence of the sleep stage label corresponding to the i-th time period, and Δti represents the duration of the i-th time period.
[0083] When determining whether an NREM segment has reached a preset NREM duration threshold, the confidence-weighted duration corresponding to that NREM segment is compared with the preset NREM duration threshold. For mixed NREM and Wake segments, the confidence-weighted duration is calculated based on the stage confidence levels corresponding to the NREM and Wake labels within the mixed segment, and then compared with the preset NREM and Wake mixed segment duration threshold. Low-confidence periods contribute less to the weighted calculation, which can prevent a small number of mis-staged labels from directly changing the cycle transition point.
[0084] In step S4, when determining whether two adjacent candidate sleep cycles meet the merging conditions, the interval confidence level of the interval segment between the two candidate sleep cycles can also be calculated. The interval confidence level is the average of the confidence levels of each time period within the interval segment, or it can be the lowest value of the confidence levels of each time period within the interval segment. When the interval confidence level is lower than a preset interval confidence level threshold, it indicates that there is still uncertainty as to whether the interval segment is a true wake segment. In this case, the preset interval threshold can be increased, or the low-confidence interval segment can not be directly used as the basis for preventing the merging of adjacent candidate sleep cycles, thereby reducing false sleep interruptions caused by low-confidence wake tags.
[0085] When identifying fragmented light sleep segments, the confidence level of a continuous segment consisting of light sleep and wake stages can be calculated. The segment confidence level is the weighted average of the confidence levels corresponding to the N1, N2, and wake labels within that continuous segment. When the segment confidence level is greater than a preset segment confidence threshold, it indicates that the segment is more likely to be a genuine alternation between light sleep and wake stages. The preset fragment duration threshold or preset wake proportion threshold can be lowered within a preset lower limit to make the segment more easily identified as a fragmented light sleep segment. When the segment confidence level is lower than the preset segment confidence threshold, the original threshold is maintained, or the segment is not used as a segmentation boundary. This reduces false fragmentation caused by stage errors.
[0086] When deleting invalid cycles, for candidate sleep cycles whose duration is lower than the preset minimum cycle duration threshold, if there are periods in the candidate sleep cycle with a stage confidence level lower than the preset low confidence threshold, and the cumulative duration of the low confidence period accounts for a proportion greater than the preset low confidence proportion, then the candidate sleep cycle will not be directly deleted, but will be marked as a cycle pending review.
[0087] For candidate sleep cycles that contain valid REM sleep but whose NREM sleep duration before the start of REM sleep is less than a preset NREM duration threshold, if the proportion of low-confidence periods in the NREM sleep before the start of REM sleep is greater than a preset proportion, the candidate sleep cycle will also be marked as a cycle pending review. The cycle pending review can be identified separately in the output results, or it can be included in subsequent manual review or secondary algorithm judgment processes. When counting valid sleep cycles, the cycle pending review can be counted separately from the confirmed valid sleep cycles.
[0088] By introducing a staged confidence level, this embodiment adjusts the cycle judgment method from simply relying on actual duration to combining the reliability of tags. Low-confidence periods are reduced in the duration calculation of cycle transition points; low-confidence wake intervals do not directly prevent the merging of adjacent candidate sleep cycles; low-confidence fragment segments do not easily trigger segmentation; and suspected invalid cycles with high low confidence are not directly deleted. This reduces the impact of automatic staged errors on cycle boundaries, cycle merging, and invalid cycle screening, making the cycle division results more suitable for application scenarios with large fluctuations in staged quality, such as wearable devices.
Claims
1. A sleep cycle division method based on multi-condition extraction and multi-stage correction, comprising obtaining physiological signals during a user's sleep and performing sleep staging according to the physiological signals to obtain a staging sequence composed of sleep staging labels, characterized in that, It also includes the following steps: S1: Preprocess the phase sequence and standardize the labels of each time period into preset discrete category identifiers; S2: Scan the preprocessed stage sequence, detect the sleep start point and sleep end point, and extract the stage sequence between the two as sleep period data; S3: Start scanning from the first period of sleep, taking the non-rapid eye movement (NREM) sleep stage as the start of a new cycle. When the cycle end condition is met, end the current cycle and calculate the cycle duration. If the preset minimum cycle duration threshold is met, save the current cycle and then continue to search for the next candidate sleep cycle until the end of sleep is reached. The cycle termination conditions include: detecting sleep termination, detecting sleep interruption, and detecting a continuous NREM segment after a continuous rapid eye movement (REM) segment with a duration longer than a preset NREM duration threshold, or a continuous NREM and wake mixed segment with a duration longer than a preset NREM and wake mixed segment duration threshold as cycle transition points. S4: Post-process all candidate sleep cycles initially retained. The post-processing includes: merging cycles that meet preset conditions, identifying and segmenting fragmented light sleep segments in the cycles, segmenting abnormally long cycles that meet preset conditions, and deleting invalid cycles. S5: Perform statistical analysis on the effective sleep cycles obtained from post-processing and output the results.
2. The sleep cycle partitioning method based on multi-condition extraction and multi-stage correction according to claim 1, characterized in that, In step S3, after a continuous REM segment is detected, the search begins from the next NREM period after the end of the continuous REM segment to determine whether there is an NREM segment with a duration longer than a preset NREM duration threshold, or an NREM and Wake mixed segment with a duration longer than a preset NREM and Wake mixed segment duration threshold, before the REM segment reappears or the sleep is interrupted. If such a segment exists, it is taken as the cycle transition point.
3. The sleep cycle partitioning method based on multi-condition extraction and multi-stage correction according to claim 2, characterized in that, When calculating the duration of the NREM segment, a brief Wake segment is allowed, and the brief Wake segment is not included in the NREM segment duration; at the same time, the duration of the mixed NREM and Wake segment is calculated separately to determine whether the cycle transition point condition is met.
4. The sleep cycle partitioning method based on multi-condition extraction and multi-stage correction according to claim 1, characterized in that, The merging period that meets the preset conditions includes: If any of the candidate sleep cycles ends with a miscarriage REM segment, and the interval between the candidate sleep cycle and the next candidate sleep cycle is less than a preset sleep interruption duration threshold, then the candidate sleep cycle and the next candidate sleep cycle are merged into one candidate sleep cycle.
5. The sleep cycle partitioning method based on multi-condition extraction and multi-stage correction according to claim 4, characterized in that, The merging of cycles that meet the preset conditions also includes: when two adjacent candidate sleep cycles are in a situation where the first candidate sleep cycle contains NREM sleep with a duration longer than the preset NREM duration threshold and does not contain effective REM sleep, the second candidate sleep cycle is dominated by REM sleep and the duration of NREM sleep before REM sleep is less than the preset NREM duration threshold, and the interval between the two candidate sleep cycles is less than the preset interval threshold, the two adjacent candidate sleep cycles are merged.
6. The sleep cycle partitioning method based on multi-condition extraction and multi-level correction according to claim 1, wherein, The process of identifying and segmenting fragmented light sleep segments in a sleep cycle includes: identifying continuous segments consisting of light sleep and wake stages within a candidate sleep cycle; when the duration of the continuous segment exceeds a preset fragment duration threshold and the proportion of the wake stage is greater than a preset wake proportion threshold, the continuous segment is identified as a fragmented light sleep segment; and the candidate sleep cycle is segmented into candidate sleep cycles before and after the fragmented light sleep segment, using the fragmented light sleep segment as the boundary.
7. The sleep cycle partitioning method based on multi-condition extraction and multi-stage correction according to claim 6, characterized in that, The segmentation of abnormally long cycles that meet preset conditions includes: when the total duration of a candidate sleep cycle exceeds a preset abnormally long cycle threshold, and there is a Wake segment within the candidate sleep cycle with a duration greater than a dynamic interruption threshold, the candidate sleep cycle is segmented into two candidate sleep cycles using the Wake segment as the segmentation point.
8. The sleep cycle partitioning method based on multi-condition extraction and multi-stage correction according to any one of claims 1 to 7, characterized in that, The deletion of invalid cycles includes deleting at least one of the following candidate sleep cycles: candidate sleep cycles with a duration lower than a preset minimum cycle duration threshold; candidate sleep cycles containing only NREM sleep and with a deep sleep duration lower than a preset deep sleep duration threshold; and candidate sleep cycles containing effective REM sleep, but with the NREM sleep duration before the REM sleep begins lower than a preset NREM duration threshold.
9. A sleep cycle segmentation system based on multi-condition extraction and multi-level correction, applied to the sleep cycle segmentation method based on multi-condition extraction and multi-level correction as described in claim 1, characterized in that, include: The sleep staging sequence acquisition module is used to acquire physiological signals during the user's sleep and perform sleep staging based on the physiological signals to obtain a staging sequence composed of sleep staging tags. The preprocessing module is used to preprocess the periodic sequence and standardize the labels of each time period into preset discrete category identifiers; The sleep phase extraction module is used to scan the preprocessed phase sequence, detect the sleep start point and sleep end point, and extract the phase sequence between the two as sleep phase data. The candidate cycle segmentation module is used to start scanning from the first period of sleep, taking the non-rapid eye movement sleep (NREM) stage as the start of a new cycle. When the cycle end condition is met, the current cycle ends and the cycle duration is calculated. If the preset minimum cycle duration threshold is met, the current cycle is saved, and then the search for the next candidate sleep cycle continues until the end of sleep is reached. The cycle post-processing module is used to post-process all candidate sleep cycles initially retained. The post-processing includes: merging cycles that meet preset conditions, identifying and segmenting fragmented light sleep segments in the cycle, segmenting abnormally long cycles that meet preset conditions, and deleting invalid cycles. The results output module is used to perform statistical analysis on the effective sleep cycles obtained after post-processing and output the results.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that performs the method of any one of claims 1 to 8.