Multimodal sleep staging method, system, and computer program product

CN122701352APending Publication Date: 2026-09-08SHANGHAI KONGSHANCI TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610889273.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-18
Publication Date
2026-09-08

AI Technical Summary

Technical Problem

而上述基于静态单窗口特征加一次性分类的架构,将各个时间窗视为独立无关的单元进行处理,割裂了睡眠过程的上下文联系,难以准确刻画阶段边界处的渐进过渡,常常导致模型判定在短时间内产生不符合生理规律的剧烈跳变

Benefits of technology

[0045] A ping-pong mechanism using double buffering and direct memory access achieves a high degree of parallelism in data acquisition and processing. The acquisition side continuously and uninterruptedly writes new data into a buffer, while the processing side simultaneously performs complete windowing and feature extraction on another buffer that has already been written to. This physically eliminates data waiting and bus contention, ensuring zero-loss acquisition and low-latency processing of continuous physiological signals on the microcontroller platform, providing a highly reliable time-series data foundation for subsequent real-time staging.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122701352A_ABST
    Figure CN122701352A_ABST
Patent Text Reader

Abstract

The patent relates to a multi-modal sleep staging method, system and computer program product. The method comprises: collecting multi-modal physiological signals including at least electroencephalogram signals; dividing the multi-modal physiological signals into a plurality of short-time sub-windows with overlap in time, and organizing a plurality of continuous short-time sub-windows into a long-time staging unit; for each short-time sub-window, determining a modal feature combination for the short-time sub-window based on a value of a continuously normalized signal quality function, and extracting features corresponding to the modal feature combination from the multi-modal physiological signals; arranging the features of each short-time sub-window extracted in the same long-time staging unit into a feature sequence in time sequence, inputting the feature sequence into a time sequence model, and obtaining a sleep staging result corresponding to the long-time staging unit. The patent avoids the misjudgment of stage boundary caused by traditional static feature modeling, and significantly improves the accuracy and continuity of staging.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This patent relates to the field of physiological signal processing and pattern recognition technology, specifically to a multimodal sleep staging method, system, and computer program product that can run on resource-constrained platforms. Background Technology

[0002] Sleep staging is a core technology for assessing sleep quality and diagnosing sleep disorders. In the consumer electronics and mobile health fields, the demand for sleep monitoring is increasingly trending towards portability and real-time performance. There is a desire to be able to independently complete the entire process from signal acquisition to staging output on resource-constrained microcontroller platforms such as wearable devices or bedside terminals, without relying on the computing support of external smart devices or cloud platforms.

[0003] In existing technologies, there exists a class of sleep staging schemes based on the fusion of multimodal physiological signals. These schemes typically acquire EEG signals, heart rate signals, and acceleration signals simultaneously to compensate for the limitations of single-modal information. A typical workflow is as follows: First, the continuously acquired signals are segmented into fixed-length time windows; then, handcrafted features of each modality are extracted from each time window, such as the frequency band energy of the EEG signal, heart rate variability indices, and exercise intensity; subsequently, based on preset fixed weights, these heterogeneous features are concatenated or weighted summed to form a static feature vector; finally, this feature vector is input into a one-time classifier to directly obtain the sleep stage label corresponding to that time window.

[0004] However, in practical applications, the aforementioned existing technical solutions face a dual challenge. First, they lack robustness to signal quality fluctuations. The physiological signals collected by wearable devices are highly dynamic, and the signal quality of EEG electrodes may drop sharply due to poor contact, electromyography interference, or environmental noise. In this case, feature fusion methods based on fixed weights or simple splicing are easily dominated by poor-quality signals, leading to drastic fluctuations in overall staging performance. Second, they have inherent limitations in capturing the continuous evolution of sleep stages. Sleep is a continuous physiological process of gradual change, and the transitions between stages have an inherent temporal dependency. The aforementioned architecture based on static single-window features and one-time classification treats each time window as an independent and unrelated unit, severing the contextual connections of the sleep process. It is difficult to accurately characterize the gradual transitions at stage boundaries, often resulting in drastic jumps in model judgments within a short period of time that do not conform to physiological laws.

[0005] In summary, how to construct a staging scheme on a resource-constrained platform that can maintain high robustness under dynamic changes in signal quality and effectively capture and utilize the continuous evolution information of the sleep process is an urgent problem to be solved in this field. Summary of the Invention

[0006] To solve, or at least partially solve, the technical problems existing in the above-mentioned background art, the present invention provides a multimodal sleep staging method, comprising: Collect multimodal physiological signals, including at least electroencephalogram (EEG) signals; The multimodal physiological signal is divided into multiple short-term sub-windows that overlap in time, and multiple consecutive short-term sub-windows are organized into a long-term phase unit. For each short-term sub-window, based on the value of a continuously normalized signal quality function, a modal feature combination for that short-term sub-window is determined, and features corresponding to the modal feature combination are extracted from the multimodal physiological signal. The features extracted from each short-term sub-window within the same long-term stage unit are arranged in chronological order to form a feature sequence, which is then input into a time series model to obtain the sleep stage results corresponding to the long-term stage unit.

[0007] By constructing a continuously normalized signal quality function and using its value as a driving variable, the modal feature combination to be used in each short-term sub-window is dynamically determined, enabling the feature extraction process to adaptively and continuously adjust to fluctuations in signal quality. When the signal quality of a certain modality deteriorates, its contribution is smoothly suppressed, while the contributions of other high-quality modalities are correspondingly enhanced, thus maintaining the stability of the staging system under varying signal environments. Simultaneously, by employing overlapping short-term sub-windows and organizing them into a long-term staging unit, a cross-timescale coupling structure is constructed. This structure inputs the features of a series of short-term sub-windows into the time-series model in chronological order, allowing the model to fully capture the continuous evolution and contextual dependencies of the sleep stage. This avoids the stage boundary misjudgment caused by traditional static feature modeling, significantly improving the accuracy and coherence of staging.

[0008] To address, or at least partially address, the technical problems existing in the aforementioned background art, the present invention also provides a multimodal sleep staging system, comprising: The acquisition module is used to acquire multimodal physiological signals, including at least electroencephalogram (EEG) signals. The segmentation module is used to divide the multimodal physiological signal into multiple short-term sub-windows that overlap in time, and to organize multiple consecutive short-term sub-windows into a long-term segmentation unit. The feature determination module is used to determine the modal feature combination for each short-term sub-window based on the value of a continuously normalized signal quality function, and to extract the features corresponding to the modal feature combination from the multimodal physiological signal. The staging module is used to construct a feature sequence from the features of each short-term sub-window extracted within the same long-term staging unit in chronological order, input it into the time series model, and obtain the sleep staging result corresponding to the long-term staging unit.

[0009] Through the collaborative work of the above modules, this system achieves signal quality-driven adaptive feature extraction and multi-scale temporal modeling on a resource-constrained platform, and has the same beneficial technical effects as the methods described above.

[0010] In order to solve, or at least partially solve, the technical problems existing in the background art, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the aforementioned multimodal sleep staging method.

[0011] Optionally, the multimodal physiological signals include at least the electroencephalogram (EEG) signal from the frontal region, the heart rate signal, and the acceleration signal; The signal quality function is a continuous function that sums the weighted values ​​of the EEG signal quality assessment, heart rate signal quality assessment, and acceleration signal quality assessment. The EEG signal quality assessment is obtained by weighting the noise energy ratio, amplitude abnormality factor, and physiological frequency band energy matching degree. The short-time sub-window has a length of 5 seconds, and adjacent short-time sub-windows have 50% overlap. The long-term phase unit has a length of 30 seconds and is formed by aggregating a preset number of consecutive short-term sub-windows. The temporal model is a lightweight temporal convolutional network or a gated recurrent unit network; The sleep staging results include classifications of wakefulness, light sleep, deep sleep, and REM sleep.

[0012] By integrating all core engineering parameters in one go, a directly implementable end-to-end technical solution is provided. The multi-dimensional construction of the signal quality function ensures the comprehensiveness and objectivity of the quality assessment. The combination of a 50% overlapping 5-second short-time sub-window and a 30-second long-time staging unit constructs a dense and smooth feature time series that conforms to medical standard staging frame rates while accurately capturing subtle changes in sleep stages. The use of lightweight temporal convolutional networks or gated recurrent unit networks allows this solution to be adapted to microcontroller platforms with different hardware resources. This design provides a complete and directly implementable technical definition for the method in terms of signal quality-driven approach, multi-scale temporal modeling, and output standardization.

[0013] Optionally, determining the modal feature combination for the short-time sub-window based on the value of a continuously normalized signal quality function includes: Based on the comparison result between the value of the signal quality function and the preset attribute, one of at least two different discrimination paths is selected: When the value of the signal quality function is higher than the preset attribute, the first discrimination path corresponding to the first modality feature combination dominated by EEG features is selected; When the value of the signal quality function is lower than or equal to the preset attribute, the second discrimination path corresponding to the second modal feature combination that integrates heart rate features and acceleration features is selected.

[0014] By introducing explicit preset attributes as judgment criteria, continuous signal quality function values ​​are mapped to deterministic path selection, providing the system with clear and unambiguous decision-making switching logic. This allows the system to focus on the high-precision EEG-dominant discrimination path when EEG signal quality is good; and to decisively switch to the backup path of multimodal fusion at the moment EEG signal quality deteriorates, avoiding performance fluctuations or oscillations caused by ambiguous path switching boundaries, and enhancing the system's anti-interference capability during abrupt changes in signal quality.

[0015] Optionally, determining the modal feature combination for the short-time sub-window based on the value of a continuously normalized signal quality function includes: Based on the value of the signal quality function, the EEG features, heart rate features, and acceleration features are continuously weighted to form the modal feature combination; The weighting coefficients corresponding to each modal feature are continuous functions of the value of the signal quality function, such that when the value of the signal quality function increases, the weighting coefficients of the EEG features increase, while the weighting coefficients of the heart rate features and acceleration features decrease.

[0016] By employing a continuously weighted mechanism, the boundary effects and output abrupt changes that may result from hard path switching are eliminated. The feature space transitions smoothly with the continuous change of the signal quality function; the contribution of EEG features is positively correlated with signal quality, while the contribution of auxiliary modalities increases or decreases accordingly. This smooth modulation method makes the entire staging process more continuous and robust, especially suitable for scenarios where signal quality degrades slowly or fluctuates frequently.

[0017] Optionally, the sum of all weighting coefficients in the signal quality function is 1, and the output range of the signal quality function is [0, 1].

[0018] By applying normalization constraints, the output of the signal quality function becomes a plug-and-play standardized parameter that can be directly and unambiguously used for threshold comparison, continuous weighted calculation, or other decision logic without any additional secondary processing. This reduces the logical complexity and error risk of subsequent modules in the entire system that depend on this parameter.

[0019] Optionally, the method further includes: The classification results of the time series model for each short-term sub-window are compressed into discrete state words; Obtain the discrete state words corresponding to multiple consecutive short-term sub-windows, and concatenate the multiple consecutive discrete state words into an index address; The timing conflict level is output based on the index address using a pre-established lookup table.

[0020] A simplified temporal conflict detection mechanism is constructed by adding a lightweight post-processing step after the output of the temporal model. This mechanism cleverly transforms the problem of temporal state sequence pattern recognition into compact encoding, concatenation addressing, and a one-time table lookup operation. The entire process involves only shifting, concatenation, and a single Flash read, without the need for complex multiplication or logarithmic operations. It can determine the existence of logical inconsistencies in recent sleep phase sequences in a completely deterministic manner within microsecond delays, thereby effectively identifying potential model collapse or signal disorder risks before the final output.

[0021] Optionally, the discrete state word is 2-bit encoded; The step of concatenating multiple consecutive discrete state words into an index address includes: concatenating the 2-bit codes of the most recent 6 sub-windows into a 12-bit bitmap in chronological order; The step of outputting the timing conflict level based on the index address through a pre-established lookup table includes: XORing and counting the 2-bit encoding of adjacent windows to map the 12-bit bitmap into a set of 8-bit feature words representing the frequency of state switching and the number of illegal transitions, and directly reading the conflict level fixed in the lookup table using the 8-bit feature words as the address.

[0022] By compressing the status code to a minimal 2 bits and using pure combinational logic to map the 12-bit bitmap into 8-bit feature words for table lookup, the collision detection algorithm is reduced to a purely bitwise operation level. This scheme requires no static memory allocation, relies solely on register operations, and has a constant and extremely short execution time, enabling it to run in real-time on entry-level microcontrollers like the Cortex-M0+ without any burden. It provides an extremely efficient output reliability verification capability for resource-constrained real-time phased systems.

[0023] Optionally, when the timing conflict level exceeds a preset threshold, the normal output of the sleep staging results is interrupted, and a system-level label representing signal disorder is forcibly output.

[0024] By implementing safety cutoff and explicit reporting mechanisms, the system can honestly refuse to output erroneous results when faced with severe interference, rather than forcibly generating a falsified staging that could mislead subsequent analysis or clinical decisions. This not only improves the overall credibility of the output results but also endows the system with self-diagnostic and transparent reporting capabilities.

[0025] Optionally, the method further includes: When a stage jump that violates the predefined sleep stage transition rules is detected in the sleep staging results, the authenticity of the stage jump is arbitrated based on the real-time data of the accelerometer synchronously acquired during the time period corresponding to the judgment that caused the stage jump. If the real-time data from the accelerometer indicates that there is no motion exceeding a preset threshold, then the stage jump is determined to be a non-real physiological event, and the hidden state of the time series model at the previous safe time point is restored from the circular buffer. If the real-time data from the accelerometer indicates that there is movement exceeding the preset threshold, the stage is determined to be a real physiological event, and the output of the current sleep stage result is maintained.

[0026] By introducing motion data synchronized with EEG signals as arbitration criteria, the abnormal reasoning recovery mechanism is upgraded from a passive hard reset to an active multimodal evidence arbitration and selective state rollback. Motion absence is used as a sufficient criterion for model collapse to trigger safe recovery, while the presence of motion is used as necessary support for genuine physiological arousal to retain the output. This two-way deterministic arbitration logic avoids long-chain erroneous outputs caused by internal model collapse and prevents the masking of genuine physiological arousal events due to over-correction, significantly improving the system's robustness and output credibility under extreme conditions.

[0027] Optionally, the stage jump that violates the predefined sleep stage transition rules includes a direct jump between deep sleep and wakefulness.

[0028] By clearly defining the bidirectional instantaneous transition between deep sleep and wakefulness, which is recognized in sleep medicine as requiring an intermediate stage, as the core violation detection target, the transition detection can accurately focus on the most clinically irrational transition patterns, reducing frequent false triggers caused by ambiguous rules and improving the targeting and efficiency of the arbitration mechanism.

[0029] Optionally, after restoring the hidden state, the feature buffer is filled with zero values, and the filled section is marked as an artificial tomography. Based on the markers of the artificial tomography, within a preset number of transition periods, the sleep staging results output by the time series model for the long-term staging units within the transition period are associated with a low-confidence identifier.

[0030] By employing zero-padded neutral inputs and explicitly marking artificial tomography faults, a bias-free and smooth transition environment is provided for the recovered model, avoiding secondary inference crashes or output oscillations caused by discontinuous input data. Simultaneously, by using low-confidence markers rather than blocking the output, downstream modules are made transparently aware of the reliability limitations of this data segment, allowing the system to gradually resynchronize to the true signal dynamics within a controlled window, meeting the high standards of data transparency required for medical decision-making.

[0031] Meanwhile, this invention also provides a multimodal sleep staging system, which, corresponding to the above-mentioned methods, integrates corresponding functional modules at the system level to achieve the same beneficial effects. Furthermore, the optional technical solutions and beneficial effects of all the aforementioned methods are also applicable to this system.

[0032] Optionally, the continuously normalized signal quality function is a continuous function that sums the weighted values ​​of the EEG signal quality assessment, the heart rate signal quality assessment, and the acceleration signal quality assessment. The EEG signal quality assessment is obtained by weighting the noise energy ratio, the amplitude abnormality factor, and the physiological frequency band energy matching degree. The multimodal physiological signals include at least the electroencephalogram (EEG) signal from the frontal region, heart rate signal, and acceleration signal. The short-time sub-window has a length of 5 seconds, and adjacent short-time sub-windows have 50% overlap. The long-term phase unit has a length of 30 seconds and is formed by aggregating a preset number of consecutive short-term sub-windows. The temporal model is a lightweight temporal convolutional network or a gated recurrent unit network; The sleep staging results include classifications of wakefulness, light sleep, deep sleep, and REM sleep.

[0033] By integrating all core engineering parameters at once, the system has complete and directly implementable hardware and algorithm definitions in three aspects: signal quality driving, multi-scale time modeling, and output standardization.

[0034] Optionally, the system further includes a hardware power gating subsystem, which is configured as follows: When the quality of the EEG signal is consistently below a threshold, the connection between the EEG sensor and the power supply is physically disconnected, and the target address corresponding to the EEG sensor in the direct memory access channel is remapped to a preset discard buffer, so that the system enters a low-power mode that only relies on heart rate and acceleration signals. After entering the low-power mode, a timer independent of the main processor is started to periodically and briefly close the connection at progressively increasing time intervals to verify the signal quality of the EEG sensor. When the verification result indicates that the signal quality has recovered, the low-power mode is deactivated, the connection remains closed, and the target address is restored to the main analysis buffer.

[0035] By physically cutting off the power consumption of low-quality EEG simulation links and isolating invalid data at the data stream level, extreme system power saving is achieved, enabling the system to maintain basic fall protection capabilities with minimal overhead when EEG signals are unavailable. Simultaneously, through independently timed, incrementally spaced periodic probes, the system possesses proactive and autonomous signal recovery detection capabilities, overcoming the problem of permanent blindness after a simple power outage and achieving a truly self-healing hibernation scheduling closed loop.

[0036] Optionally, the system further includes a conflict denial-of-identity sentinel unit, the conflict denial-of-identity sentinel unit being used for: Obtain the classification results of the time series model for each short-term sub-window, and compress each classification result into a discrete state word; The discrete state words corresponding to multiple consecutive short-term sub-windows are concatenated to form an index address; Based on a pre-established lookup table, the timing conflict level is output according to the index address.

[0037] By constructing a conflict denial sentinel unit driven by pure combinational logic, a deterministic output security barrier is added to the system. This module transforms timing consistency verification into compact coding, splicing, and fixed table lookup operations, achieving real-time compliance review of recent sleep phase transition modes at the extremely low cost of constant time and zero SRAM usage.

[0038] Optionally, the discrete state word is 2-bit encoded; The conflict denial sentinel unit is further configured to: combine the 2-bit codes of the most recent 6 short-term sub-windows into a 12-bit bitmap in chronological order; map the 12-bit bitmap into a set of 8-bit feature words representing the frequency of state transitions and the number of illegal transitions by XORing and counting the 2-bit codes of adjacent windows; and directly read the conflict level stored in the lookup table using the 8-bit feature words as the address.

[0039] By compressing state encoding, index construction, and conflict mapping into pure bit operations at the bit level, the hardware implementation of the conflict denial sentinel unit requires only a few logic units, with a constant and extremely short execution time, which fully meets the requirements of extremely resource-constrained scenarios.

[0040] Optionally, the conflict denial sentinel unit is further configured to: interrupt the normal output of the sleep staging results and force the output of a system-level label representing signal disorder when the timing conflict level exceeds a preset threshold.

[0041] This enables the system to proactively truncate erroneous outputs when faced with unacceptable timing disturbances and transparently report the unreliable status of the current signal to external systems or users, thereby improving the self-diagnostic capability and output reliability of the phased system.

[0042] Optionally, the system further includes an inference recovery unit, the inference recovery unit being used for: When a stage jump that violates the predefined sleep stage transition rules is detected in the sleep staging results, the stage jump is arbitrated based on the real-time data of the accelerometer synchronously acquired during the time period corresponding to the judgment that caused the stage jump. The stage jump that violates the predefined sleep stage transition rules includes a direct jump between deep sleep and wakefulness. If the real-time data from the accelerometer indicates that there is no motion exceeding a preset threshold, then the stage jump is determined to be a non-real physiological event, and the hidden state of the time series model at the previous safe time point is restored from the circular buffer. If the real-time data from the accelerometer indicates that there is motion exceeding the preset threshold, then the stage is determined to be a real physiological event, and the output of the current sleep stage result is maintained. After restoring the hidden state, the feature buffer is filled with zero values ​​and the filled segment is marked as an artificial tomography. Based on the marking of the artificial tomography, within a preset number of transition periods, the sleep staging results output by the time series model for the long-term staging unit within the transition period are associated with a low confidence identifier.

[0043] A complete system-level fault-tolerant and self-healing system is constructed by integrating jump detection, multimodal evidence arbitration, selective state rollback, and controlled smooth transition into an inference recovery unit. When a physiologically impossible jump is detected, the system does not blindly block or reset it. Instead, it first seeks independent physical evidence for cross-validation, performing precise state rollback only when inconsistencies arise, and achieving transparent and safe recovery through low-confidence flags during the transition period. This avoids long-term erroneous outputs caused by model collapse, prevents over-correction from masking real physiological events, and provides a clear signal of data credibility from the output.

[0044] Optionally, the acquisition module includes a first buffer and a second buffer, as well as a direct memory access controller; The direct memory access controller is used to alternately write the real-time sampled data of the multimodal physiological signals into the first buffer and the second buffer; When the first buffer is in a write state, the partitioning module reads the complete data that has been written from the second buffer to perform the partitioning of the short-term sub-window; When the second buffer is in a write state, the partitioning module reads the complete data that has been written from the first buffer to perform the partitioning of the short-term sub-window.

[0045] A ping-pong mechanism using double buffering and direct memory access achieves a high degree of parallelism in data acquisition and processing. The acquisition side continuously and uninterruptedly writes new data into a buffer, while the processing side simultaneously performs complete windowing and feature extraction on another buffer that has already been written to. This physically eliminates data waiting and bus contention, ensuring zero-loss acquisition and low-latency processing of continuous physiological signals on the microcontroller platform, providing a highly reliable time-series data foundation for subsequent real-time staging.

[0046] In summary, the technical solution provided by this invention systematically solves the problems of insufficient robustness of sleep staging and inadequate stage evolution capture under resource-constrained conditions in the prior art through the core framework of signal quality-driven adaptive feature structure recombination and cross-scale temporal modeling. Building upon this, it further constructs a defense-in-depth system from the physical layer to the logical layer through mechanisms such as hardware self-healing hibernation, conflict rejection, and inference recovery. This system can significantly improve the system's self-diagnosis, self-recovery capabilities, and output honesty under extreme signal conditions while ensuring extremely low power consumption and low computational overhead, thus forming a comprehensive technical advantage significantly superior to existing technologies. Attached Figure Description

[0047] To more clearly illustrate the embodiments of this patent, the relevant drawings will be briefly described below. It should be understood that the drawings described below are only for illustrating some embodiments of this patent, and those skilled in the art can obtain many other technical features and connections not mentioned herein based on these drawings.

[0048] Figure 1 This is a schematic diagram of the module structure of the multimodal sleep staging system provided in the embodiments of the present invention; Figure 2 This is a schematic diagram of the modules and process of the conflict rejection and reasoning recovery system provided in the embodiments of the present invention; Figure 3 This is a schematic diagram of the collaborative workflow and hardware interaction topology of the hardware power gating subsystem and the dual-buffered ping-pong acquisition provided in the embodiments of the present invention. Figure 4This is a schematic diagram illustrating the integration of the lightweight convolutional neural network embedding model and its dynamic combination mechanism with the feature determination module provided in the embodiments of the present invention. Figure 5 This is a flowchart illustrating the real-time artifact detection and labeling module based on a fine-grained sliding window and its collaborative operation with the feature determination module provided in this embodiment of the invention. Figure 6 This is a schematic diagram of the cold start shielding period, steady-state acquisition window, and exponential backoff algorithm of the enhanced hiccup probe provided in the embodiments of the present invention, as well as its coordination with the quality sentinel. Detailed Implementation

[0049] The patent will now be described in detail with reference to the accompanying drawings.

[0050] As wearable health monitoring devices continue to evolve towards miniaturization and longer battery life, deploying complex physiological signal analysis algorithms entirely on resource-constrained microcontroller platforms has become a key trend for improving user scenario continuity and data security. In the specific field of sleep monitoring and staging, such deployments not only face milliwatt-level power consumption budgets and kilobyte-level memory limitations, but also must cope with the drastic fluctuations in signal quality caused by uncontrolled wearing, turning over, and sweating in real-world environments. How to simultaneously achieve reliable, accurate, and honest automatic multimodal sleep stage staging on a single microcontroller chip is the core challenge facing this field.

[0051] A prior art solution known to those skilled in the art is described in patent document CN114081439A. This document discloses a sleep staging method based on a single-channel prefrontal EEG signal. Its core framework can be summarized as follows: First, continuous EEG signals are acquired using a single EEG sensor configured in the prefrontal region. Then, the acquired EEG signals are segmented into analysis frames of fixed time lengths. For each analysis frame, a set of preset EEG feature parameters, such as frequency domain energy distribution and time domain statistics, are extracted. Finally, the extracted feature vectors are input into a hyperdimensional computational classifier called a brain-like computational model to directly output the sleep stage classification result corresponding to that analysis frame. The advantage of this solution lies in its lightweight algorithm design, making it possible to complete sleep staging on local embedded hardware. This avoids the reliance on transmitting raw physiological data wirelessly to external smart devices or cloud servers, thus mitigating the constraint of data transmission stability on system real-time performance to some extent.

[0052] However, in the actual application and engineering deployment of the above solutions, some inherent limitations of their technical architecture have gradually become apparent, constituting a deep technical bottleneck that hinders their reliable product-level application in a wider range of scenarios.

[0053] In terms of signal processing mechanisms, this existing approach essentially constructs a static, single-modality decision-making path. Although it can perform artifact detection and data removal during the preprocessing stage, this only excludes signal segments already deemed invalid and does not change the absolute dependence of the entire classification system on the EEG signal as a single information source. When the wearer lies on their side, causing pressure on the forehead electrodes and increased impedance, or when sweating causes half-cell potential drift at the electrode-skin interface, the signal-to-noise ratio (SNR) of the EEG signal will significantly decrease. In such cases, since there are no other parallel and independent alternative decision-making paths, the classifier is forced to make judgments based on degraded feature inputs. This rigid dependence on a single modality leads to a sharp deterioration in the system's classification accuracy as the input signal quality decreases. After the SNR falls below a certain critical range, its output results no longer have clinical reference value.

[0054] Furthermore, the "fixed segmentation-independent classification" approach employed in this scheme also suffers from structural deficiencies in the utilization and modeling of temporal information. It mechanically divides the continuous sleep process into isolated analytical frames and classifies each frame separately, ignoring the fundamental principle that sleep staging is a continuously evolving physiological process over time. For example, the transition from light sleep to deep sleep is usually accompanied by a gradual accumulation of slow-wave energy in the EEG signal; while brief awakenings from REM sleep are often characterized by rapid, non-linear alternations of various rhythms. This scheme's classification based on the static features of a single frame fails to establish explicit temporal dependencies between adjacent analytical frames, thus failing to capture the dynamic evolutionary information of these transitional stages. This makes the model prone to frequent, physiologically incompatible output oscillations at stage boundaries, directly compromising the temporal coherence and accuracy of the staging results.

[0055] Furthermore, this scheme only uses the independent classification results of each analysis frame as the final output, and its reasoning process does not embed general physiological constraints regarding sleep stage transitions. A healthy sleep process follows specific physiological pathways for stage transitions; for example, deep sleep rarely jumps directly to wakefulness, but usually requires a transition through light sleep. This existing scheme fails to reflect such prior knowledge in the model's decision-making process, leading to physiologically impossible events in its final output stage sequence, such as direct jumps between deep sleep and wakefulness. This logical violation reduces the clinical interpretability of the results.

[0056] To address the robustness deficiencies exposed in scenarios with fluctuating signal quality, those skilled in the art might intuitively conceive of several improvement strategies. One approach is to directly add heart rate and accelerometer sensors as auxiliary information sources to the existing EEG acquisition architecture, and then simply concatenate the features extracted from these three sensors to form a higher-dimensional input vector. However, this rudimentary concatenation method immediately raises engineering challenges on a microcontroller platform, including multi-channel data synchronization, memory bandwidth contention, and a surge in model size due to feature dimension expansion. More importantly, simple concatenation does not endow the system with the ability to determine the "credibility" of each modality signal at the current moment, potentially introducing the risk of poor-quality auxiliary signals contaminating the overall decision-making process. Another approach is to set a binary threshold based on whether the EEG signal is "usable," using the first model when the EEG is good and switching to the second model when the EEG fails. However, practice has shown that this hard-switching strategy cannot cope with moderate interference ranges where the signal-to-noise ratio changes continuously, and frequent mode switching itself introduces additional temporal discontinuities.

[0057] As the above deduction shows, the real technical problem that urgently needs to be solved in this field is not to forcibly fit the degradation data of a single modality with higher power consumption or more complex models, but rather how to provide a new solution while strictly adhering to the hardware limits of the microcontroller platform. This solution must enable the fusion and decision-making process of multimodal signals to achieve adaptive structural adjustment and path reconstruction based on the continuous dynamics of the signal quality of each channel. At the same time, it must also be able to organically couple signal features at different time scales so that the continuous evolution process of the sleep stage can be accurately characterized. Ultimately, the above mechanisms need to work together to form a terminal solution that can operate independently in a closed loop on a single chip, providing highly robust, highly temporally consistent, and physiologically reasonable staging results even under conditions of fluctuating signal quality.

[0058] In view of this, the embodiments of the present invention aim to provide an adaptive multimodal sleep staging method and system for resource-constrained platforms, in order to solve or at least partially alleviate the above-mentioned technical problems.

[0059] Implementation Method 1 The first embodiment of this invention provides a multimodal sleep staging system that can operate independently in a closed loop on a microcontroller platform, and a method based on this system. This embodiment aims to achieve highly robust and temporally consistent sleep stage discrimination under resource-constrained hardware environments. Specifically, see [link to relevant documentation]. Figure 1 As shown, the system of this embodiment includes an acquisition module, a segmentation module, a feature determination module, and a phased module. Its overall architecture and internal information flow will be described in detail below in conjunction with the specific signal processing process.

[0060] First, the acquisition module is used to synchronously acquire multimodal physiological signals covering the sleep process. These signals include at least electroencephalogram (EEG) signals and optionally integrate heart rate and acceleration signals to form a complementary information source set. In practical engineering implementation, the acquisition module can include one or more dry electrodes positioned in the user's forehead region. For example, referring to the international 10-20 system, positions such as FP1, FP2, FP7, and AF8 can be selected to acquire forehead EEG signals non-invasively. To achieve a balance between power consumption and signal fidelity, the sampling rate of this EEG signal channel can be set to 250 Hz, i.e., recording 250 discrete voltage samples per second. Simultaneously, the acquisition module can integrate a photoplethysmography (PPG) sensor, typically placed on the inner surface of the device in contact with the skin. By detecting changes in blood volume in the microvessels of the tissue, a peak detection algorithm is used to extract the successive heartbeat interval sequence. Furthermore, a triaxial microelectromechanical accelerometer (MEMS) sensor can be incorporated into the acquisition module to sense acceleration changes along three orthogonal axes of the wearer; its sampling rate can be set, for example, to 50 Hz. At the underlying data transfer level, the acquisition module can include a direct memory access controller, which is configured to directly write the multi-channel raw sampling data after analog-to-digital conversion into a designated buffer in the microcontroller's on-chip static random access memory. This process frees the central processing unit from intensive intervention, enabling data acquisition and subsequent processing to be parallel in time, thereby reducing the overall system latency.

[0061] After the raw multimodal signal stream is generated, optional signal preprocessing steps are performed to suppress noise and pre-regulate the data. For example, for EEG signals, a bandpass filter with a passband of 0.5 Hz to 45 Hz can be applied to simultaneously attenuate low-frequency baseline drift and high-frequency electromyographic noise, and a power frequency notch filter with a center frequency of 50 Hz or 60 Hz can be used to eliminate mains coupling interference. After filtering, based on a sliding time window of, for example, 1 second, the slope, instantaneous absolute amplitude, and energy proportion of each frequency band within the window can be continuously calculated to identify abnormal data segments with motion artifacts or poor electrode contact in real time. These markers can provide a reference for downstream confidence assessment. For heart rate-related signals obtained from photoplethysmography (PPG) sensors, preprocessing steps may include extracting clean and reliable RR interval sequences, specifically by first identifying pulse wave peaks and then removing physiologically unreasonable intervals caused by motion interference. For triaxial acceleration signals, a low-pass filter with a cutoff frequency of, for example, 10 Hz can be applied to filter out high-frequency vibration components, so as to retain useful information reflecting slow changes in body posture and macroscopic movements such as turning over in bed throughout the night.

[0062] Following signal preprocessing, the segmentation module performs structured temporal segmentation on the continuously incoming multimodal data stream to establish explicit engineered correlations between different time scales. The segmentation module first defines a basic analysis unit called a short-time sub-window, whose span on the time axis can be set, for example, to 5 seconds. To increase information overlap between consecutive analyses and capture subtle dynamic changes, adjacent short-time sub-windows are configured to have 50% overlap, meaning the window start time advances in 2.5-second increments. Furthermore, the segmentation module organizes multiple consecutive short-time sub-windows into a higher-level temporal structure called a long-time staging unit. The length of this long-time staging unit can adopt the standard frame duration widely accepted in sleep medicine, i.e., 30 seconds. Thus, each 30-second long-time staging unit establishes a binding mapping relationship with a feature time sequence consisting of, for example, 11 overlapping short-time sub-windows. This nested temporal structure allows the system to access not only the overall features within that 30 seconds when deciding on a sleep stage label, but also to finely perceive the situational evolution every 5 seconds within that 30 seconds.

[0063] After each short-term sub-window is defined, the feature determination module then operates. Its core task is to dynamically determine, based on the self-evaluation results of signal quality, which feature combinations to extract from the multimodal signal and how to combine them to form the feature representation of that sub-window. To achieve this adaptive mechanism, the feature determination module first calculates a continuous, normalized index called the signal quality function, which can be represented by the symbol SQI(t), where t denotes the time index of the current sub-window. The signal quality function SQI(t) integrates the quality assessment values ​​of three modalities: EEG, heart rate, and acceleration. Its output value range is constrained to a continuous real number range between 0 and 1 to reflect the overall reliability of the signal. As a more specific implementation example, the logical construction process of the signal quality function SQI(t) can be decomposed and explained as follows.

[0064] For EEG signals, the feature determination module can calculate an EEG signal quality assessment value, denoted as . (t). This assessment value is based on a weighted average of three sub-indicators: the first being the percentage of noise energy. (t) is defined as the proportion of the sum of power frequency noise and electromyographic noise energy in the total energy of the current sub-window. The smaller (t) is, the higher the signal purity; the second term is the amplitude anomaly factor. (t) quantifies the degree of deviation of the instantaneous variance of the EEG signal within the current window from the baseline variance level of a quiet wakefulness period; the more significant the deviation, the higher the abnormality. The third term is the physiological frequency band energy matching degree. (t) assesses the extent to which a signal conforms to a normal brainwave rhythm pattern by calculating the cosine similarity between the energy distribution of typical sleep frequency bands (δ, θ, α, and β waves) and the standard sleep EEG spectrum. These three sub-indicators can be assigned empirical weights, for example... =0.4、 =0.3 and =0.3, and after normalization and compression using a sigmoid function, the final result is... (t)∈[0,1].

[0065] For heart rate signals, the feature determination module can calculate a heart rate signal quality assessment value, denoted as . (t). For example, the normalized standard deviation SDNN(t) of the RR interval sequence within the current sub-window and the root mean square of the difference between adjacent RR intervals RMSSD(t) can be used. Excessive values ​​of these two statistics indicate highly irregular heart rate rhythms, often associated with noise or abnormal heartbeats. Furthermore, the ratio of low-frequency to high-frequency power, LF / HF(t), can be extracted and compared to a benchmark value μ_LH representing the autonomic nervous system's equilibrium during quiet sleep; the greater the deviation, the worse the quality. These indicators can be mapped using an exponential function with a decay coefficient and then summed with appropriate weights, also normalized to the 0-1 interval.

[0066] For acceleration signals, the feature determination module can calculate an acceleration signal quality assessment value, denoted as . (t). For example, a continuous smoothness index can be defined. (t) is used to measure the temporal continuity of the acceleration signal by the reciprocal of the variance of the difference sequence of adjacent sampling points; the better the continuity, the higher the score. Simultaneously, it can assess the instantaneous large-amplitude motion energy. (t), for example, captures the intensity of a rollover or violent limb shaking by calculating the variance of the triaxial composite acceleration amplitude within this sub-window; the larger this index, the worse the quality. These two indices, one positive and one negative, after weighted normalization, constitute... (t).

[0067] After obtaining the quality assessment values ​​for each of the three modes, the feature determination module obtains the fused signal quality function SQI(t) through a weighted summation. An exemplary set of fusion weights can be α=0.6, β=0.3, ε=0.1, satisfying the constraint α+β+ε=1, thus ensuring that SQI(t) itself is a standardized scalar falling within the [0,1] interval. Clearly, the above weighting ratios and the definitions of specific sub-indicators can be adjusted according to the signal characteristics and computing power of the target hardware, and are not the only numerical choices.

[0068] Once the signal quality function SQI(t) is calculated in real time, the feature determination module uses its value to determine the modal feature combination of the current short-term sub-window. This implementation presents two technically equivalent but mechanistically different implementation strategies, which can be interchangeably deployed in the same system framework.

[0069] The first strategy can be called discrete path selection based on preset attributes. This strategy presets a configurable attribute, such as 0.5. For each short-term sub-window, the feature determination module performs a comparison: if the current SQI(t) value is higher than the preset attribute, the first discriminative path is initiated, where the modality feature combination is dominated by EEG features. Under the first discriminative path, the feature determination module extracts a set of features from the EEG signal of that sub-window, including frequency domain, time domain, and deep representation. Specifically, the frequency domain features can be the energy values ​​of each frequency band (δ, θ, α, β) separated by a bandpass filter bank; the time domain features can include the root mean square value, variance, and zero crossover rate of the signal, which can reflect the intensity and complexity of waveform fluctuations; the deep representation is generated by a lightweight convolutional neural network, which directly takes the original EEG waveform as input and outputs an embedded feature vector, such as 32-dimensional, through two or three layers of temporal convolution and pooling operations. This embedding can automatically discover and encode nonlinear spatiotemporal patterns in the waveform related to sleep stages. Simultaneously, under this path, heart rate and acceleration features are temporarily not extracted or are only used as supplements to reduce feature dimensionality and computational overhead. Conversely, if the value of SQI(t) is less than or equal to this preset attribute, it indicates that the EEG signal is currently severely contaminated, and the feature determination module will switch to the second discrimination path. Under the second discrimination path, modality feature combination focuses on heart rate and acceleration features. For example, extracted features may include heart rate variability features (such as RMSSD, SDNN, LF / HF ratio) and acceleration motion features (such as variance of triaxial composite amplitude, axial angle change index), while EEG features are temporarily suppressed. This strategy achieves rigid switching of the decision structure when the EEG signal fails by completely replacing the input feature subspace, ensuring fall detection capability.

[0070] The second strategy can be called smooth modulation based on continuous quality weights. This strategy avoids introducing any hard thresholds and instead uses SQI(t) as a direct modulation coefficient. For each sub-window, the feature determination module extracts all preset features of all three modalities in parallel, and then assigns a dynamic continuous weight to each set of features based on SQI(t). For example, the weight coefficients of the overall EEG features can be... The weighting coefficients of the heart rate feature are set to be exactly equal to SQI(t), and the weighting coefficients of the heart rate feature are... Weighting coefficients of acceleration characteristics Then it is allocated according to the proportion of (1-SQI(t)), such as = (1 - SQI(t)) β / (β+ε), = (1 - SQI(t)) ε / (β+ε), where β and ε are the aforementioned fusion weights. This means that when the EEG signal quality is excellent (SQI(t) approaches 1), the final feature vector is almost entirely composed of EEG features, while the contributions of heart rate and acceleration features are continuously compressed to near zero; as the EEG signal quality gradually deteriorates (SQI(t) decreases), heart rate and acceleration features smoothly increase their contribution ratio until they become dominant; and in the medium quality range, features from each modality coexist in the final feature vector in a certain proportion. This strategy achieves a seamless and uninterrupted evolution of the feature space composition with signal quality, giving the system a more stable transition capability under boundary interference scenarios.

[0071] The commonality between the two strategies mentioned above is that they both enable the feature vector output by the feature determination module to dynamically change its specific composition structure as the signal quality changes. This is fundamentally different from traditional fixed fusion or gating based on simple rules.

[0072] After feature extraction for all short-term sub-windows is completed, the staging module is responsible for performing the final sleep stage decision. For a long-term staging unit organized by the segmentation module, the feature vectors of multiple consecutive short-term sub-windows arranged chronologically within it are collected sequentially to form a feature sequence. For example, when using a 5-second sub-window and a 2.5-second step size, a 30-second long-term staging unit can correspond to a feature sequence of 11 time steps. This feature sequence is then fed into a pre-trained and deployed lightweight temporal model. The temporal model in this embodiment can employ a lightweight temporal convolutional network, which, by stacking dilated convolutional layers, can obtain a large temporal receptive field with fewer parameters, thereby capturing sleep stage transition patterns spanning tens of seconds; or, it can employ a gated recurrent unit network, which, through its reset and update gate mechanisms, continuously memorizes and fuses long-term historical information in its internal hidden state. This temporal model essentially models the conditional probability of "sub-window feature sequence → long-term classification result". The input consists of a feature sequence containing local dynamics, and the output is a probability value corresponding to four categories via a normalized exponential function: wakefulness, light sleep, deep sleep, and REM sleep. Finally, each long-term stage is assigned a unique sleep stage label, typically the category with the highest probability. The continuous sleep stage map for the entire night is then pieced together from the outputs of a series of successively processed long-term stage units.

[0073] From a system implementation perspective, the aforementioned acquisition module, segmentation module, feature determination module, and stagement module can be integrated into a single general-purpose microcontroller based on an ARM Cortex-M core or similar architecture. Its firmware image can complete all code execution and temporary data access within hundreds of kilobytes of on-chip flash memory and tens of kilobytes of on-chip static random access memory without requiring external dynamic random access memory. By organically combining the three core components of signal quality assessment, adaptive feature combination, and multi-scale temporal modeling, the system and method provided in this embodiment can effectively cope with drastic signal quality fluctuations caused by electrode displacement, motion interference, or environmental noise in real-world scenarios, under strict resource constraints at the microcontroller level, and output a coherent sleep stage sequence that combines accuracy and physiological rationality.

[0074] Implementation Method 2 In the system and method disclosed in Implementation Method 1, a signal quality-driven adaptive feature extraction and cross-timescale temporal modeling framework has been constructed, which can generate a continuous sleep stage label sequence. Under most normal wearing and signal conditions, this architecture can fully utilize the advantages of multimodal information and dynamic evolution modeling to output stage results with both accuracy and temporal consistency. However, when the application scenario extends to completely uncontrolled daily environments, such as when a user unconsciously applies a brief mechanical shock to the device during sleep, or when a sensor-skin interface suddenly forms a high-impedance connection due to excessive sweating, the underlying data stream input to the temporal model may be momentarily flooded with excessive impulse noise or signal loss lasting for several seconds. Under such extreme conditions, the internal recurrent hidden states or convolutional buffers of the temporal inference unit based on the deep learning model may be severely disrupted, causing the model to continuously generate a series of physiologically impossible stage transitions over a subsequent period of time, such as direct jumps between deep sleep and wakefulness without transition, or a label sequence that appears stable but is completely deviates from reality. Because the system lacks the ability to autonomously detect and actively repair such inference-level crashes, this unreliable output could directly contaminate the entire second half of the night's sleep recordings, which is unacceptable in applications involving precise sleep efficiency assessments or closed-loop neuromodulation.

[0075] In view of this, the second embodiment of the present invention further improves the sleep staging system of the first embodiment. The main improvement is as follows: [See attached...] Figure 2As shown, a lightweight conflict rejection sentinel unit is added after the original stagement module, along with an inference recovery unit that links with the stagement module and the acceleration acquisition channel. These two units work collaboratively to construct an output security barrier for the entire stagement system with honest rejection and self-healing capabilities, at the cost of minimal computational latency and memory usage. The conflict rejection sentinel unit performs deterministic temporal consistency checks on the classification sequences of recent sub-windows. When an unacceptable logical conflict is detected, it proactively intercepts potentially erroneous physiological labels and inserts a new system-level label that transparently expresses an untrusted signal state. The inference recovery unit continuously monitors the final output stage sequence for structural mutations that violate general sleep physiology. Upon detecting such mutations, it uses objective motion evidence from synchronously acquired acceleration sensors to arbitrate authenticity, deciding whether to allow the mutation to be recognized as genuine physiological awakening or to determine it as a model collapse and perform a minimum state rollback and smooth transition recovery based on historical security checkpoints.

[0076] Specifically, regarding the internal structure and workflow of the conflict rejection sentinel unit, it can be decomposed into three ordered sub-stages: encoding and compression, temporal concatenation and combined addressing, and fixed lookup table decision. The input to this unit is the raw classification hard decision generated by the temporal model in the phased module for each 5-second short sub-window, i.e., the stage category corresponding to the maximum value in the model's output probability vector. In the encoding and compression sub-stage, the sentinel unit maps the stage category of each sub-window to a 2-bit discrete state word. As an example encoding scheme, wakefulness can be encoded as binary 00, REM sleep as 01, light sleep as 10, and deep sleep as 11. Through this mapping, the continuous sleep stage sequence is reduced in dimension and compressed into a compact digital stream representing a state using only two bits, greatly simplifying the bit width and processing bandwidth required for subsequent processing.

[0077] During the timing splicing and combinational addressing sub-stage, the sentinel unit maintains, for example, a 12-bit shift register. After processing each new sub-window, the generated 2-bit status word is pushed into the lowest two bits of this register, while the original high 10 bits are shifted towards the higher bits, ensuring that the register always dynamically stores the status words of the most recent 6 sub-windows. These 6 status words are arranged consecutively in chronological order from oldest to youngest, forming a 12-bit bitmap. This bitmap itself is a compact index address that simultaneously encodes the recent state type and evolution order.

[0078] To extract information reflecting the degree of timing conflicts from the 12-bit bitmap, the sentinel unit employs a combinational logic based on pure bitwise operations for feature compression. In one specific implementation, this combinational logic performs a bitwise XOR operation on each pair of 2-bit codes of adjacent sub-windows and counts the total number of bits where the XOR result is 1. The XOR operation can very sensitively identify whether a switch has occurred between sleep stage categories in two consecutive windows, while the accumulated count directly measures the total frequency of state switching within the 6-window observation window. Simultaneously, this logic can also additionally check for specific types of illegal transitions, such as directly checking whether the bitmap contains a specific adjacent coding pattern that marks a sudden change from deep sleep (11) to wakefulness (00), and incorporating such events into the intermediate result with additional count bits. Finally, these counts and flag bits are compressed into an 8-bit feature word. This 8-bit feature word fully captures the intensity and logical compliance of recent sleep stage shifts.

[0079] Subsequently, the sentinel unit uses this 8-bit feature word directly as the address to read a hard-coded lookup table pre-burned into the microcontroller's on-chip flash memory. This lookup table contains 256 entries, each occupying one byte. Its content is pre-filled and embedded into the firmware by those skilled in the art based on knowledge from sleep medicine experts and offline exhaustive analysis of large-scale clinical datasets. The value stored in each byte represents the conflict level of the corresponding timing pattern. For example, 0 indicates that the queried recent state sequence is logically coherent and safe; 1 indicates a certain degree of frequent switching, but still within physiologically tolerable boundaries, belonging to the warning level; 2 indicates a high degree of timing disorder or direct illegal jumps, belonging to the high conflict level.

[0080] To implement the aforementioned conflict detection logic on the extremely resource-constrained microcontroller addressed in this embodiment, the core processing of the sentinel unit can be designed as a completely stateless memory-free hard logic link that relies solely on register operations. Internally, this unit maintains a 12-bit shift register. Whenever a new 5-second sub-window completes classification, its corresponding 2-bit discrete state word is pushed into the least significant bit of this register. At this time, the bitmap stored in the 12-bit register completely records the sleep phase succession sequence of the most recent 6 sub-windows. A compact combinational logic circuit or equivalent software macro is then triggered. It performs a bitwise XOR operation on each pair of adjacent 2-bit codes and accumulates the set bits in the XOR result, directly quantifying the total frequency of state transitions within the time window. Simultaneously, this logic can also check in parallel whether predefined illegal adjacent encoding patterns, such as a sudden change from "11" (deep sleep) to "00" (awake), appear in the bitmap. The frequency count and the illegal transition flag are merged and compressed into an 8-bit feature word. The 8-bit feature word is then used as an address to directly access a 256-byte hard-coded lookup table pre-programmed into the microcontroller's on-chip flash memory. Each byte in this lookup table, based on sleep medicine expert knowledge and offline analysis of large-scale clinical data, assigns a conflict level (e.g., 0 for safety, 1 for warning, 2 for high conflict / disorder) corresponding to the timing pattern represented by the 8-bit feature word. The entire process, from encoded input to conflict level output, consumes a constant and minimal number of machine cycles, requiring no static random access memory allocation, making it manageable even for entry-level microcontrollers. When the conflict level output by the lookup table is the highest, the sentinel unit determines that the model inference sequence corresponding to the current long-term phase unit is unreliable. At this point, the system not only forces the output of the Artefact tag as described above, but can also be configured to send an "intense signal disorder" emergency notification to the system's hardware power gating subsystem via internally shared flags or event signals. This notification can serve as a prerequisite, accelerating the process of reviewing and diagnosing the quality of EEG front-end signals, thereby establishing a millisecond-level rapid linkage closed loop between the logic layer and the physical layer, from 'anomaly detection' to 'hardware response'.

[0081] Once the complete sequence of stage labels for a new long-term staged unit is generated, the sentinel unit performs the aforementioned table lookup operation on all its sub-windows and synthesizes a comprehensive conflict level determination for that unit. The sentinel unit then performs a pre-set threshold comparison. For example, this pre-set threshold can be set to 2. If the conflict level of the current unit is lower than or equal to this threshold, such as 0 or 1, the sentinel unit remains silent, and the sleep stage labels output by the staged module are allowed as is, as the final output. However, once the conflict level of any long-term staged unit is determined to exceed the preset threshold, for example, reaching 2, the sentinel unit will immediately execute an output interception action. It will block the outward transmission of all normal physiological stage labels for that unit and instead forcibly generate a system-level status label independent of the four sleep stages. For example, this label can be named Artefact, and its semantics are to inform the upper-layer application or backend analysis system that the data generated in the current period lacks reliable physiological stage information due to underlying signal disturbances or algorithm inference failure. This strategy of honestly refusing rather than making forced guesses is the core security feature for ensuring the integrity of medical-grade data.

[0082] The collision denial sentinel unit employs a "2-bit encoding - 12-bit concatenation - 8-bit logic mapping - 256-byte lookup table" technology chain, where each step is strictly limited to integer fields and bit operations, without involving any floating-point multiplication, logarithmic, or division operations. On a typical Cortex-M0+ level microcontroller, the number of CPU cycles required to complete the entire process of a sub-window is extremely small, and the overall time can be controlled within a few microseconds. Furthermore, since the entire process relies solely on direct access to the processor's internal general-purpose registers and on-chip flash memory, it does not incur any additional static random access memory (SRAM) usage, which is crucial for embedded platforms where memory is typically measured in kilobytes.

[0083] While the conflict denial sentinel unit provides real-time output safety filtering for the system, this implementation also introduces a parallel but logically independent inference recovery unit. This inference recovery unit focuses on addressing a more specific and potentially more dangerous failure mode: when the sequential model, seemingly without continuous large-scale signal loss, suddenly outputs a stage jump that is considered extremely unlikely in sleep physiology. In this implementation, a clearly defined target jump mode with the most physiologically abnormal characteristics is a direct jump between deep sleep and wakefulness, i.e., the previous long-term stage unit is labeled as deep sleep, while the current unit label abruptly changes to wakefulness, or vice versa. In normal sleep structure evolution, the transition from deep sleep to wakefulness almost always involves a brief transition to light sleep or REM sleep; such a leapfrog direct jump is usually the product of strong external stimuli or internal model state disorder.

[0084] To this end, the inference recovery unit contains a lightweight rule engine called the Independent Physiological Violation Detector. This detector continuously receives long-term staged tags output by the staged module, which have already been initially filtered by the sentinel unit. Each time a new tag is received, it is compared with the previous tag currently stored in the context, and a pre-defined, disabled state transition is used to perform a match check on the list. When a direct jump between deep sleep and wakefulness is detected, the Independent Physiological Violation Detector immediately issues a violation warning signal. At this point, the signal does not directly lead to discarding or overwriting the current tag, but instead first triggers another key component within the unit—the multimodal evidence arbitrator.

[0085] The multimodal evidence arbitrator works by immediately querying the existing acceleration acquisition channels of the system, at the same moment a violation warning is received, for an acceleration sensor activity record that is precisely aligned in time with the current long-term segmentation unit. In practice, the microcontroller's acceleration sensor typically continuously calculates and updates an activity register internally, reflecting the integral value or maximum change in triaxial composite acceleration exceeding a certain nominal gravity during that time period. The arbitrator then compares the read activity value with a pre-calibrated acceleration threshold embedded in the firmware, which can be represented by the symbol θ. snore The term θ represents the minimum kinetic energy required to distinguish a user's resting state from a defined limb movement such as turning over or sitting up. If the query results show that the measured activity level of triaxial acceleration does indeed exceed θ during the current time period... snore This constitutes strong objective physical evidence that the user most likely experienced a genuine, brief physiological arousal accompanied by bodily movement. Based on this evidence, the multimodal evidence arbitrator will arbitrate this violation as a genuine physiological event, thus rejecting the warning from the independent physiological violation detector. The stage label currently judged as arousal will be retained as a valid result and output normally, thereby avoiding the inherent problem of misjudging the user's genuine arousal as an algorithmic malfunction.

[0086] Conversely, if the query results from the accelerometer indicate that the activity level is significantly lower than the threshold θ during that period... snore If the user's body is almost completely still, then without corresponding evidence of bodily movement, it is physiologically almost impossible for them to jump directly from deep sleep to wakefulness. In this case, the multimodal evidence arbitrator will make the opposite arbitration, confirming that this is a false output event caused by interference or internal model collapse, and then initiate a state rollback process managed by the unit.

[0087] The execution of the state rollback process relies on a very small buffer pre-allocated in static random access memory. This buffer can be called a circular buffer or a state checkpoint buffer. Its basic working mechanism can be compared to the time-series transaction log generated by the phasing module itself. During the continuous normal operation of the system, after each long-term phasing unit completes its inference, and its final output label simultaneously satisfies the following two conditions—that is, it is not judged as high-conflict by the conflict rejection sentinel unit, and no violation is detected by the independent physiological violation detector—the hidden state of the time-series model at the time of the unit's inference completion is denoted as... This will be considered a verified security checkpoint and pushed to the circular buffer for updates. As an example design to adapt to resource constraints, the circular buffer can retain only the hidden state of the four most recent security checkpoints. Assuming the timing model used is a gated cyclic unit network with a hidden dimension of 64, storing each dimension as a 2-byte half-precision floating-point number, then each hidden state occupies 128 bytes, and the entire circular buffer only requires 512 bytes of on-chip memory, which is perfectly acceptable for mainstream microcontrollers.

[0088] Once the arbitrator confirms the need for a rollback, the recovery unit will sequentially perform the following three steps: First, it immediately blocks the normal sleep stage label output of the current long-term stage unit with the spurious transition problem and can forcibly assign it a temporary label indicating that the data is temporarily unavailable. For example, it can output an Artefact label defined in conjunction with the sentinel unit to explicitly notify the outside world of the loss of credibility of this data segment. Second, it reads the most recently stored valid security hidden state from the circular buffer and uses it to directly overwrite the contaminated hidden state register inside the current time series model. Through this atomic state recovery, the model's cyclic inference base point is pulled back from the damaged, deviated state to the previous confirmed steady-state snapshot. Third, because the model state is rolled back to the past, a temporal misalignment inevitably arises between the feature input sequence corresponding to the current long-term stage unit and subsequent units and the current model state. To allow the model to smoothly transition from this artificial gap, the recovery unit will perform zero-filling on the input feature buffers corresponding to the current and a predetermined number of subsequent units. Zero-filling involves setting every value in a multidimensional feature vector to zero. Since zero values ​​typically represent a neutral, unbiased stimulus in the normalized feature space, this induces the model to gradually readjust to subsequent real feature inputs with minimal oscillations, starting from a rolled-back steady state. Simultaneously, these zero-filled segments are internally labeled with a special artificial tomographic attribute. Based on this label, during a subsequent predetermined number of transition periods—for example, within the length of two consecutive long-term staging units—while the model continues to output specific sleep stage labels to maintain the continuity of the output sequence, each output label is forcibly associated with a low-confidence flag. This flag explicitly indicates to data post-processing workflows or clinical reviewers that the data was generated in the context of a system recovering from a detected model crash, and its absolute reliability should be carefully considered.

[0089] In a further preferred embodiment, the hidden state rollback operation of the aforementioned inference recovery unit no longer relies on a single fixed safe time point. Instead, it achieves more robust historical state selection by working in conjunction with a lightweight management unit. This circular buffer only needs to allocate space in main memory to store a number (e.g., four) of the most recent historical hidden states. During continuous normal system operation, the hidden state of the temporal model at the time of unit completion is formally submitted and pushed to the circular buffer, becoming a double-verified safe checkpoint, only when the inference of a long-term stage unit is completed and its final output sleep stage label simultaneously satisfies both the safe conditions of 'not being identified as high-conflict by the conflict denial sentinel unit' and 'not being detected as a violation by the independent physiological violation detector'. When the multimodal evidence arbitrator finally determines that a state rollback is required to repair the model crash, the recovery unit will preferentially read the most recently stored valid safe checkpoint from the circular buffer and use it to overwrite the currently contaminated or deviated model hidden state. This state management based on transaction log thinking ensures that the backtracking target is a reliable steady state, rather than the zero initial point at the time of cold start, thus significantly shortening the restabilization time after model recovery. In constructing the multimodal evidence arbitrator, to improve the determinism of arbitration, in a specific implementation example, the accelerometer continuously calculates and updates an activity register. The value of this register reflects the integral intensity or maximum change amplitude of the triaxial composite acceleration exceeding the nominal gravity over the current and a short past period. When the independent physiological violation detector triggers a direct jump warning between deep sleep and wakefulness, the evidence arbitrator immediately reads the value of this register and compares it with a wakefulness motion threshold θ that has been calibrated offline and embedded in the firmware. snore Perform a precise comparison. This threshold θ snore The calibration process can be determined during the product development phase by analyzing the minimum energy characteristics of the accelerometer signal during a real physiological arousal event using synchronous polysomnography test data in a standard sleep laboratory. Only when the measured activity level exceeds this clinically calibrated threshold does the arbitrator confirm that there is objective physical evidence supporting the physiological authenticity of the arousal. This transforms subjective, empirical rules into data-driven, quantifiable, and auditable objective decision-making criteria.

[0090] Compared to Implementation Method 1, this implementation method, through the additional deployment of a conflict rejection sentinel unit and an inference recovery unit, fundamentally improves the original system's independent reliability verification capability and autonomous fault recovery capability in the face of extreme signal impacts in an extremely lightweight manner that closely adheres to the limitations of microcontroller hardware. The conflict rejection sentinel unit, through fully deterministic bit operations and flash lookup tables, honestly and transparently identifies logically abnormal periods in the model output sequence at the cost of microsecond-level latency and zero memory overhead, avoiding the continuous fabrication of smooth but erroneous staging results. The inference recovery unit borrows the checkpoint and rollback concepts from database transactions and innovatively introduces multimodal acceleration evidence for objective arbitration, thereby accurately distinguishing between the user's genuine physiological arousal and the model's spurious collapse. At the cost of minimal state backup, it achieves rapid and stable self-healing of the inference system from catastrophic contamination. Together, they constitute a hard logic-driven output safety valve independent of the complex deep learning model, resulting in a qualitative improvement in the clinical usability and long-term operational robustness of the entire sleep staging system under unpredictable and harsh daily operating conditions.

[0091] Implementation Method 3 In the technical solution provided in Implementation Method 1, a multimodal sleep staging framework based on signal quality-driven adaptive feature fusion and cross-timescale temporal modeling has been established, running robustly on a microcontroller platform. This framework acquires frontal EEG, heart rate, and acceleration signals through an acquisition module. After preprocessing and time window segmentation, the feature determination module dynamically adjusts the feature combination, and the staging module outputs four standard sleep stages. It is this compact implementation of the entire algorithm closed loop on a single microcontroller that frees the sleep monitoring device from dependence on external computing nodes, achieving scene continuity. However, when considering a battery-powered, micro-wearable device that needs to operate continuously for several nights, this framework may still have some secondary problems at the physical hardware level regarding energy consumption and data flow real-time performance. In harsh operating conditions where EEG signals deteriorate over a long period, this problem requires further improvement and resolution.

[0092] In Implementation Method 1, all sensors and their analog front-end circuitry are continuously powered on throughout the device's operation. Even when the wearer lies on their side, causing continuous pressure on the forehead electrodes and resulting in low signal-to-noise ratio (SNR) EEG signals unusable for reliable staging, the analog front-end, analog-to-digital converter, and subsequent data transfer and feature extraction processing chain of the EEG acquisition channel continue to consume significant dynamic current. This acquired low-quality data continuously floods into the main analysis buffer in static random access memory (SRAM) via the direct memory access controller (DRAM) source, occupying valuable kilobytes of memory space and straining system bus bandwidth. This forces the processor to spend additional cycles processing or labeling this worthless data. This "indiscriminate, all-time, all-channel power supply and data transfer" strategy is acceptable when the signal is good, but when the signal fails, it essentially results in a large amount of wasted system power consumption and memory resources, significantly shortening the device's actual usable battery life. Furthermore, the high-noise data stream continuously injected into the subsequent algorithm chain itself constitutes an additional processing burden.

[0093] In view of this, this embodiment makes further improvements to the technical solution of Embodiment 1. The main improvements are as follows: See Figure 3 As shown, a hardware power gating subsystem was added, closely linked to the signal quality assessment logic in the feature determination module. Simultaneously, within the acquisition module, a double-buffered direct memory access ping-pong transmission mechanism was introduced for the multimodal data stream. The hardware power gating subsystem aims to implement precise "hard sleep" for continuously deteriorating signal sources at the physical level and possesses an autonomous "hiccup-like" probe self-healing capability without external intervention, thus cutting off unnecessary power consumption and data contamination at the source. The double-buffered ping-pong transmission mechanism aims to achieve strict parallel pipelined operation of signal acquisition and upper-layer processing in the time dimension from the data link layer, eliminating data waiting delays and ensuring zero loss of continuous signals. These two improvements allow the system's energy efficiency and real-time performance to be rooted from the algorithm layer down to the physical and link layers, forming a comprehensive complement to the hardware operating efficiency of Implementation Method 1.

[0094] Specifically, regarding the internal structure and workflow of the hardware power gating subsystem, its core consists of a closed loop comprised of a resident unsupervised quality sentinel unit, an actuator responsible for physical power-off, a direct memory access remapping logic configured for data stream bypass, and a self-healing hiccup probe independent of the main processor. The unsupervised quality sentinel unit is an extremely lightweight, continuous signal quality assessment logic, unlike the complex signal quality function SQI(t) used to drive feature path selection in Implementation 1. This sentinel unit extracts only two inexpensive basic feature metrics from the raw sampled values ​​of the EEG signal: zero-crossing rate and short-time variance. The zero-crossing rate is calculated by counting the number of symbol changes between adjacent sampling points within a given time window, used to quickly identify whether the channel exhibits saturation noise or silent DC levels due to complete electrode detachment. The variance is updated in real-time using a simple formula: the sum of squares of samples within a sliding window minus the square of the mean, used to capture sudden energy anomalies in the signal introduced by mechanical vibration or unstable electrode contact. The calculation of these two metrics involves only simple integer addition, subtraction, and comparison operations, without any floating-point operations. Therefore, they can be deployed in the analog-to-digital converter interrupt service routine to execute synchronously with data sampling at very low cost, achieving continuous evaluation on a second-by-second basis.

[0095] When the unsupervised quality sentinel unit detects that the zero-crossing rate and variance of the EEG signal continuously fall outside a preset normal range for a predetermined time period, such as 10 seconds, it determines that the EEG signal quality has entered an unacceptably persistent state of collapse. Once this criterion is met, the sentinel unit will send a sleep trigger signal to the actuator. In one specific implementation of the actuator, a general-purpose input / output pin of the microcontroller is directly connected to the enable control terminal of the low-dropout linear regulator powering the EEG analog front-end. Upon receiving the sleep trigger signal, the level of this general-purpose input / output pin is pulled low, thereby physically disconnecting the power rail supplying the EEG sensor and its signal conditioning circuitry. This action cuts off most of the current consumption required by the EEG analog front-end, amplifier, and driving analog-to-digital converter at the source, which can account for 25% to 30% of the total system power consumption in a typical front-end design. At the same time, the sentinel unit does not only cut off the power supply, but also performs a critical data stream bypass operation. It can modify the target address register corresponding to the EEG data channel in the direct memory access controller to remap the automatic data transfer destination of that channel from the normal main analysis buffer to a pre-allocated, very small (e.g., 32-byte) discarded first-in-first-out circular buffer in memory. In this configuration, even if other channels of the analog-to-digital converter continue to operate, any subsequent EEG noise data converted to digital values ​​will still be transferred by the direct memory access controller at the original rate, but it will be written to this small, self-overwriting discarded space. This avoids significant invalidation of the main analysis buffer and congestion of bus bandwidth, allowing the processor to efficiently retrieve clean data from only the heart rate and acceleration buffers in low-power mode, maintaining a fall-resistant, lightweight phased-out mode that relies solely on heart rate and acceleration.

[0096] However, this radical strategy of complete power-off introduces a new technical challenge: once the EEG front end is physically de-energized, the system completely loses its ability to sense the recovery of EEG signal quality, becoming a "blinding" system. If the user readjusts the wearing posture to restore normal electrode contact, the device may remain permanently in low-power anti-fall mode because it cannot actively sense this, which is clearly unacceptable.

[0097] To resolve this "power outage blindness" deadlock, this subsystem integrates an autonomous timed wake-up mechanism called the "self-healing hiccup probe." Simultaneously with the power outage to the EEG front-end, the unsupervised quality sentinel unit initiates a hardware timer independent of the main processor, such as a standby real-time clock alarm or a low-power timer, and sets the trigger interval for the first wake-up probe, for example, 30 seconds. The main processor can then enter deep sleep mode to further conserve power. When the timer reaches the preset time, it wakes the system via an interrupt. The self-healing probe logic then intervenes, first briefly raising the EEG power enable pin via a general-purpose input / output pin, providing a fixed timing window for the initial power-on phase. In this example, a 500-millisecond power-on window, the analog front-end circuit needs time to recover from its setup transients. Therefore, the unsupervised quality sentinel unit consciously discards all acquired data during the first 400 milliseconds of this 500-millisecond window; this period, known as the cold-start shielding period, aims to avoid interference from ringing voltage fluctuations that may occur during power-on and circuit stabilization. Subsequently, the sentinel unit only collects and analyzes the steady-state EEG data of the last 100 milliseconds of the window, and recalculates the zero-crossing rate and variance.

[0098] If the verification results show that both indicators have returned to the normal range, the sentinel unit determines that the EEG signal quality has been restored. At this time, it will perform two actions: first, maintain the general-purpose input / output pins at a high level to permanently restore power to the EEG front end; second, modify the target address register of the direct memory access controller again to remap the target of the EEG data stream back to the main analysis buffer. The system then smoothly switches from the fall protection mode back to the full-modality high-precision staging mode described in Implementation Method 1, without any external intervention. Conversely, if the verification results are still unsatisfactory, the sentinel unit determines that the signal has not yet been restored and immediately executes an exponential backoff strategy. It will pull the general-purpose input / output pins low again to cut off the EEG power and set the interval for the next wake-up for the real-time clock alarm based on an exponential backoff algorithm. As an example, the backoff sequence could be: the second wake-up interval extended to 2 minutes, the third to 5 minutes, the fourth to 15 minutes, and an upper limit could be set for the maximum interval, such as 15 minutes. This allows the system to reduce the average probe power consumption to the nanoampere level when the signal deteriorates over a long period of time. At the same time, it ensures that after the user readjusts the wearing method, in the worst case, it can automatically restore full functionality after only waiting for a maximum value interval, thus solving the engineering deadlock of "power outage blindness" once and for all.

[0099] In addition to the aforementioned improvements in physical power consumption, this embodiment also significantly improves the real-time performance and zero-loss reliability of the data stream by implementing double-buffered direct memory access ping-pong transmission on the data link of the acquisition module. In Embodiment 1, the acquisition module directly writes data to the buffer, while the partitioning module may need to wait until the buffer is filled to a certain size before it can start reading, resulting in potential timing coupling and waiting between the two. To avoid this waiting and ensure seamless acquisition of continuous signals on the microcontroller platform, the acquisition module in this embodiment is configured to include a first buffer and a second buffer, both of the same size in memory and pre-allocated. The direct memory access controller is configured in cyclic ping-pong mode, and its workflow is as follows: First, the continuously sampled data from the analog-to-digital conversion is automatically written to the first buffer. When the first buffer is precisely filled (e.g., filled with 5 seconds of data), the direct memory access controller generates a transmission completion interrupt and immediately switches its write target address in the interrupt service routine, starting to seamlessly transfer subsequent sampled data into the second buffer. The entire process does not require any word-by-word data movement by the processor. Simultaneously with the switchover, a semaphore or event flag is triggered, notifying the partitioning module that it can now safely read the complete data from the already full first buffer and perform its 5-second short-term sub-window partitioning and overlapping organization operations. Meanwhile, acquisition continues in parallel within the second buffer, without interference. When the second buffer is full, the direct memory access controller switches back to the first buffer to overwrite the old data and similarly notifies the partitioning module to process the data in the second buffer. This process repeats, forming a strictly parallel pipeline where acquisition and processing do not overlap. This mechanism eliminates potential data overflow caused by uncertain processing times, minimizes overall system latency, and ensures end-to-end real-time performance from sensor to sleep staging tag output, providing a solid, high-quality, uninterrupted data stream foundation for complex time-series feature extraction and model inference.

[0100] Overall, compared to Implementation Method 1, this implementation method achieves a significant leap in system performance across two fundamental dimensions—physical power consumption and real-time data flow—through the synergistic improvement of a hardware power gating subsystem and dual-buffered direct memory access ping-pong transmission. The former, through a closed loop of "sentinel detection—physical power shutdown—data flow bypass—exponential backoff hiccup probe self-healing," creatively transforms algorithm-based signal quality assessment results directly into hardware-level power scheduling commands and data routing strategies, eliminating unnecessary power consumption and memory waste while endowing the device with autonomous recovery capabilities in the dark. The latter, through a dual-buffered hard-pipeline design, perfectly decouples the rate dependence of acquisition and processing, providing a zero-loss, low-latency data foundation for the entire upper-layer algorithm chain. The combination of these two features enables a micro-battery-powered microcontroller sleep monitoring terminal to exhibit first-class battery life resilience, autonomous operation continuity, and real-time completeness of data acquisition under various extreme wearing and signal conditions.

[0101] To further optimize the energy efficiency and response speed of the hiccup probe mechanism under real-world conditions, in a more specific embodiment, the wake-up interval of the timer is not fixed but dynamically adjusted using an exponential backoff algorithm with state memory. This algorithm maintains a consecutive failure counter in the microcontroller's memory to record the total number of consecutive failures since the last successful signal quality check. Let the base wake-up interval be T0 (e.g., 30 seconds). After the first check fails, the next wake-up interval is set to T0. If the number of consecutive failures is N (N≥2), the next wake-up interval can be set as the product of T0 and 2 raised to the power of N-1, and a maximum wake-up interval upper limit T is set. max (For example, 15 minutes) to prevent the system from failing to recover in time due to excessively long probe intervals when the signal is permanently lost. Once a probe verification is successful, the consecutive failure counter is immediately reset to zero, ensuring that the system can initiate a rapid self-healing attempt again with the shortest interval when the signal deteriorates again. This design allows the system to reduce the average probe power consumption to the nanoampere level during hours of long-term signal deterioration, while ensuring that it can maintain a maximum power consumption of at most 1 terawatt during instantaneous signal recovery. maxWithin a short delay, the system quickly resynchronizes to full-function mode, achieving a fine dynamic balance between power consumption and response speed. In another embodiment that works in conjunction with the aforementioned hardware hibernation, to completely resolve the issue that invalid data continuously generated by the power-off EEG channel in fall protection mode may still occupy memory bus resources through the direct memory access channel, this system employs a memory traffic bypass strategy. Specifically, when the unsupervised quality sentinel unit triggers a power outage at the EEG front end, it does not simply discard the data. Instead, it actively configures the direct memory access controller to dynamically remap the target address of the EEG data channel, which originally pointed to the main analysis buffer, to a pre-allocated, minimally sized (e.g., 32-byte) abandoned circular buffer in memory. Under this configuration, although the EEG noise data generated by the analog-to-digital converter is still transported by the direct memory access controller at the original rate, it is written to an independent space that immediately self-overwrites, thus completely freeing up the valuable space of the main analysis buffer and system bus bandwidth. The main processor only needs to efficiently read clean data from the regular buffers of the heart rate and acceleration channels to maintain the basic staging capability in fall protection mode with minimal effort.

[0102] Implementation Method 4 In the system provided in Implementation 1, the feature determination module performs a set of explicit, pre-defined, handcrafted feature extraction procedures based on sleep physiology knowledge by human experts in the field for each short-term sub-window of EEG signals. These features encompass statistics of EEG signals in the frequency domain (e.g., δ, θ, α, β band energy) and time domain (e.g., root mean square value, variance, zero crossover rate), effectively describing the macroscopic rhythmic characteristics of the signal within a specific time period. Implementation 1, based on these handcrafted features and driven by the signal quality function SQI(t), dynamically combines them with heart rate and acceleration features, and has proven to provide robust input for lightweight time-series models. However, the completeness of this handcrafted feature set based on pre-defined mathematical formulas is inevitably limited by existing human understanding of complex EEG patterns. Sleep EEG contains a large number of diagnostically significant transient graphical patterns, such as sleep spindle waves and K-complexes appearing as brief pulses. Their waveform morphology, duration, and contextual relationship are often more important than their average energy within a fixed frequency band. When extracting these microstructures, handcrafted features are often limited by their fixed integral windows and linear transformations, making it difficult to flexibly capture such nonlinear and highly morphological local temporal structures.

[0103] In view of this, this embodiment further improves the technical solution of Embodiment 1. The main improvement is as follows: (See below) Figure 4As shown, a lightweight convolutional neural network embedding model is introduced to replace the original manual EEG feature extraction branch. This network autonomously learns from the original EEG waveform and generates a low-dimensional embedding vector containing rich temporal structure information, denoted as . This enhances the feature front-end's ability to perceive the micro-patterns and nonlinear dynamics of signals, while reducing the feature dimension input to subsequent time-series models and alleviating computational burden.

[0104] Specifically, regarding the internal structure of the lightweight convolutional neural network embedding model, it can be designed as a feedforward convolutional network with extremely minimal parameters, facilitating operation on the same microcontroller on which the remainder of Implementation Method 1 is deployed, without requiring additional hardware acceleration units. The network directly takes as input a raw EEG sampling sequence within a single 5-second short sub-window. Assuming the EEG sampling rate remains at 250 Hz, this input is a one-dimensional time-series vector of length 1250. The first layer of the network is a one-dimensional convolutional layer configured with 16 convolutional kernels, each 1x7 in size (7 sampling points wide in a single time channel), and performs sliding convolution along the time axis with a stride of 2. The role of this layer is to initially detect various local slopes, curvatures, and edges—basic waveform atoms—from the raw waveform. Subsequently, a second one-dimensional convolutional layer is stacked on top, configured with 32 convolutional kernels, also 1x7 in size, with a stride of 2. This layer is responsible for combining these lower-level atoms into more complex local pattern patterns with specific physiological meanings, such as the combination of the rising and falling edges of a spindle wave. The output of each convolutional layer is nonlinearly mapped through a modified linear unit activation function to give the network expressive power beyond linear transformations.

[0105] Following the second convolutional layer, a non-overlapping max-pooling layer is implemented with a 1x4 pooling window, meaning it takes the maximum value every four points along the time dimension as the output, with a stride of 4. The purpose of this pooling layer is to downsample the feature map along the time dimension, reducing the computational cost of subsequent processing and imparting a degree of local time translation invariance to the feature representation. The pooled 32-channel feature map is flattened into a one-dimensional vector and then input into a fully connected layer. The number of output neurons in this fully connected layer is precisely set to the dimension of the embedding space; in this example, the embedding dimension is set to 32, and its output vector is the desired low-dimensional embedding representation. These 32 values ​​are no longer any single indicator with explicit physical meaning, but a highly compressed comprehensive code that contains all the discriminative time-frequency and waveform patterns in the 5-second EEG segment that are useful for sleep staging.

[0106] The total number of parameters in this lightweight embedding network can be controlled to within a few thousand bytes, making it perfectly suitable for storage in the on-chip flash memory of a microcontroller. Furthermore, a single forward inference process involves only a finite number of multiply-accumulate and comparison operations, with a time overhead far less than the length of the 5-second sub-window itself, enabling real-time window-by-window embedding generation. Before offline deployment, the network can be pre-trained using a large-scale EEG dataset with sleep staging expert annotations. During training, it can be connected to a classifier that is identical to or simpler than the target time-series model, and supervised learning is performed using the cross-entropy loss function to ensure the generated embeddings are optimized. It can retain information that is useful for downstream phased tasks to the greatest extent.

[0107] When this lightweight embedded network is integrated into the feature determination module of Implementation Method 1, it can directly replace the original manual EEG feature extraction process. In each sub-window, the feature determination module feeds the raw EEG data of that window into the network, and after forward computation, obtains a 32-dimensional feature. A vector. This vector is then fed into the dynamic combination mechanism driven by the signal quality function SQI(t) in Implementation 1. For example, when using a continuous weighted modulation strategy, the overall feature weights of the EEG portion. It will directly affect the On each element of the vector, that is, multiply it by Then, it is concatenated with the heart rate feature vector and acceleration feature vector, which have been adjusted for their respective weights, to form the fusion feature of the final input time series model. When using a discrete path selection strategy, when SQI(t) is higher than a preset threshold, the system selects the path with the mean value of SQI(t). In the primary path, manual heart rate and acceleration features may be completely ignored or incorporated with very low weight; conversely, when SQI(t) is below or equal to the threshold, the system reverts to the secondary path, which is dominated by manual heart rate and acceleration features. The vector is completely suppressed.

[0108] Compared to Implementation Method 1, this implementation method replaces the basic unit of EEG feature extraction, transforming the driving force of feature construction from explicitly defined human rules to task-oriented automatic optimization driven by the data itself. This end-to-end feature learning approach enables the feature determination module to autonomously mine and encode waveform microstructures that are highly important for sleep stages but difficult to express with simple formulas. Therefore, under the condition that the quality of EEG signals is acceptable, it can further improve the classification accuracy and convergence stability of subsequent time series models with lower feature dimensions and stronger representation capabilities. At the same time, since the embedding dimension (32) is much lower than the total dimension of traditional handmade features plus embedding, this further reduces the burden on the number of parameters and computational load of subsequent lightweight time series models.

[0109] Implementation Method 5 In the system constructed in Implementation Method 1, conventional preprocessing techniques such as bandpass filtering and power frequency notch filtering have been applied to the continuous raw EEG signals to remove stable linear noise. However, in real-world wearing environments, EEG signals may frequently suffer from sudden, non-stationary transient interferences, such as motion artifacts caused by the momentary slippage between the electrodes and skin when the wearer turns over, electromyographic spikes caused by tooth friction or neck muscle contraction, and signal saturation or disconnection due to momentary electrode loosening. These transient interferences are usually extremely short-lived, possibly affecting only a small portion within a 5-second sub-window, but their energy is enormous enough to severely distort the handcrafted feature statistics and deep learning embedding representation of that window, causing the features of a sub-window that was originally of acceptable overall quality to be completely distorted. The signal quality function SQI(t) based on whole-window calculation in Implementation Method 1, because it uses statistics for macroscopic evaluation, is not sensitive enough to these sub-window-level transient perturbations and may not be able to effectively distinguish them from persistent low-quality states.

[0110] In view of this, this embodiment further improves the signal preprocessing stage in Embodiment 1. See also Figure 5 As shown, the main improvement lies in embedding a real-time artifact detection and labeling module based on a fine-grained sliding window into the signal processing chain after signal filtering and before feature extraction. This module scans the signal second by second at a time scale of sub-windows much smaller than 5 seconds, aiming to accurately identify and locate the aforementioned sudden artifact events, and converts the detection results into labeling signals that have a direct control effect on downstream feature extraction, thereby preventing damaged local signal fragments from distorting the feature representation of the entire sub-window.

[0111] The working mechanism of the real-time artifact detection and labeling module can be described in detail below. The module maintains a sliding analysis window of 1 second in length, advancing 0.5 seconds each time, over the continuous signal stream. For each 1-second window, the artifact detector performs three independent anomaly criterion evaluations in parallel. The first criterion is the slope anomaly detector. It calculates the first-order difference of the EEG signal sequence within the 1-second window, i.e., the absolute value of the voltage difference between adjacent sampling points, and then averages these absolute differences. If this average value exceeds a preset slope threshold, such as 20 microvolts per sampling point, it indicates that the signal has experienced a sharp jump that does not conform to the normal EEG rhythm within that local interval, which is usually characteristic of motion artifacts or electrostatic discharge interference. The second criterion is the instantaneous amplitude anomaly detector. It directly searches for the absolute maximum value of the EEG signal within the 1-second window. If this maximum value exceeds a preset amplitude threshold, such as 150 microvolts, it indicates that the signal has experienced severe saturation or electrode contact breakage at this point, deviating from the normal EEG signal amplitude range. The third criterion is the frequency band energy distribution anomaly detector. It performs a Fast Fourier Transform on the data within the 1-second window and calculates the ratio of the total energy in a specific high-frequency band, such as 32 Hz to 45 Hz, to the total energy in a specific low-frequency band, such as 0.5 Hz to 4 Hz. If this ratio exceeds a preset distribution threshold, such as 2.0, it indicates that the energy of high-frequency EMG noise within that window has significantly outpaced the energy of physiological EEG slow waves, which is a typical spectral characteristic of EMG interference.

[0112] Once any of the three criteria mentioned above is triggered, the signal segment covered by the center point of the 1-second sliding window is identified as an artifact segment and assigned a binary artifact marker. These artifact markers, generated continuously at 0.5-second intervals, are filled in real-time into a marker buffer precisely aligned with the original signal timeline. After the signal is segmented into 5-second sub-windows by the segmentation module, the artifact analyzer queries the markers of all sliding windows that overlap with the time range of that sub-window. An exemplary decision logic is that if more than 30% of the 1-second sliding windows within a 5-second sub-window are marked as artifacts, then the entire sub-window is determined to be an unreliable sub-window.

[0113] For sub-windows deemed unreliable, the feature determination module can employ a pre-defined forced suppression strategy. As a direct implementation, this can be achieved by analyzing the EEG component of the sub-window within the signal quality function. The value of (t) is forcibly rewritten to 0. Based on the continuously weighted modulation or discrete path selection logic established in Implementation Method 1, when... When (t) is set to 0, regardless of the quality of other modalities, EEG features will be completely suppressed. The system will automatically and smoothly degenerate into an operating mode that relies solely on heart rate and acceleration features, thus completely isolating the impact of this segment of poor-quality data on subsequent temporal model inference. Another equivalent implementation is to set all elements of the entire EEG feature vector (whether hand-crafted or embedded) corresponding to the unreliable sub-window to zero after feature extraction. This also neutralizes the input and prevents the model from being severely impacted by outliers.

[0114] Compared to Implementation Method 1, this implementation significantly enhances the system's ability to perceive and respond quickly to transient interference that is brief, sudden, but has extremely high energy. This is achieved by adding a real-time artifact detection and labeling module that operates at sub-window temporal resolution, independent of macroscopic signal quality assessment. It fills the blind spot in Implementation Method 1 where SQI(t) is insufficient in perceiving local temporal contamination within the window. This allows the triggering sources of the adaptive feature dynamic adjustment mechanism to include not only continuous overall signal degradation but also instantaneous local shocks that may distort the features of individual sub-windows. This dual-layer quality monitoring mechanism—the macroscopic continuous SQI(t) and the microscopic discrete artifact labeling—works together to achieve full-coverage input signal health checks on a time scale, further improving the robustness of the staging results in extremely unpredictable real-world environments.

[0115] Implementation Method Six In the hardware power gating subsystem disclosed in Implementation Method 3, an autonomous timed wake-up mechanism centered on a self-healing hiccup probe has been constructed. After the EEG front-end is physically powered off, this mechanism starts a timer independent of the main processor, periodically and briefly powering on the device at preset time intervals. It then briefly collects steady-state data for signal quality verification and automatically deactivates the hibernation mode upon successful verification, restoring full-modal high-precision staging. This scheme achieves deep energy saving at the system level by maintaining the physical power off the EEG simulation front-end for the vast majority of the time. Simultaneously, the periodic probe endows the system with the ability to autonomously sense signal recovery and perform self-healing, successfully solving the technical problem of "power outage-induced blindness." However, within this self-healing closed loop, two technical details affecting its engineering robustness and energy efficiency limits still require further strengthening and refinement. The first detail is that during the brief power-on moment, the analog front-end circuit does not immediately enter a steady state but undergoes a physical transition process consisting of power establishment, amplifier bias stabilization, and AC coupling capacitor charging. The output voltage signal during this stage typically contains significant setup ringing and bias drift. If the quality sentinel analyzes the signal during this unstable period indiscriminately, it is very easy to misjudge the high variance of ringing as "signal recovery," thus triggering an incorrect sleep termination. The second detail is that if a fixed period is used for the timed wake-up interval, too many unnecessary verification actions will be performed in scenarios where the signal has been continuously deteriorating for a long time, causing an unnecessary increase in average power consumption; while if the interval is set too long, it may cause the system to react slowly when the signal recovers rapidly by chance, resulting in the loss of valuable monitoring time.

[0116] In view of this, this embodiment makes further refined improvements to the self-healing hiccup probe mechanism in Embodiment 3. See also Figure 6 As shown, the main improvements are in two aspects: First, by introducing a cold-start shielding period with strict timing boundaries and a precisely defined steady-state data acquisition window, the data acquisition process after wake-up is divided into two strictly separated stages: "discarding" and "acquiring," thereby ensuring that only signals truly representing the circuit's steady state are used for quality verification. Second, by introducing an exponential backoff algorithm with continuous failure counting and automatic zeroing, the timing wake-up interval is dynamically adjusted, allowing it to be gradually extended to suppress average power consumption when the signal continues to deteriorate, and to be immediately reset to quickly restore full functionality when the signal recovers.

[0117] Specifically, regarding the design and operation of the cold start shielding period and steady-state acquisition window, the engineering parameters can be customized based on the engineering understanding of the startup characteristics of typical EEG analog front-end devices. When the hiccup probe is triggered, and the general-purpose input / output pins go high to restore power to the EEG analog front-end, a dedicated hardware microsecond counter is simultaneously started. From this moment, the system enters a fixed-duration cold start shielding period, set for example, 400 milliseconds. This 400-millisecond value is not arbitrarily chosen, but rather based on a comprehensive consideration of the startup timing of common instrumentation amplifiers, programmable gain amplifiers, and analog-to-digital converter combinations. This time period is sufficient to cover most of the setup time for the low-dropout linear regulator from enable to reaching the target output voltage, sufficient for the internal bias nodes of the multi-stage amplifier link to charge from zero potential to their designed DC operating point, and sufficient for the front-stage AC coupling capacitor to complete its exponential charging process, bringing the voltage difference across it to a quasi-steady state. During this entire 400-millisecond period, although the analog-to-digital converter may have begun outputting digital codes, these codes correspond to unstable, rapidly changing analog voltages. The quality sentinel unit discards all data during this period directly at the hardware level, without sending it to any computation buffer, thus physically eliminating the possibility of starting transient data into the evaluation process.

[0118] The end of the cold start shielding period signifies that the analog front-end has entered a stable state. At this point, a precisely defined steady-state data acquisition window is immediately opened. The length of this window is set to, for example, 100 milliseconds. At a sampling rate of 250 Hz, these 100 milliseconds are just enough to acquire 25 new EEG sampling points. The choice of 100 milliseconds is a trade-off between ensuring statistical significance of the samples and minimizing additional power-on time. The short sequence of 25 sampling points is sufficient for the quality sentinel unit to reliably calculate its zero-crossing rate and short-time variance, which are the core criteria for determining signal quality in Implementation Method 3. The quality sentinel unit uses only the clean steady-state data acquired within these 100 milliseconds as input to perform its quality assessment. If the assessment result meets the criteria, the signal is determined to have recovered, and the complete wake-up process is executed; if the assessment result still does not meet the criteria, the signal is determined to be continuously deteriorating, and the general purpose input / output pin is pulled low again to power off, and the next sleep cycle begins.

[0119] To determine the next probe wake-up time, an exponential backoff algorithm is employed. This algorithm maintains a simple consecutive failure counter in memory, recording the number of consecutive failures in probe verification since the last successful recovery. Let the base initial wake-up interval be 30 seconds. When the consecutive failure count reaches 1 (i.e., the first verification failure), the next wake-up interval remains 30 seconds. When the consecutive failure count reaches 2, the wake-up interval is doubled to 60 seconds, and so on. A more general doubling rule is that the next wake-up interval can be set to the smaller of the base interval and twice the previous interval, or by multiplying the previous interval by a multiplication factor. As an example, the multiplication factor could be 2, with a hard maximum limit of 15 minutes. Thus, the generated backoff sequence will follow a typical trajectory: after the first failure, a 30-second period is set; after the second failure, the period jumps to 60 seconds; the third is 120 seconds (2 minutes); the fourth is 240 seconds (4 minutes); the fifth is 480 seconds (8 minutes); and the sixth reaches the upper limit of 900 seconds (15 minutes). After that, it will be woken up every 15 minutes until a certain successful review is achieved.

[0120] When the probe finally acquires a qualified EEG signal within the steady-state acquisition window of a wake-up, it means the signal has been restored. At this point, the quality sentinel unit not only performs the routine wake-up operations of restoring power supply and direct memory access addresses as described in Implementation Method 3, but it also performs a crucial additional action: immediately resetting the consecutive failure counter in the exponential backoff algorithm to zero. This ensures that the next time (if unfortunately the signal deteriorates again and triggers hibernation again), it will start from scratch with intensive autonomous rescue attempts at the shortest possible 30-second probe interval, rather than starting from a historically inherited large interval, thus guaranteeing that the system's response speed to signal recovery is always at its fastest achievable level.

[0121] Compared to the relatively general description of the hiccup probe in Implementation Method 3, this implementation method, through precise time division of the cold start shielding period and steady-state acquisition window, eliminates the only potential source of interference to the accuracy of quality assessment caused by the transient establishment of the analog circuit, thus achieving the highest level of reliability for self-healing decisions that can be guaranteed at the hardware level. Simultaneously, by introducing an exponential backoff algorithm with state memory and a zeroing mechanism, this implementation method enables the system to achieve a fine and dynamic autonomous trade-off between the severe energy consumption scenario of long-term signal deterioration and the high-quality timeliness scenario of rapid signal recovery. During the period when EEG signals are unavailable for several hours, the average power consumption of the probe is compressed to a near-zero level due to the exponential expansion of the interval; and once the signal recovers at any moment, the zeroing mechanism ensures that the system can complete self-healing within a delay of up to the maximum upper limit, or as quickly as 30 seconds, thereby simultaneously approaching the optimal solution in the contradictory directions of power consumption limits and functional continuity.

[0122] Finally, it should be noted that those skilled in the art will understand that many technical details have been presented in the embodiments of this patent to facilitate a better understanding of the invention. However, even without these technical details and various variations and modifications based on the above embodiments, the technical solutions claimed in the claims of this patent can be substantially achieved. Therefore, in practical applications, various changes can be made to the above embodiments in form and detail without departing from the spirit and scope of this patent.

Claims

1. A multimodal sleep staging method, characterized in that, include: Collect multimodal physiological signals, including at least electroencephalogram (EEG) signals; The multimodal physiological signal is divided into multiple short-term sub-windows that overlap in time, and multiple consecutive short-term sub-windows are organized into a long-term phase unit. For each short-term sub-window, based on the value of a continuously normalized signal quality function, a modal feature combination for that short-term sub-window is determined, and features corresponding to the modal feature combination are extracted from the multimodal physiological signal. The features extracted from each short-term sub-window within the same long-term stage unit are arranged in chronological order to form a feature sequence, which is then input into a time series model to obtain the sleep stage results corresponding to the long-term stage unit.

2. The method according to claim 1, characterized in that, The multimodal physiological signals include at least the electroencephalogram (EEG) signal from the frontal region, heart rate signal, and acceleration signal. The signal quality function is a continuous function that sums the weighted values ​​of the EEG signal quality assessment, heart rate signal quality assessment, and acceleration signal quality assessment. The EEG signal quality assessment is obtained by weighting the noise energy ratio, amplitude abnormality factor, and physiological frequency band energy matching degree. The sum of the weighting coefficients in the signal quality function is 1, and the output range of the signal quality function is [0, 1]. The short-time sub-window has a length of 5 seconds, and adjacent short-time sub-windows have 50% overlap. The long-term phase unit has a length of 30 seconds and is formed by aggregating a preset number of consecutive short-term sub-windows. The temporal model is a lightweight temporal convolutional network or a gated recurrent unit network; The sleep staging results include classifications of wakefulness, light sleep, deep sleep, and REM sleep.

3. The method according to claim 1, characterized in that, The determination of the modal feature combination for the short-time sub-window based on the value of a continuously normalized signal quality function includes: Based on the comparison result between the value of the signal quality function and the preset attribute, one of at least two different discrimination paths is selected: When the value of the signal quality function is higher than the preset attribute, the first discrimination path corresponding to the first modality feature combination dominated by EEG features is selected; When the value of the signal quality function is lower than or equal to the preset attribute, the second discrimination path corresponding to the second modal feature combination that integrates heart rate features and acceleration features is selected.

4. The method according to claim 1, characterized in that, The determination of the modal feature combination for the short-time sub-window based on the value of a continuously normalized signal quality function includes: Based on the value of the signal quality function, the EEG features, heart rate features, and acceleration features are continuously weighted to form the modal feature combination; The weighting coefficients corresponding to each modal feature are continuous functions of the value of the signal quality function, such that when the value of the signal quality function increases, the weighting coefficients of the EEG features increase, while the weighting coefficients of the heart rate features and acceleration features decrease.

5. The method according to claim 1, characterized in that, Also includes: The classification results of the time series model for each short-term sub-window are compressed into discrete state words; Obtain the discrete state words corresponding to multiple consecutive short-term sub-windows, and concatenate the multiple consecutive discrete state words into an index address; The timing conflict level is output based on the index address using a pre-established lookup table.

6. The method according to claim 5, characterized in that, The discrete state word is 2-bit encoded; The step of concatenating multiple consecutive discrete state words into an index address includes: concatenating the 2-bit codes of the most recent 6 sub-windows into a 12-bit bitmap in chronological order; The step of outputting the timing conflict level based on the index address through a pre-established lookup table includes: XORing and counting the 2-bit encoding of adjacent windows to map the 12-bit bitmap into a set of 8-bit feature words representing the frequency of state switching and the number of illegal transitions, and directly reading the conflict level fixed in the lookup table using the 8-bit feature words as the address.

7. The method according to claim 5 or 6, characterized in that, When the timing conflict level exceeds a preset threshold, the normal output of the sleep staging results is interrupted, and a system-level label representing signal disorder is forcibly output.

8. The method according to claim 1, characterized in that, Also includes: When a stage jump that violates the predefined sleep stage transition rules is detected in the sleep staging results, the authenticity of the stage jump is arbitrated based on the real-time data of the accelerometer synchronously acquired during the time period corresponding to the judgment that caused the stage jump. If the real-time data from the accelerometer indicates that there is no motion exceeding a preset threshold, then the stage jump is determined to be a non-real physiological event, and the hidden state of the time series model at the previous safe time point is restored from the circular buffer. If the real-time data from the accelerometer indicates that there is movement exceeding the preset threshold, the stage is determined to be a real physiological event, and the output of the current sleep stage result is maintained.

9. The method according to claim 8, characterized in that, The stage jumps that violate the predefined sleep stage transition rules include direct jumps between deep sleep and wakefulness.

10. The method according to claim 8, characterized in that, After restoring the hidden state, the feature buffer is filled with zero values, and the filled section is marked as an artificial tomography. Based on the markers of the artificial tomography, within a preset number of transition periods, the sleep staging results output by the time series model for the long-term staging units within the transition period are associated with a low-confidence identifier.

11. A multimodal sleep staging system, characterized in that, include: The acquisition module is used to acquire multimodal physiological signals, including at least electroencephalogram (EEG) signals. The segmentation module is used to divide the multimodal physiological signal into multiple short-term sub-windows that overlap in time, and to organize multiple consecutive short-term sub-windows into a long-term segmentation unit. The feature determination module is used to determine the modal feature combination for each short-term sub-window based on the value of a continuously normalized signal quality function, and to extract the features corresponding to the modal feature combination from the multimodal physiological signal. The staging module is used to construct a feature sequence from the features of each short-term sub-window extracted within the same long-term staging unit in chronological order, input it into the time series model, and obtain the sleep staging result corresponding to the long-term staging unit.

12. The system according to claim 11, characterized in that, The continuous normalized signal quality function is a continuous function that sums the weighted values ​​of the EEG signal quality assessment, heart rate signal quality assessment, and acceleration signal quality assessment. The EEG signal quality assessment is obtained by weighting the noise energy ratio, amplitude abnormality factor, and physiological frequency band energy matching degree. The multimodal physiological signals include at least the electroencephalogram (EEG) signal from the frontal region, heart rate signal, and acceleration signal. The short-time sub-window has a length of 5 seconds, and adjacent short-time sub-windows have 50% overlap. The long-term phase unit has a length of 30 seconds and is formed by aggregating a preset number of consecutive short-term sub-windows. The temporal model is a lightweight temporal convolutional network or a gated recurrent unit network; The sleep staging results include classifications of wakefulness, light sleep, deep sleep, and REM sleep.

13. The system according to claim 11, characterized in that, It also includes a hardware power gating subsystem, which is configured as follows: When the quality of the EEG signal is consistently below a threshold, the connection between the EEG sensor and the power supply is physically disconnected, and the target address corresponding to the EEG sensor in the direct memory access channel is remapped to a preset discard buffer, so that the system enters a low-power mode that only relies on heart rate and acceleration signals. After entering the low-power mode, a timer independent of the main processor is started to periodically and briefly close the connection at progressively increasing time intervals to verify the signal quality of the EEG sensor. When the verification result indicates that the signal quality has recovered, the low-power mode is deactivated, the connection remains closed, and the target address is restored to the main analysis buffer.

14. The system according to claim 11, characterized in that, It also includes a conflict denial-of-identity sentinel unit, which is used for: Obtain the classification results of the time series model for each short-term sub-window, and compress each classification result into a discrete state word; The discrete state words corresponding to multiple consecutive short-term sub-windows are concatenated to form an index address; Based on a pre-established lookup table, the timing conflict level is output according to the index address.

15. The system according to claim 14, characterized in that, The discrete state word is 2-bit encoded; The conflict denial sentinel unit is further configured to: combine the 2-bit codes of the most recent 6 short-term sub-windows into a 12-bit bitmap in chronological order; map the 12-bit bitmap into a set of 8-bit feature words representing the frequency of state transitions and the number of illegal transitions by XORing and counting the 2-bit codes of adjacent windows; and directly read the conflict level stored in the lookup table using the 8-bit feature words as the address.

16. The system according to claim 14 or 15, characterized in that, The conflict denial sentinel unit is also used to: interrupt the normal output of the sleep staging results and force the output of a system-level label representing signal disorder when the timing conflict level exceeds a preset threshold.

17. The system according to claim 11, characterized in that, It also includes an inference recovery unit, which is used for: When a stage jump that violates the predefined sleep stage transition rules is detected in the sleep staging results, the stage jump is arbitrated based on the real-time data of the accelerometer synchronously acquired during the time period corresponding to the judgment that caused the stage jump. The stage jump that violates the predefined sleep stage transition rules includes a direct jump between deep sleep and wakefulness. If the real-time data from the accelerometer indicates that there is no motion exceeding a preset threshold, then the stage jump is determined to be a non-real physiological event, and the hidden state of the time series model at the previous safe time point is restored from the circular buffer. If the real-time data from the accelerometer indicates that there is motion exceeding the preset threshold, then the stage is determined to be a real physiological event, and the output of the current sleep stage result is maintained. After restoring the hidden state, the feature buffer is filled with zero values ​​and the filled segment is marked as an artificial tomography. Based on the marking of the artificial tomography, within a preset number of transition periods, the sleep staging results output by the time series model for the long-term staging unit within the transition period are associated with a low confidence identifier.

18. The system according to claim 11, characterized in that, The acquisition module includes a first buffer and a second buffer, as well as a direct memory access controller; The direct memory access controller is used to alternately write the real-time sampled data of the multimodal physiological signals into the first buffer and the second buffer; When the first buffer is in a write state, the partitioning module reads the complete data that has been written from the second buffer to perform the partitioning of the short-term sub-window; When the second buffer is in a write state, the partitioning module reads the complete data that has been written from the first buffer to perform the partitioning of the short-term sub-window.

19. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Brain-like algorithm for sleep staging by applying prefrontal lobe single-channel electroencephalogram signals

    CN114081439A