A sleep period detection method based on multi-source electrocardio feature fusion

CN122604320APending Publication Date: 2026-08-21HANGZHOU PROTON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611089967.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-08-21

AI Technical Summary

Technical Problem

若算法直接绑定固定坐标轴、固定采样点数或固定数据字段,则在设备型号变化、采样率变化、记录中断、R峰数据缺失或心率数据缺失时稳定性存在不足

Benefits of technology

[0062] 1. By establishing a unified time reference based on sampling rate, start time, and timestamp information, the sampled data at different sampling rates are converted into feature sequences expressed in terms of physical time. This is compatible with different sampling rates and different models of chest patch devices, reducing the algorithm's dependence on fixed device parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122604320A_ABST
    Figure CN122604320A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of sleep detection, and particularly relates to a sleep period detection method based on multi-source electrocardio feature fusion, which comprises obtaining three-axis acceleration data and electrocardio data of an electrocardio acquisition device, obtaining corresponding sampling rate, starting time and timestamp information, and establishing a unified time reference based on the sampling rate, the starting time and the timestamp information.In the present application, the sampling level data under different sampling rates is converted into a feature sequence expressed according to physical time by establishing a unified time reference based on the sampling rate, the starting time and the timestamp information, different sampling rates and different types of chest patch devices can be compatible, the dependence of the algorithm on fixed device parameters is reduced, and the accuracy of sleep starting time positioning is improved by fusing and determining sleep-related candidates of multiple sleep features, fusing multiple evidences of heart rate trend, stable breathing-related frequency and body movement decline.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sleep detection technology, specifically a sleep period detection method based on the fusion of multi-source electrocardiogram features. Background Technology

[0002] Wearable chest patch physiological parameter acquisition devices are characterized by their small size, ease of wear, and ability to perform long-term continuous monitoring. They can continuously record signals such as electrocardiogram, heart rate, and acceleration in scenarios such as daily life, outpatient follow-up, exercise recovery, chronic disease management, and clinical observation. Compared with traditional polysomnography, chest patch devices are more suitable for large-scale, low-intensity, and long-term continuous monitoring, and are suitable for automatically identifying the user's sleep stages based on chest patch data.

[0003] Existing sleep period identification schemes typically rely on fixed equipment, fixed sampling rates, or single signals. For example, judging solely based on the degree of acceleration at rest can easily misclassify non-sleep states such as lying down, resting, reading, and prolonged sitting as sleep; judging solely based on a decrease in heart rate is easily affected by individual baseline heart rate, medication, emotions, exercise recovery, and changes in posture; and judging solely based on nighttime periods is difficult to adapt to scenarios such as shift work, naps, and abnormal sleep patterns.

[0004] Chest patch devices are typically worn on the chest, and the wearing direction, application angle, sampling rate, channel naming, and data completeness may vary between different products or batches. If the algorithm is directly bound to a fixed coordinate axis, a fixed number of sampling points, or a fixed data field, its stability will be insufficient when there are changes in device model, sampling rate, recording interruption, missing R-peak data, or missing heart rate data. Summary of the Invention

[0005] The purpose of this invention is to provide a sleep period detection method based on multi-source electrocardiogram feature fusion to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution:

[0007] A sleep period detection method based on multi-source electrocardiogram feature fusion includes:

[0008] Acquire triaxial acceleration data and ECG data from the ECG acquisition device, and obtain the corresponding sampling rate, start time, and timestamp information;

[0009] A unified time reference is established based on sampling rate, start time and timestamp information, and the sampling level data under different sampling rates are converted into feature sequences expressed in physical time.

[0010] A candidate sequence of supine positions is generated based on triaxial acceleration data, and the master ward window is determined based on the candidate sequence of supine positions.

[0011] Within the master bedroom window and its neighborhood, multiple ECG sleep features are extracted from the feature sequence, and sleep-related candidates are identified from the ECG sleep features.

[0012] Based on the master bedroom window, sleep-related candidates of multiple sleep characteristics are fused and judged to determine the sleep start time and sleep end time;

[0013] Output sleep period information consisting of sleep start time and sleep end time, as well as the corresponding sleep duration and intermediate judgment information.

[0014] Furthermore, the ECG data includes one or more of the following: ECG waveform data, R-peak timestamp data, or heart rate data;

[0015] When the ECG data does not include R-peak timestamp data and heart rate data, the ECG waveform data is input into the trained R-peak recognition algorithm to identify the R-peak and generate the R-peak timestamp, and then the heart rate data is obtained from the R-peak timestamp.

[0016] Furthermore, a unified time reference is established based on sampling rate, start time, and timestamp information, including:

[0017] The filter window, aggregation window, confirmation window, and search window are all defined as physical time lengths, and converted into the corresponding number of sampling points or the corresponding time index according to the actual sampling rate provided by the current chest patch physiological parameter acquisition device.

[0018] Based on the start time and timestamp information, establish absolute time indexes for triaxial acceleration data and electrocardiogram data respectively;

[0019] The time indexes of different signals are aligned, and compatibility processing is performed through interpolation, padding, removal, or missing markers when there are data gaps, inconsistent sampling rates, or invalid data markers.

[0020] Furthermore, a candidate sequence for supine positions is generated based on triaxial acceleration data, and the master bedroom position window is determined based on the candidate sequence, including:

[0021] Low-pass filtering is applied to the triaxial acceleration data to separate the low-frequency gravity component;

[0022] The low-frequency gravity component is normalized into a gravity direction vector, and one or more upright direction candidates are generated based on segments with large activity amplitude, daytime stable segments, full-record stable segments, nighttime stable segments, daytime active segments, or principal component directions.

[0023] The tilt angle sequence corresponding to each candidate upright direction was calculated, and the candidates upright directions were scored according to the proportion of daytime lying position, the proportion of nighttime lying position, the proportion of lying position in the entire record, and the longest continuous lying position duration at night.

[0024] Select the candidate upright direction that meets the preset conditions as the target upright direction, and generate a minute-level tilt angle sequence based on the target upright direction;

[0025] When the tilt angle in the minute-level tilt angle sequence is greater than the tilt angle threshold, the corresponding time is marked as a supine position;

[0026] Fill the short non-recumbent gaps between adjacent supine segments;

[0027] Eliminate lying position segments whose duration is shorter than the preset duration;

[0028] In the remaining supine position segments, the master bedroom position window is selected according to the duration constraint and time prior.

[0029] Furthermore, the various electrocardiographic sleep characteristics include heart rate characteristics, respiratory-related frequency characteristics, body movement characteristics, and posture characteristics;

[0030] Sleep-related candidates for heart rate characteristics include candidates for decreased heart rate, candidates for increased heart rate, and candidates for low steady heart rate.

[0031] Sleep-related candidates for respiratory-related frequency features are respiratory rate stability candidates.

[0032] Sleep-related candidates for body movement characteristics include candidates for decreased body movement and candidates for recovery of body movement.

[0033] Sleep-related candidates for posture features are called posture change candidates. The end point of the master bedroom window, or the time boundary of the candidate sequence of the lying position changing from the lying position to the non-lying position and continuously satisfying the non-lying position condition, is determined as a posture change candidate. The posture change candidate is used to constrain the sleep end time.

[0034] Furthermore, heart rate features are extracted from the feature sequence, and candidates for decreasing heart rate, increasing heart rate, and low steady heart rate are identified from these heart rate features, including:

[0035] Outlier removal and median filtering are performed on the heart rate data to generate a minute-level heart rate sequence;

[0036] Within the master bedroom window, the supine heart rate threshold is determined based on the preset supine heart rate quantiles, and the supine heart rate threshold is constrained by combining the full record heart rate quantiles.

[0037] Low heart rate candidate sequences are generated based on the supine heart rate threshold, and heart rate stability is determined by rolling volatility. Time periods with low heart rate and low heart rate volatility are selected as low stable heart rate candidates.

[0038] Within the master bedroom window and its neighborhood, search for time periods when the heart rate changes from a relatively high value to a relatively low value as candidates for a decrease in heart rate.

[0039] In the latter part of sleep after the onset of sleep, up to near the end of the window in the master bedroom, the period when the heart rate changes from a relatively low value to a relatively high value is searched as a candidate for heart rate increase.

[0040] Preferably, respiratory-related frequency features are extracted from the feature sequence, and stable respiratory rate candidates are generated from the respiratory-related frequency features, including:

[0041] Calculate the interval sequence between adjacent R peaks based on the R peak timestamp data, and remove adjacent R peak intervals that do not meet the physiological range;

[0042] Interpolate adjacent R-peak interval sequences into equally spaced sequences;

[0043] Bandpass filtering is applied to equally spaced sequences to obtain respiratory-related components;

[0044] The respiratory-related components are divided into multiple periods, and the dominant respiratory frequency is determined in each period.

[0045] Search for time series that consistently meet the rate stability condition within the master bedroom window, and generate respiratory rate stability candidates based on the difference in dominant frequency before and after the stable period, the change amplitude of adjacent periods within the stable period, and the amplitude of stability improvement.

[0046] Preferably, body motion features are extracted from the feature sequence, and body motion descent candidates and body motion recovery candidates are extracted from the body motion features, including:

[0047] Calculate the dynamic acceleration components based on triaxial acceleration data and low-frequency gravity components;

[0048] The body motion envelope is generated based on dynamic acceleration components, and the body motion envelope is aggregated into a minute-level body motion sequence.

[0049] Search for candidates for a decrease in body movement near the candidate for basal sleep initiation, where the body movement envelope changes from a relatively high value to a relatively low value.

[0050] Search for candidates for motion recovery in the latter part of the master bedroom window.

[0051] Furthermore, determining the sleep onset time includes:

[0052] When a candidate for a decrease in heart rate meets the strong decrease condition, and the difference between the median heart rate before and after the candidate for a decrease in heart rate exceeds the strong decrease threshold, the candidate for a decrease in heart rate is used as the candidate for the start of basal sleep, and the candidate for a stable respiratory rate is restricted to be corrected only near the candidate for the start of basal sleep.

[0053] When the heart rate drop candidate does not meet the strong drop condition, the quality score of the respiratory rate stable candidate, the posterior heart rate confirmation result and the posterior body movement confirmation result are used to determine whether the respiratory rate stable candidate is used as the basic sleep initiation candidate.

[0054] When the body movement descent candidates satisfy the time distance constraint and window validity constraint, the basic sleep initiation candidates are corrected using the body movement descent candidates;

[0055] When none of the candidates meet the preset fusion conditions, the process reverts to the starting point of the low steady heart rate candidate or the master bedroom position window, and the final candidate is determined as the sleep start time.

[0056] Furthermore, determining the sleep end time includes:

[0057] The endpoint of the master bedroom window is used as the boundary constraint for the candidate sleep end time.

[0058] By combining the high heart rate confirmation ratio of candidates with increased heart rate, the magnitude of heart rate increase, the distance between the candidate time and the end point of the master bedroom window, and candidates with physical recovery or postural change, candidates for sleep end time are selected.

[0059] When there are no candidates for rising heart rate or the quality is insufficient, backtracking is performed based on the last low and stable heart rate candidate in the supine position, the original sleep score window, or the end point of the master bedroom window.

[0060] The validity of sleep periods consisting of sleep start time and sleep end time is checked, and if the duration constraint is not met, the system reverts to the master bedroom window.

[0061] Compared with the prior art, the beneficial effects of the present invention are:

[0062] 1. By establishing a unified time reference based on sampling rate, start time, and timestamp information, the sampled data at different sampling rates are converted into feature sequences expressed in terms of physical time. This is compatible with different sampling rates and different models of chest patch devices, reducing the algorithm's dependence on fixed device parameters.

[0063] 2. By using the master bedroom window as the posture gating range for sleep-related candidate fusion determination, and using the endpoint of the master bedroom window as the boundary constraint for sleep end time candidates, it is beneficial to reduce the risk of misjudging awake rest as sleep.

[0064] 3. By fusing and judging sleep-related candidates from multiple sleep characteristics, and integrating multiple pieces of evidence such as heart rate trends, stable respiratory rates, and decreased body movement, the accuracy of sleep onset time localization is improved.

[0065] 4. The end time of sleep is determined by the endpoint of the master bedroom position, the rise in heart rate, and the recovery of body movement, which reduces misjudgment caused by a single heart rate fluctuation. Attached Figure Description

[0066] Figure 1 This is a schematic diagram of the overall process of the method of the present invention;

[0067] Figure 2This is a schematic diagram of the process for establishing a unified time reference structure in this invention;

[0068] Figure 3 This is a schematic diagram of the process for determining the master bedroom position window in this invention;

[0069] Figure 4 This is a schematic diagram of the heart rate feature extraction process in this invention;

[0070] Figure 5 This is a schematic diagram of the process for extracting respiratory-related frequency features in this invention;

[0071] Figure 6 This is a schematic diagram of the process for extracting body motion features in this invention;

[0072] Figure 7 This is a schematic diagram of the process for determining the sleep start time in this invention;

[0073] Figure 8 This is a schematic diagram of the process for determining the sleep end time in this invention;

[0074] Figure 9 This is a schematic diagram illustrating the determination of sleep time periods in this invention. Detailed Implementation

[0075] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0076] Please see Figure 1-9 In this embodiment of the invention, a sleep period detection method based on multi-source electrocardiogram feature fusion includes:

[0077] S1, acquire the triaxial acceleration data and ECG data from the ECG acquisition device, and obtain the corresponding sampling rate, start time and timestamp information;

[0078] Among them, electrocardiogram data includes one or more of the following: electrocardiogram waveform data, R peak timestamp data, or heart rate data;

[0079] When the ECG data does not include R-peak timestamp data and heart rate data, the ECG waveform data is input into the trained R-peak recognition algorithm to identify the R-peak and generate the R-peak timestamp, and then the heart rate data is obtained from the R-peak timestamp.

[0080] S2 establishes a unified time reference based on sampling rate, start time and timestamp information, and converts the sampling level data under different sampling rates into feature sequences expressed in physical time.

[0081] S3, Generate a candidate sequence of supine positions based on the triaxial acceleration data, and determine the master bedroom window based on the candidate sequence of supine positions;

[0082] S4. Within the master bedroom window and its neighborhood, extract multiple ECG sleep features from the feature sequence and identify sleep-related candidates from the ECG sleep features.

[0083] Among them, various electrocardiogram sleep characteristics include heart rate characteristics, respiratory-related frequency characteristics, body movement characteristics, and posture characteristics;

[0084] Sleep-related candidates for heart rate characteristics include candidates for decreased heart rate, candidates for increased heart rate, and candidates for low steady heart rate.

[0085] Sleep-related candidates for respiratory-related frequency features are respiratory rate stability candidates.

[0086] Sleep-related candidates for body movement characteristics include candidates for decreased body movement and candidates for recovery of body movement.

[0087] Sleep-related candidates for posture features are posture change candidates.

[0088] S5, based on the master bedroom window, fuses and judges sleep-related candidates of multiple sleep characteristics to determine the sleep start time and sleep end time;

[0089] S6 outputs sleep period information consisting of sleep start time and sleep end time, as well as the corresponding sleep duration and intermediate judgment information.

[0090] Specifically, triaxial acceleration data and electrocardiogram (ECG) data are acquired using a chest patch-type physiological parameter acquisition device. A unified time reference is established based on the sampling rate, start time, and timestamp information. Low-frequency gravity components are separated from the triaxial acceleration data to estimate the upright direction and calculate the tilt angle, forming a candidate sequence for supine positions. Short-interval merging and short-duration elimination are performed on the candidate sequences for supine positions, and the master bedroom position window is determined by combining time priors and duration constraints. Low-value stable features of heart rate, heart rate trend change features, respiratory rate stability features, and body movement change features are extracted within the master bedroom position window and its neighborhood. Sleep-related candidates from multiple sleep features are fused to determine the sleep onset time and sleep end time, improving the accuracy of sleep onset time and sleep end time positioning and reducing misjudgments caused by single heart rate fluctuations. Furthermore, by using the master bedroom position window as the posture gating range for the fusion and judgment of sleep-related candidates, and using the endpoint of the master bedroom position window as the boundary constraint for the sleep end time candidate, the risk of misjudging awake rest as sleep is reduced.

[0091] In addition to acquiring triaxial acceleration data and ECG data from the ECG acquisition device, it can also acquire information such as ECG data start time, sampling rate, invalid markers, device identification, and recording time zone;

[0092] Triaxial acceleration data is used for attitude recognition and body motion analysis. R-peak timestamp data is used to generate adjacent R-peak interval sequences and extract stable respiratory rate candidates. Heart rate data is used to identify low stable heart rate, heart rate decrease and heart rate increase, and then extract heart rate decrease candidates, heart rate increase candidates and low stable heart rate candidates.

[0093] The heart rate data can be obtained from the heart rate value directly output by the device or calculated from the R-peak timestamp. When the multi-source data does not contain R-peak timestamp data and heart rate data, but only contains the original ECG waveform data, the R-peak of the original waveform data is identified and the R-peak timestamp is generated. Based on this, the heart rate data and the interval sequence of adjacent R-peaks are obtained as inputs for subsequent extraction of heart rate features and respiratory-related frequency features. Thus, even in the absence of R-peak and heart rate information, subsequent extraction of heart rate features and respiratory-related frequency features can still continue.

[0094] In S6, the output results may include sleep start time, sleep end time, sleep duration, reason for sleep start, reason for sleep end, master bedroom position window, tilt sequence, heart rate threshold, low steady heart rate sequence, heart rate fluctuation rate, heart rate decrease candidate, heart rate increase candidate, respiratory-related main frequency sequence, respiratory-related candidate mass score, acceleration body motion envelope, and body motion transition candidate, etc.

[0095] Intermediate judgment information can be used for device-side quality control, as well as for display on doctor workstations, health management platforms, or algorithm debugging platforms, so that users or doctors can understand the basis for selecting sleep start time and sleep end time;

[0096] In the event of missing data, the system can also output the reason for the missing data and the fallback path. For example, when R-peak data is missing, the respiratory-related frequency stabilization candidate will not be enabled, and when heart rate data is missing, more reliance will be placed on posture and body movement evidence.

[0097] like Figure 2 As shown, in this embodiment, a unified time base is established based on sampling rate, start time, and timestamp information, including:

[0098] S21, the filter window, aggregation window, confirmation window and search window are all defined as physical time lengths, and converted into the corresponding number of sampling points or the corresponding time index according to the actual sampling rate provided by the current chest patch physiological parameter acquisition device;

[0099] S22, Based on the start time and timestamp information, establish absolute time indexes for the triaxial acceleration data and electrocardiogram data respectively;

[0100] S23 aligns the time indices between different signals and performs compatibility processing through interpolation, padding, removal, or missing markers when there are data gaps, inconsistent sampling rates, or invalid data markers.

[0101] In practice, in order to adapt to different chest patch devices and different sampling rates, this embodiment does not fix any time window to a specific number of sampling points. Instead, it first defines the algorithm window in units of seconds, minutes or hours, and then converts it to the number of sampling points according to the actual sampling rate. For example, a one-minute window corresponds to 1,500 sampling points at a 25Hz acceleration sampling rate, and is automatically converted to the corresponding number of points at other sampling rates.

[0102] In this way, low-pass filtering, resampling, rolling statistics, continuous confirmation, search range, and sleep duration constraints all maintain physical consistency.

[0103] When the timestamps of different signals are not completely consistent, an absolute time index can be constructed using the device start time and their respective timestamps. Features can then be mapped to a unified time reference through nearest neighbor alignment, time interpolation, forward padding, backward padding, or missing data marking. For invalid heart rates, abnormal R-peak intervals, and data points that exceed the physiological range, they can be removed or marked first to prevent outliers from directly participating in the fusion decision.

[0104] By establishing a unified time reference based on sampling rate, start time, and timestamp information, the sampled data at different sampling rates are converted into feature sequences expressed in terms of physical time. This approach is compatible with different sampling rates and different models of chest patch devices, reducing the algorithm's dependence on fixed device parameters.

[0105] like Figure 3 As shown, in this embodiment, S3, generating a candidate sequence for the supine position based on triaxial acceleration data includes:

[0106] S311 performs low-pass filtering on the triaxial acceleration data to separate the low-frequency gravity component. The cutoff frequency of the low-pass filter is adjusted according to the sampling rate and the device noise level.

[0107] S312 normalizes the low-frequency gravity component into a gravity direction vector and generates one or more upright direction candidates based on segments with large activity amplitude, daytime stable segments, fully recorded stable segments, nighttime stable segments, daytime active segments, or principal component directions.

[0108] S313, calculate the tilt sequence corresponding to each candidate upright direction, and score the candidates upright directions based on the proportion of daytime lying position, the proportion of nighttime lying position, the proportion of lying position in the entire record, and the longest continuous lying position duration at night.

[0109] S314, select the candidate upright direction that meets the preset conditions as the target upright direction, and generate a minute-level tilt angle sequence based on the target upright direction.

[0110] In practice, the triaxial acceleration is low-pass filtered to separate the low-frequency gravity component. The cutoff frequency of the low-pass filter is determined based on the sampling rate, body motion noise level, and gravity component retention requirements of the current chest patch physiological parameter acquisition device. The low-frequency gravity component is used to characterize the attitude change of the device relative to the direction of gravity.

[0111] To avoid the failure of the fixed coordinate axis due to different chest patch attachment directions, this embodiment adopts multi-candidate upright direction estimation. Specifically, the dynamic upright direction can be estimated based on segments with large activity amplitude, or multiple upright direction candidates can be generated from daytime stable segments, fully recorded stable segments, nighttime stable segments, daytime activity segments, and principal component directions.

[0112] For each candidate upright direction, the angle between the gravity direction and the candidate direction is calculated to obtain the tilt angle sequence. Specifically, the tilt angle sequence is obtained by calculating the dot product of the unit vector of the upright direction and the unit vector of the gravity direction, taking the absolute value of the dot product result, and calculating the inverse cosine angle based on the absolute value of the dot product result.

[0113] For each candidate upright position, the daytime lying position ratio, nighttime lying position ratio, total lying position ratio, longest continuous lying position duration at night, average tilt angle during the day, and average tilt angle throughout the entire record are calculated. The preferred daytime time range is 9:00 to 18:00, and the preferred nighttime scoring time range is 22:00 to 8:00 the next day. The daytime lying position ratio, nighttime lying position ratio, and total lying position ratio are all expressed as percentages.

[0114] The comprehensive score S for each candidate in the upright direction is calculated using the following formula:

[0115] S=3.0×Pd+1.8×max(0, Ad−35)+0.8×max(0, Pa−65)+Cn−0.08×min(Tn, 240)+0.3×max(0, Aa−55)+Cd

[0116] Where Pd represents the daytime recumbent position ratio, Ad represents the daytime average tilt angle, Pa represents the total recumbent position ratio, Cn represents the nighttime recumbent position correction term, Tn represents the longest continuous nighttime recumbent position duration, Aa represents the total record average tilt angle, Cd represents the daytime abnormality penalty term, max represents taking the maximum value, and min represents taking the minimum value.

[0117] When the proportion of nighttime lying positions Pn is less than 20, the nighttime lying position correction term Cn = 1.2 × (20 - Pn);

[0118] When the proportion of nighttime lying positions Pn is greater than 95, the nighttime lying position correction term Cn = 0.5 × (Pn - 95);

[0119] When the proportion of nighttime lying positions Pn is between 20 and 95, the nighttime lying position correction term Cn = 0;

[0120] When the daytime lying position ratio Pd is greater than 60, the daytime abnormal penalty item Cd=5000;

[0121] When the proportion of daytime lying down Pd is not greater than 60%, the daytime abnormal penalty item Cd=0;

[0122] The candidate upright direction with the smallest comprehensive score S is determined as the target upright direction, and a minute-level tilt angle sequence is generated based on the target upright direction.

[0123] like Figure 3 As shown, in this embodiment, S32, determining the master bedroom position window based on the candidate sequence of lying positions, includes:

[0124] S321, when the tilt angle in the minute-level tilt angle sequence is greater than the tilt angle threshold, the corresponding time is marked as a supine position;

[0125] S322, filling the short non-recumbent gaps between adjacent supine segments;

[0126] S323, Remove lying position segments whose duration is shorter than the preset duration;

[0127] S324, in the remaining supine position segments, select the master bedroom position window according to the duration constraint and time prior.

[0128] In practice, if the tilt angle of the minute-level tilt angle sequence is greater than the supine position threshold, it is determined that the current time point is in a supine position. This supine position threshold can be adjusted according to the chest patch installation method, patient population, or equipment calibration results.

[0129] To reduce the impact of short-term turning over or short-term posture changes on the main sleep window, short-interval filling and removal of short-term lying position segments can be performed on the lying position sequence. The short-interval filling time can be set to 5 to 30 minutes, and the short-lying position segment removal threshold can be set to 10 to 15 minutes.

[0130] In the optimized candidate sequence of lying positions, lying position segments whose duration meets the sleep window constraint are selected. If the candidate segment covers the main sleep time period, the longest continuous lying position segment in that time period is selected as the main lying position window. The shortest sleep window duration, the longest sleep window duration, and the main sleep time period can be directly preset and configured, or the specific duration and time period can be configured according to the target user's work and rest or application scenario.

[0131] like Figure 4-8As shown, in this embodiment, in S4, multiple ECG sleep features are extracted from the feature sequence within the master bedroom window and its neighborhood, and sleep-related candidates are determined from the ECG sleep features, specifically including:

[0132] S41, extract heart rate features from the feature sequence, and search for candidates for decreasing heart rate, increasing heart rate, and low stable heart rate from the heart rate features;

[0133] S42, extract respiratory-related frequency features from the feature sequence, and generate stable respiratory rate candidates from the respiratory-related frequency features;

[0134] S43, extract body motion features from the feature sequence, and extract body motion descent candidates and body motion recovery candidates from the body motion features;

[0135] S44 was identified as a candidate for attitude change.

[0136] In specific implementation, when a candidate process for posture change is determined, the end point of the master bedroom position window, or the candidate sequence of the lying position is changed from the lying position state to the non-lying position state, and the time boundary that continuously meets the non-lying position condition is determined as a candidate for posture change. The candidate for posture change is used to constrain the sleep end time.

[0137] like Figure 4 As shown, in this embodiment, heart rate features are extracted from the feature sequence, and candidates for decreasing heart rate, increasing heart rate, and low stable heart rate are searched from the heart rate features, including:

[0138] S411 performs outlier removal and median filtering on heart rate data to generate minute-level heart rate sequences;

[0139] S412, In the master bedroom window, determine the supine heart rate threshold according to the preset supine heart rate quantiles, and constrain the supine heart rate threshold in combination with the full record heart rate quantiles;

[0140] S413, generate a low heart rate candidate sequence based on the supine heart rate threshold, and determine heart rate stability by rolling volatility. The time period with low heart rate and low heart rate volatility is used as a low stable heart rate candidate. The rolling volatility window is set to 8 minutes and the volatility threshold is set to 8 bpm.

[0141] S414, within the master bedroom window and its neighborhood, search for time periods when the heart rate changes from a relatively high value to a relatively low value as candidates for heart rate decrease, where the threshold for the decrease is set to 10 bpm;

[0142] S415, in the later part of sleep after the onset of sleep to near the end of the window in the master bedroom, the period when the heart rate changes from a relatively low value to a relatively high value is searched as a candidate for heart rate increase.

[0143] In practice, heart rate values ​​can be first filtered by median and outlier removal, and then aggregated into a minute-level heart rate sequence. For long-term recordings, the heart rate quantile can be adaptively selected according to the recording duration. For example, when the recording duration is long, a lower quantile can be used as a low heart rate reference for the entire record; when the recording duration is short, a higher quantile can be used to avoid the candidate being missing due to an excessively low threshold.

[0144] Within the master bedroom position window, the supine heart rate threshold is determined based on a preset supine heart rate quantile. The threshold is prevented from being too high by adding boundary constraints to the full recording heart rate quantiles, thus obtaining the heart rate characteristics. The supine heart rate quantile can be set to 0.65, and the full recording threshold boundary can be set to 5 bpm.

[0145] Low heart rate candidate sequences can be obtained by checking if the heart rate is below a certain threshold at the minute level. Simultaneously, the rolling heart rate variability can be calculated to determine stability. The rolling window can be preset as needed, such as to 8 minutes, and the variability threshold can be preset as needed, such as to 8 bpm. Time periods with low heart rate and low heart rate variability can be considered as low-stable heart rate candidates.

[0146] When searching for candidates with decreased heart rate, a pre-candidate window and a post-candidate window are constructed within the master bedroom window and its surrounding areas, centered on the candidate time. The median heart rate before and after the candidate is compared. If the post-candidate heart rate is significantly lower than the pre-candidate heart rate and enters the vicinity of the low percentile in the supine position, then the candidate is considered a candidate with decreased heart rate. The threshold for the magnitude of heart rate decrease can be preset as needed, such as 8 bpm. The pre-candidate window and the post-candidate window can also be preset as needed, such as 40 minutes. A protection interval can be set to prevent data from being mixed in near the candidate time.

[0147] For each candidate time point of sleep termination, this embodiment compares the median heart rate before and after the candidate window. If the increase in heart rate after the candidate window relative to the increase in heart rate before the candidate window reaches a preset threshold, and the heart rate after the candidate window enters the vicinity of the high heart rate percentile in the supine position, it is determined as a candidate for heart rate increase. The threshold for the increase can be set to 8 bpm, the high heart rate percentile can be set to 0.60, and the confirmation window can be set to 30 minutes.

[0148] like Figure 5 As shown, in this embodiment, respiratory-related frequency features are extracted from the feature sequence, and stable respiratory rate candidates are generated from the respiratory-related frequency features, including:

[0149] S421, Calculate the interval sequence between adjacent R peaks based on the R peak timestamp data, and remove adjacent R peak intervals that do not meet the physiological range;

[0150] S422, interpolate adjacent R-peak interphase sequences into equally spaced sequences;

[0151] S423, bandpass filtering is performed on the equally spaced sequence to obtain respiratory-related components;

[0152] S424 divides the respiratory-related components into multiple periods and determines the respiratory-related dominant frequency within each period, with the period length set to 30 seconds;

[0153] S425 searches for time series that consistently meet the frequency stability condition within the master bedroom window, and generates respiratory rate stability candidates based on the difference in dominant frequency before and after the stable period, the change amplitude of adjacent periods within the stable period, and the amplitude of stability improvement.

[0154] In practice, respiratory-related frequency features can be extracted using the respiratory sinus rhythm components in the intervals between adjacent R peaks. First, the intervals between adjacent R peaks are calculated based on the R peak timestamps, and abnormal intervals are removed. Then, the effective intervals between adjacent R peaks are interpolated into equally spaced sequences. The interpolation method can be cubic interpolation that preserves the shape.

[0155] After removing the median from the interpeak sequence of equally spaced adjacent R peaks, a bandpass filter was used to extract respiratory-related components. By dividing the filtered sequence into multiple periods, the respiratory-related dominant frequency and power were calculated using window functions and frequency domain analysis in each period, thereby obtaining the respiratory-related frequency characteristics.

[0156] Within the master bedroom window, search for segments where the respiratory dominant frequency enters a stable plateau. A stable segment requires that the dominant frequency for several consecutive periods be located near the target frequency. The half-width of the stable frequency band can be determined based on the frequency distribution within the master bedroom position.

[0157] For each candidate stable segment, indicators such as the decrease in dominant frequency before and after the candidate, the change in standard deviation before and after the stable segment, and the maximum change between adjacent periods within the stable segment are calculated to generate a quality score. Only when the quality score reaches a preset threshold is a stable candidate for respiratory-related frequency allowed to participate in sleep onset time fusion.

[0158] like Figure 6 As shown, in this embodiment, body motion features are extracted from the feature sequence, and body motion descent candidates and body motion recovery candidates are extracted from the body motion features, including:

[0159] S431 calculates dynamic acceleration components based on triaxial acceleration data and low-frequency gravity components;

[0160] S432 generates a body motion envelope based on dynamic acceleration components and aggregates the body motion envelope into a minute-level body motion sequence;

[0161] S433, search for candidates whose body movement envelope changes from a relatively high value to a relatively low value near the candidate for the start of basal sleep. The search range is set to 40 minutes before and 25 minutes after the candidate for the start of basal sleep. The candidate window before and after the candidate window are both set to 15 minutes. The protection interval is set to 3 minutes.

[0162] S434, search for candidates for motion recovery in the latter part of the master bedroom window.

[0163] In practice, acceleration is used not only for attitude recognition but also to describe the transition from wakefulness to a quiet sleep state. Dynamic amplitude, envelope amplitude, variance, differential energy, or other activity indices within a short window can be calculated from triaxial acceleration and aggregated into a minute-level body motion envelope. To reduce individual variability, the body motion envelope can be robustly standardized based on the distribution of each individual record.

[0164] Near the candidate for basal sleep onset, search for transition candidates with decreasing body movement envelope. The search range can include 45 minutes before and 25 minutes after the candidate for basal sleep onset. The candidate window before and after the candidate can be set to 15 minutes, with a 3-minute guard interval. If the decrease in body movement, decrease in envelope, and increase in stability before and after the candidate point meet preset conditions, and the offset between the candidate point and the candidate for basal sleep onset does not exceed the maximum allowable offset, such as 20 minutes, then the candidate point can be used to correct the sleep onset time.

[0165] By using the above-mentioned body movement correction, the deviation of the sleep onset boundary caused by a slow decrease in heart rate or a delay in the respiratory stabilization plateau can be reduced, while avoiding short-term turning over, changes in body position, or sensor disturbances being misjudged as sleep onset.

[0166] like Figure 7 As shown, in this embodiment, S5, based on the master bedroom window, fuses and determines sleep-related candidates of various sleep characteristics to determine the sleep onset time, including:

[0167] S511, when the candidate for heart rate decrease meets the strong decrease condition, the candidate for heart rate decrease is used as the candidate for the start of basic sleep, and the candidate for stable respiratory rate is restricted to be corrected only near the candidate for the start of basic sleep.

[0168] S512, when the heart rate decrease candidate does not meet the strong decrease condition, determine whether to use the respiratory rate stable candidate as the basic sleep initiation candidate based on the preset quality score of the respiratory rate stable candidate, the posterior heart rate confirmation result and the posterior body movement confirmation result.

[0169] S513, when the body movement descent candidate satisfies the time distance constraint and window validity constraint, the body movement descent candidate is used to correct the basic sleep initiation candidate;

[0170] S514, when none of the candidates meet the preset fusion conditions, backtrack to the starting point of the low steady heart rate candidate or the master bedroom position window, and determine the final candidate as the sleep start time.

[0171] In practice, the sleep onset time is not directly determined by a single signal, but rather selected by considering factors such as decreased heart rate, stable low heart rate, stable respiratory rate, and decreased body movement under posture gating at the master bedroom window.

[0172] Candidates for a decrease in heart rate can be generated first. If such a candidate exists and the decrease is significant, it should be prioritized, while candidates with stable respiratory rate are allowed to undergo minor adjustments nearby. The threshold for a significant decrease in heart rate can be set to 8 bpm, and the maximum allowable distance between respiratory-related candidates and candidates with a significant decrease in heart rate can be set to 30 minutes.

[0173] To prevent stable respiratory rate candidates from prematurely overriding reliable heart rate decline candidates, this embodiment also sets up a gating rule: a hierarchical constraint mechanism that determines whether a stable respiratory rate candidate can independently determine the sleep onset time based on the strength of the evidence for heart rate decline. When a heart rate decline candidate has sufficiently strong evidence, respiratory-related candidates can only be corrected near the heart rate candidate; when the heart rate evidence is weak or missing, i.e., the strong decline condition is not met, respiratory-related candidates must simultaneously meet the requirements of their own mass, posterior heart rate confirmation, and posterior body movement confirmation before they can be used as primary sleep onset time candidates.

[0174] Specifically, strong enough evidence is when the difference between the median heart rate before and after the candidate heart rate drop exceeds the strong drop threshold.

[0175] When this condition is met and there is sufficiently strong evidence, the candidate for stable respiratory rate can only be modified within a small range around the candidate for decreased heart rate and cannot be independently covered.

[0176] If not, a candidate for stable respiratory rate must pass three validations simultaneously:

[0177] ① Its own quality score is not lower than the preset quality threshold, which can be set to 2.0;

[0178] ② Post-test heart rate confirmation: The heart rate continues to enter the low value area several minutes after the candidate is selected;

[0179] ③ Posterior body movement confirmation: Body movement remains at a low level for several minutes after the candidate is identified;

[0180] Only when all three conditions are met will a candidate for stable respiratory rate be considered as a candidate for sleep onset time.

[0181] When multiple candidates exist, they can be ranked according to their quality score, distance from the starting point of the master bedroom position, subsequent stability, and consistency with other evidence. If no candidate meets the requirements, the candidate is backed up to the low steady heart rate candidate, the original signal sleep score window, or the starting point of the master bedroom position window according to the back-up priority. The final sleep onset time can also be clamped by the master bedroom position window, for example, it cannot be earlier than 30 minutes before the starting point of the master bedroom position window, to avoid identifying the pre-sleep resting state as a sleep state.

[0182] During the fusion determination phase, the low stable heart rate candidate takes on the role of the low stable heart rate fallback candidate: when neither the heart rate decrease candidate nor the respiratory rate stable candidate meets the fusion conditions, the low stable heart rate fallback logic can be enabled, and the system uses the start time of the low stable heart rate candidate or the master bedroom position window as the alternative sleep start time.

[0183] When there are no candidates for heart rate drop or their quality is insufficient, in order to distinguish between the true onset of sleep and the postural heart rate drop immediately after entering a lying position, the low-steady heart rate backoff logic is set with the following three constraints:

[0184] ① Trigger Delay: The rollback search will wait for a preset time after the start of the master bedroom window before starting, to avoid misjudging the initial decrease in postural heart rate in the lying position as sleep. The waiting time can be set to 20 minutes.

[0185] ② Duration confirmation: The low stable heart rate segment found must continuously reach the preset confirmation duration to exclude short-term stable periods. The confirmation duration can be set to 10 minutes.

[0186] ③ Baseline drop amplitude: This segment must have a sufficient drop amplitude relative to the baseline before or in the early stages of lying down to distinguish it from the resting and awake state.

[0187] The start time of a low-steady heart rate segment that satisfies the above three constraints is used as a candidate for low-steady heart rate regression and participates in the determination of the final sleep onset time.

[0188] like Figure 8 As shown, in this embodiment, S5 involves fusing and determining sleep-related candidates for various sleep characteristics based on the master bedroom window to determine the sleep end time, including the following steps:

[0189] S521, using the end point of the master bedroom window as the boundary constraint for the candidate sleep end time;

[0190] S522, combining the high heart rate confirmation ratio of candidates with increased heart rate, the magnitude of heart rate increase, the distance between the candidate time and the end point of the master bedroom window, and candidates with physical recovery or postural change, select candidates for sleep end time.

[0191] S523, when there are no candidates for rising heart rate or the quality is insufficient, backtracking is performed based on the last low and stable heart rate candidate in the supine position, the original sleep score window, or the end point of the master bedroom window.

[0192] S524 performs a validity check on the sleep period consisting of the sleep start time and the sleep end time, and reverts to the master bedroom window if the duration constraint is not met.

[0193] In practice, the endpoint of the master bedroom window is used as the boundary constraint for the candidate sleep end time to avoid short-term changes in heart rate or body movement that cause the sleep end time to deviate significantly from the master bedroom position.

[0194] Once the sleep onset time has been determined, candidates for increased heart rate can be searched during the later stages of sleep. The search start point can be set to the later of 180 minutes after the sleep onset time and 120 minutes after the start of the master bedroom window, and the search end point can be extended to the vicinity of the end of the master bedroom window to capture heart rate changes near the end of sleep.

[0195] For each candidate time point of sleep termination, compare the median heart rate before and after the candidate window.

[0196] When a candidate for an increased heart rate exists, the sleep end time can be selected based on the magnitude of the increase, the confirmation rate, the distance between the candidate and the endpoint in the master bedroom position, and the degree of fluctuation after the candidate. When no candidate for an increased heart rate exists, the endpoint of the last low-steady heart rate segment in the supine position, the endpoint of the original sleep score window, or the endpoint of the master bedroom window can be used as the regression result. Finally, if the sleep period consisting of the sleep start time and the sleep end time does not meet the minimum or maximum duration constraints, the regression is to the master bedroom window.

[0197] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0198] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A method for detecting sleep periods based on multi-source electrocardiogram feature fusion, characterized in that, include: Acquire triaxial acceleration data and ECG data from the ECG acquisition device, and obtain the corresponding sampling rate, start time, and timestamp information; A unified time reference is established based on the sampling rate, start time and timestamp information, and the sampling level data under different sampling rates are converted into feature sequences expressed in physical time. A candidate sequence for supine positions is generated based on the triaxial acceleration data, and the master bedroom window is determined based on the candidate sequence for supine positions. Within the master bedroom window and its neighborhood, multiple electrocardiogram sleep features are extracted from the feature sequence, and sleep-related candidates are determined from the electrocardiogram sleep features; Based on the master bedroom window, multiple sleep-related candidates with different sleep characteristics are fused and judged to determine the sleep start time and sleep end time. Output sleep period information consisting of the sleep start time and the sleep end time, as well as the corresponding sleep duration and intermediate determination information.

2. The sleep period detection method based on multi-source electrocardiogram feature fusion according to claim 1, characterized in that, The electrocardiogram data includes one or more of the following: electrocardiogram waveform data, R-peak timestamp data, or heart rate data; When the ECG data does not include R-peak timestamp data and heart rate data, the ECG waveform data is input into a trained R-peak recognition algorithm to identify the R-peak and generate an R-peak timestamp, and the heart rate data is obtained from the R-peak timestamp.

3. The sleep period detection method based on multi-source electrocardiogram feature fusion according to claim 1, characterized in that, A unified time reference is established based on the sampling rate, start time, and timestamp information, including: The filter window, aggregation window, confirmation window, and search window are all defined as physical time lengths, and converted into the corresponding number of sampling points or the corresponding time index according to the actual sampling rate provided by the current chest patch physiological parameter acquisition device. Based on the start time and timestamp information, establish absolute time indexes for triaxial acceleration data and electrocardiogram data respectively; The time indexes of different signals are aligned, and compatibility processing is performed through interpolation, padding, removal, or missing markers when there are data gaps, inconsistent sampling rates, or invalid data markers.

4. The sleep period detection method based on multi-source electrocardiogram feature fusion according to claim 1, characterized in that, A candidate sequence for supine positions is generated based on triaxial acceleration data. The master ward window is then determined based on this candidate sequence, including: The triaxial acceleration data is low-pass filtered to separate the low-frequency gravity component; The low-frequency gravity component is normalized into a gravity direction vector, and one or more upright direction candidates are generated based on segments with large activity amplitude, daytime stable segments, fully recorded stable segments, nighttime stable segments, daytime active segments, or principal component directions. The tilt angle sequence corresponding to each candidate upright direction is calculated, and the candidate upright direction is scored according to the proportion of daytime lying position, the proportion of nighttime lying position, the proportion of lying position in the entire record, and the longest continuous lying position duration at night. Candidate upright directions that meet preset scoring conditions are selected as target upright directions, and minute-level tilt angle sequences are generated based on the target upright directions; When the tilt angle in the minute-level tilt angle sequence is greater than the tilt angle threshold, the corresponding time is marked as a supine position; Fill the short non-recumbent gaps between adjacent supine segments; Eliminate lying position segments whose duration is shorter than the preset duration; In the remaining supine position segments, the master bedroom position window is selected according to the duration constraint and time prior.

5. The sleep period detection method based on multi-source electrocardiogram feature fusion according to claim 4, characterized in that, Multiple electrocardiographic sleep characteristics include heart rate characteristics, respiratory-related frequency characteristics, body movement characteristics, and postural characteristics. Sleep-related candidates for heart rate characteristics include candidates for decreased heart rate, candidates for increased heart rate, and candidates for low steady heart rate. Sleep-related candidates for respiratory-related frequency features are respiratory rate stability candidates. Sleep-related candidates for body movement characteristics include candidates for decreased body movement and candidates for recovery of body movement. The sleep-related candidates of posture features are posture change candidates. The end point of the master bedroom window, or the time boundary of the candidate sequence of the lying position changing from the lying position state to the non-lying position state and continuously satisfying the non-lying position condition, is determined as a posture change candidate. The posture change candidate is used to constrain the sleep end time.

6. The sleep period detection method based on multi-source electrocardiogram feature fusion according to claim 5, characterized in that, Heart rate features are extracted from the feature sequence, and candidates for decreasing heart rate, increasing heart rate, and low steady heart rate are identified from these features. Outlier removal and median filtering are performed on the heart rate data to generate a minute-level heart rate sequence; Within the master bedroom window, the supine heart rate threshold is determined based on the preset supine heart rate quantiles, and the supine heart rate threshold is constrained by combining the full record heart rate quantiles. Based on the supine heart rate threshold, a low heart rate candidate sequence is generated, and the heart rate stability is determined by the rolling volatility. The time period with low heart rate and low heart rate volatility is used as a low stable heart rate candidate. Within the master bedroom window and its neighborhood, search for time periods when the heart rate changes from a relatively high value to a relatively low value as candidates for a decrease in heart rate. In the latter part of sleep after the onset of sleep, up to near the end of the window in the master bedroom, the period when the heart rate changes from a relatively low value to a relatively high value is searched as a candidate for heart rate increase.

7. The sleep period detection method based on multi-source electrocardiogram feature fusion according to claim 5, characterized in that, Extracting respiratory-related frequency features from the feature sequence and generating stable respiratory rate candidates from the respiratory-related frequency features includes: Calculate the interval sequence between adjacent R peaks based on the R peak timestamp data, and remove adjacent R peak intervals that do not meet the physiological range; Interpolate the adjacent R-peak interval sequences into equally spaced sequences; Bandpass filtering is performed on the equally spaced sequences to obtain respiratory-related components; The respiratory-related components are divided into multiple periods, and the dominant respiratory frequency is determined in each period. Search for a time sequence that consistently meets the frequency stability condition within the master bedroom window, and generate respiratory rate stability candidates based on the difference in dominant frequency before and after the stable period, the change amplitude of adjacent periods within the stable period, and the stability improvement amplitude.

8. The sleep period detection method based on multi-source electrocardiogram feature fusion according to claim 5, characterized in that, Body motion features are extracted from the feature sequence, and body motion descent candidates and body motion recovery candidates are extracted from the body motion features, including: Calculate the dynamic acceleration component based on the triaxial acceleration data and the low-frequency gravity component; A body motion envelope is generated based on the dynamic acceleration components, and the body motion envelope is aggregated into a minute-level body motion sequence. Search for candidates for a decrease in body movement near the candidate candidate for basal sleep initiation, where the body movement envelope changes from a relatively high value to a relatively low value. Search for candidates for motion recovery in the latter part of the master bedroom window.

9. The sleep period detection method based on multi-source electrocardiogram feature fusion according to any one of claims 5-8, characterized in that, Determining sleep onset time includes: When the heart rate decrease candidate meets the strong decrease condition, and the difference between the median heart rate before and after the heart rate decrease candidate exceeds the strong decrease threshold, the heart rate decrease candidate is used as the basic sleep initiation candidate, and the respiratory rate stabilization candidate is restricted to be corrected only near the basic sleep initiation candidate. When the heart rate decrease candidate does not meet the strong decrease condition, it is determined whether to use the respiratory rate stable candidate as the basic sleep initiation candidate based on the quality score of the respiratory rate stable candidate, the posterior heart rate confirmation result and the posterior body movement confirmation result. When the body movement descent candidate satisfies the time distance constraint and the window validity constraint, the basic sleep initiation candidate is corrected using the body movement descent candidate; When none of the candidates meet the preset fusion conditions, the process reverts to the starting point of the low steady heart rate candidate or the master bedroom position window, and the final candidate is determined as the sleep start time.

10. The sleep period detection method based on multi-source electrocardiogram feature fusion according to any one of claims 5-8, characterized in that, Determining the end time of sleep includes: The endpoint of the master bedroom window is used as the boundary constraint for the candidate sleep end time. By combining the high heart rate confirmation ratio of candidates with increased heart rate, the magnitude of heart rate increase, the distance between the candidate time and the end point of the master bedroom window, and candidates with physical recovery or postural change, candidates for sleep end time are selected. When the heart rate rise candidate is absent or of insufficient quality, backtracking is performed based on the last low and stable heart rate candidate in the supine position, the original sleep score window, or the end point of the master bedroom window. Backtracking is performed based on the last low steady heart rate candidate in the supine position, the original sleep score window, or the endpoint of the master bedroom window. The validity of the sleep period consisting of the sleep start time and the sleep end time is verified, and if the duration constraint is not met, the user is redirected to the master bedroom window.