An end-to-end sleep monitoring and event detection method based on wrist accelerometer
By combining the rhythm prior integrator and time-varying interaction model in the Morpheus end-to-end framework with a context-aware soft tagging strategy, the problems of high noise and sparse tags in wrist accelerometer sleep monitoring are solved, achieving high-precision sleep event detection and staging.
Patent Information
- Application Number
- CN202511642176.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-11
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-11-11
AI Technical Summary
Existing sleep monitoring methods based on wrist accelerometers suffer from problems such as high noise, lack of physiological context, and sparse sleep event annotations leading to model overfitting and difficulty in accurately detecting rare events.
We adopt the Morpheus end-to-end framework, introduce the rhythm prior integrator (RPI) to inject personalized sleep patterns, use the time-varying interaction model (TVIM) to jointly model the relationship between time series and variables, and use the context-aware soft label (CASL) strategy to alleviate the label sparsity problem. We also supervise the generation of soft labels through multi-scale Gaussian smoothing.
It significantly improves the recall and temporal localization accuracy of sleep event detection, enhances the model's ability to extract robust features from noisy data, and alleviates the class imbalance problem.
Smart Images

Figure CN121080930B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and more specifically to an end-to-end sleep monitoring and event detection method based on a wrist accelerometer. Background Technology
[0002] Currently, the mainstream methods for sleep monitoring based on wearable devices can be divided into two categories. One category relies on traditional machine learning models (such as random forests and SVMs), which depend on manually designed features (such as time-domain and frequency-domain statistics), require a large amount of domain knowledge, have poor feature generalization ability, and are difficult to capture the complex temporal and variable dependencies in the original acceleration signal; the other category directly transfers end-to-end deep learning models (such as CNNs, Transformers, and U-Nets) from other fields (such as sleep staging based on PSG).
[0003] However, these methods have inherent limitations when dealing with wrist accelerometer data: First, unlike PSG, which contains rich physiological signals such as EEG and EEG, accelerometer data is noisier and lacks direct physiological context, making it difficult for the model to learn reliable sleep representations; Second, the annotation of sleep events (such as waking up) is extremely sparse (positive samples account for <0.01%), resulting in severe class imbalance, making the model training prone to overfitting and difficult to accurately detect rare events. Summary of the Invention
[0004] Purpose of the invention: The purpose of this invention is to provide an end-to-end sleep monitoring and event detection method based on a wrist accelerometer. It proposes the Morpheus end-to-end framework, introduces a rhythm prior integrator (RPI) to inject personalized sleep patterns, uses a time-varying interaction model (TVIM) to jointly model the relationship between time series and variables, and adopts a context-aware soft label (CASL) strategy to alleviate the label sparsity problem, thus solving the problems existing in the background technology.
[0005] Technical solution: The present invention provides an end-to-end sleep monitoring and event detection method based on a wrist accelerometer, comprising the following steps:
[0006] (1) Raw motion data are collected by wrist accelerometer and basic feature vectors are extracted. The basic feature vectors include motion intensity features, wrist tilt features and periodic timestamp features.
[0007] (2) Based on the basic feature vector, generate prior features of sleep rhythm using user historical activity data, and concatenate the prior features with the basic feature vector to form an enhanced feature vector;
[0008] (3) Convert the enhanced feature vector into a two-dimensional feature map, and use the time-variable interaction model to jointly model the time dynamics and multivariate interaction relationship, and output the sleep state probability at each time point;
[0009] (4) Perform multi-scale Gaussian smoothing on the original binary event labels to generate soft labels, and use the soft labels as supervision signals to train the time-variable interaction model;
[0010] (5) Based on the trained model, the new accelerometer data is forward propagated to output a probability sequence, and sleep events are detected and sleep stages are performed through post-processing operations.
[0011] Furthermore, in step (1), the motion intensity feature is obtained by subtracting one from the Euclidean norm of the acceleration vector; the wrist tilt angle feature is obtained by calculating the tilt angle of the wrist relative to the direction of gravity; and the periodic timestamp feature is obtained by converting the hour information of a day into sine and cosine periodic codes.
[0012] Furthermore, in step (2), the a priori features of sleep rhythm include cross-day rhythm features and cross-week rhythm features.
[0013] Furthermore, the cross-day rhythm characteristics are obtained by comparing the motion intensity characteristics and wrist tilt characteristics of the current moment with those of the same moment over several past days, and then weighting and aggregating them according to the time distance.
[0014] Furthermore, the cross-week rhythm characteristics are obtained by comparing the movement intensity characteristics and wrist tilt characteristics of the current moment with those of the same moment in previous weeks, and by statistically analyzing the consistency ratio.
[0015] Furthermore, in step (3), the two-dimensional feature map is obtained by reshaping the one-dimensional time series into a two-dimensional structure with channel dimension and time dimension.
[0016] Furthermore, in step (3), the time-variable interaction model adopts an encoder-decoder structure, in which the encoder uses a convolutional neural network for multi-scale feature extraction, and the decoder adopts a MetaGRU structure, alternating between GRU TokenMixer and Channel Mixer.
[0017] Furthermore, in step (4), multi-scale Gaussian smoothing uses Gaussian kernels with different window lengths and standard deviations to generate soft labels at multiple scales.
[0018] Furthermore, sleep event detection includes peak finding in the probability sequence, and the point where the local maximum value exceeds a predetermined threshold is the predicted "falling asleep" or "waking up" event point.
[0019] Furthermore, sleep staging involves applying a sliding window average or threshold judgment to the probability sequence, converting it into a binary sleep / wake state sequence.
[0020] Beneficial Effects: Compared with existing technologies, this invention has the following significant advantages: First, it innovatively introduces a Rhythm Prior Integrator (RPI), which, by mining users' personalized historical activity patterns across days and weeks, supplements the model with powerful behavioral prior knowledge, effectively compensating for the lack of physiological context in accelerometer data. Second, it designs a Time-Varying Interaction Model (TVIM), which explicitly captures the interaction between temporal dynamics and multiple variables (such as ENMO and anglez) by reshaping one-dimensional time series into two-dimensional feature maps and performing joint modeling, enhancing the model's ability to extract robust features from noisy data. Third, it proposes a Context-Aware Soft Labeling (CASL) strategy, which transforms sparse binary labels into a probability distribution rich in contextual information through multi-scale Gaussian smoothing, greatly alleviating class imbalance, guiding the model to learn the gradual process of events, and significantly improving the recall rate and temporal localization accuracy of event detection. Attached Figure Description
[0021] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0022] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0023] like Figure 1 As shown, this embodiment of the invention provides an end-to-end sleep monitoring and event detection method based on a wrist accelerometer, comprising the following steps:
[0024] (1) Raw motion data was collected using a wrist accelerometer, and basic feature vectors were extracted. The basic feature vectors included motion intensity features, wrist tilt angle features, and periodic timestamp features. Specifically, raw motion data was collected using a triaxial accelerometer worn on the wrist, and two types of key features were extracted:
[0025] ENMO (Euclidean Norm Minus One): Used to quantify exercise intensity, calculating the intensity of exercise at each time point tt. This operation removes the gravitational baseline, highlighting the acceleration generated by physical activity. The calculation formula is:
[0026]
[0027] `anglez`: Used to quantify the wrist tilt angle relative to the direction of gravity, calculating the wrist tilt angle. This feature is key to inferring sleep posture (e.g., lying flat, lying on one's side), and the calculation formula is:
[0028]
[0029] The present invention also extracts timestamp features and transforms the hour information of a day into periodic features through sine and cosine coding. It extracts the "hour" information in the UTC timestamp of each data point and transforms it into periodic features to capture the circadian rhythm.
[0030]
[0031]
[0032] This operation transforms linearly elapsed time into cyclical features that the model can understand, incorporating prior knowledge of circadian rhythms.
[0033] Output basic feature vector
[0034] (2) Based on the basic feature vector, prior sleep rhythm features are generated using user historical activity data, and the prior features are concatenated with the basic feature vector to form an enhanced feature vector; specifically as follows: Input ENMO(t) and anglez(t) sequences, and generate prior sleep rhythm features including cross-day rhythm features and cross-week rhythm features using user historical activity data. Among them,
[0035] Cross-day rhythm feature: Calculate the ENMO and anglez differences between the current time and the same time in the past 14 days. If the difference is less than a threshold, it is counted and aggregated weighted by time distance. For the current time point t, its ENMO value is compared with its value over the past d days. Compare values at the same time. If the absolute difference is less than the threshold... If a match is found, it is considered a single match. The matching result is calculated using the formula... The data is weighted (higher weight for recent transactions, lower weight for longer-term transactions), and then normalized to obtain Cross_day_enmo(t). The same operation is performed on anglez to obtain Cross_day_anglez(t).
[0036] Cross-week rhythm: Calculates the ENMO and anglez differences between the current moment and the same moment in the past 3 weeks, and calculates the consistency ratio. Similar to cross-day rhythm, but compares the past k weeks. The values at the same time point are calculated. After calculating the number of matches, the average is taken directly to obtain Cross_week_enmo(t) and Cross_week_anglez(t).
[0037] By incorporating these features and combining them with the user's historical sleep behavior, the model can improve its ability to determine the current sleep state. This provides the model with individual-specific long-term sleep rhythm priors, improving the accuracy of identifying wakefulness / sleep onset times. The generated features...
[0038]
[0039] The enhanced feature vector Xenhanced(t) is concatenated with the base feature vector Xbase(t) to form the enhanced feature vector Xenhanced(t). Thus, the data has been transformed from a low-level raw signal into a high-level, personalized behavioral semantic.
[0040] (3) Convert the enhanced feature vector into a two-dimensional feature map, and use the time-variable interaction model to jointly model the time dynamics and multivariate interaction relationship, and output the sleep state probability at each time point; specifically as follows: convert the one-dimensional time series into a two-dimensional feature map, and model along the time axis and variable axis respectively, while modeling the dependency relationship between the time dimension and multivariates (such as ENMO, anglez), that is, construct the time-variable interaction model; wherein, the time-variable interaction model is as follows:
[0041] Map Maker: Converts multi-channel acceleration data S ( (Where C is the total dimension of the concatenated features and L is the sequence length) is reshaped into a two-dimensional feature map (channel × time). This preserves the original structure and relationships. The variable channel dimension is mapped to "height," and the time dimension is mapped to "width." This reconstruction allows subsequent two-dimensional convolutional kernels to operate simultaneously on adjacent time points and adjacent variables, thereby explicitly capturing the interaction relationships between variables, which is impossible with traditional one-dimensional models.
[0042] The encoder uses a U-Net architecture for feature extraction, preserving spatial dimensions while compressing the number of feature maps. The encoding path consists of four downsampling blocks, each containing: two 3x3 convolutions + BatchNorm + ReLU; and a 2x2 MaxPooling (stride 2) to progressively extract multi-scale spatiotemporal features. Skip connections pass the high-resolution feature maps from the downsampling process to the decoder, ensuring the subsequent recovery of fine-grained temporal localization information.
[0043] The decoder employs a MetaGRU structure, alternating between GRU Token Mixer and Channel Mixer, specifically composed of N (e.g., 4) stacked MetaGRU Blocks. Each Block contains: a GRU Token Mixer: a bidirectional GRU layer used to capture strong forward and backward long-range temporal dependencies in the sequence; a Channel Mixer: an Inverted Bottleneck MLP with a structure of Linear -> ReLU -> Linear, first expanding the dimension (e.g., by a factor of 4) and then compressing it back to the original dimension to enhance information interaction between feature channels; and residual connections: the output of each Mixer is added to the input to ensure gradient flow and training stability. It fuses temporal dependencies and variable interactions, outputting probability predictions for each time point. Compared to traditional 1D models, it better preserves fine-grained features, improving the accuracy and robustness of staging and event detection.
[0044] (4) Perform multi-scale Gaussian smoothing on the original binary event labels to generate soft labels, and use the soft labels as supervision signals to train the time-variable interaction model; specifically as follows: In order to solve the problems of sparsity (positive sample ratio <0.01%) and uncertainty of boundaries of sleep event labels, perform multi-scale Gaussian smoothing on the original binary labels: input the original, sparse binary event labels y(t) (1 represents an event, 0 represents a non-event).
[0045] Soft label generation: The hard labels are smoothed using a Gaussian kernel function. The soft label y(t) is generated by the formula...
[0046]
[0047] The calculation yielded, where .
[0048] Multi-scale strategy: Four sets of Gaussian kernels with different parameters are used to generate four scales of soft labels. Short-range kernels focus on the precise location of event boundaries, while long-range kernels help identify ambiguous or slowly occurring events. The model integrates these scales through multi-task learning or weighted averaging.
[0049] Scale 1 (short-range): L=5, σ=2;
[0050] Scale 2 (short to medium range): L=10, σ=4;
[0051] Scale 3 (medium to long range): L=15, σ=6;
[0052] Scale 4 (long range): L=20, σ=8;
[0053] Training: Using the soft label y(t) as the supervision signal and the time-varying interaction model output P(t) as the prediction, the binary cross-entropy loss (BCE Loss) is calculated. The AdamW optimizer is used, combined with Cosine learning rate decay and a 10% warmup strategy, to perform end-to-end joint training of the entire Morpheus framework (including RPI and TVIM).
[0054] (5) Based on the trained model, the new accelerometer data is forward propagated to output a probability sequence, and sleep events are detected and sleep stages are performed through post-processing operations. Among them, sleep event detection includes peak finding of the probability sequence, and the point where the local maximum value exceeds the predetermined threshold is the predicted "falling asleep" or "waking up" event point. Sleep stage includes applying sliding window averaging or threshold judgment to the probability sequence and converting it into a binary sleep / wake state sequence.
[0055] The results of this invention can be integrated into mobile applications or cloud-based health platforms to provide users with visualized sleep reports and quality assessments.
Claims
1. An end-to-end sleep monitoring and event detection method based on a wrist accelerometer, characterized in that, Includes the following steps: (1) Raw motion data are collected by wrist accelerometer and basic feature vectors are extracted. The basic feature vectors include motion intensity features, wrist tilt features and periodic timestamp features. (2) Based on the basic feature vector, generate prior features of sleep rhythm using user historical activity data, and concatenate the prior features with the basic feature vector to form an enhanced feature vector; among which, the prior features of sleep rhythm include cross-day rhythm features and cross-week rhythm features; (3) The enhanced feature vector is converted into a two-dimensional feature map, and the time-variable interaction model is used to jointly model the time dynamics and multivariate interaction relationship, and output the sleep state probability at each time point; wherein, the time-variable interaction model adopts an encoder-decoder structure, wherein the encoder uses a convolutional neural network to extract features at multiple scales, and the decoder adopts a MetaGRU structure, alternating between GRU Token Mixer and Channel Mixer. (4) Perform multi-scale Gaussian smoothing on the original binary event labels to generate soft labels, and use the soft labels as supervision signals to train the time-variable interaction model; (5) Based on the trained model, the new accelerometer data is forward propagated to output a probability sequence, and sleep events are detected and sleep stages are performed through post-processing operations.
2. The end-to-end sleep monitoring and event detection method based on a wrist accelerometer according to claim 1, characterized in that, In step (1), the motion intensity feature is obtained by subtracting one from the Euclidean norm of the acceleration vector; the wrist tilt angle feature is obtained by calculating the tilt angle of the wrist relative to the direction of gravity; and the periodic timestamp feature is obtained by converting the hour information of a day into sine and cosine periodic codes.
3. The end-to-end sleep monitoring and event detection method based on a wrist accelerometer according to claim 1, characterized in that, The cross-day rhythm characteristics are obtained by comparing the motion intensity characteristics and wrist tilt characteristics of the current moment with those of the same moment over several past days, and then weighting and aggregating them according to the time distance.
4. The end-to-end sleep monitoring and event detection method based on a wrist accelerometer according to claim 1, characterized in that, Cross-week rhythm characteristics are obtained by comparing the movement intensity characteristics and wrist tilt characteristics of the current moment with the same moment in the past several weeks, and by statistically analyzing the consistency ratio.
5. The end-to-end sleep monitoring and event detection method based on a wrist accelerometer according to claim 1, characterized in that, In step (3), the two-dimensional feature map is obtained by reshaping the one-dimensional time series into a two-dimensional structure with channel dimension and time dimension.
6. The end-to-end sleep monitoring and event detection method based on a wrist accelerometer according to claim 1, characterized in that, In step (4), multi-scale Gaussian smoothing uses Gaussian kernels with different window lengths and standard deviations to generate soft labels at multiple scales.
7. The end-to-end sleep monitoring and event detection method based on a wrist accelerometer according to claim 1, characterized in that, Sleep event detection involves finding peaks in a probability sequence and identifying points where the local maximum value exceeds a predetermined threshold as predicted "falling asleep" or "waking up" events.
8. The end-to-end sleep monitoring and event detection method based on a wrist accelerometer according to claim 1, characterized in that, Sleep staging involves applying a sliding window average or threshold to the probability sequence, converting it into a binary sleep / wake state sequence.
Citation Information
Patent Citations
Sequence-to-sequence sleep disorder detection method based on full convolutional network
CN111493828A
Sleep report generation method and device, terminal and storage medium
CN113520340A