A sleep monitoring and intervention method and system based on electroencephalogram signals

By using deep learning and graph neural network technologies based on electroencephalogram (EEG) signals, combined with wearable devices and closed-loop intervention, the problems of cumbersome equipment and insufficient accuracy in existing sleep monitoring and intervention technologies have been solved, achieving personalized and comfortable sleep intervention effects.

CN121015212BActive Publication Date: 2026-02-06CHANGCHUN UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511556423.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-02-06
Estimated Expiration
2045-10-29

AI Technical Summary

Technical Problem

Existing sleep monitoring and intervention technologies suffer from problems such as cumbersome equipment, insufficient signal quality, and inaccurate staged sleep, making it difficult to achieve comfortable, accurate, and personalized closed-loop sleep intervention.

Method used

Using an EEG-based approach, wearable dry electrodes are used to collect signals. This is combined with a deep learning model for automatic sleep staging. Under specific conditions, transcranial alternating current stimulation is applied. Graph neural networks and Transformer encoders are used to model the topological relationships between signals, identify artifacts in real time, and generate closed-loop intervention signals.

Benefits of technology

It improves the accuracy of sleep stage monitoring and the precision of intervention, enabling personalized and comfortable closed-loop sleep intervention, suitable for long-term use in home and medical settings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121015212B_ABST
    Figure CN121015212B_ABST
Patent Text Reader

Abstract

The application discloses a sleep monitoring and intervention method and system based on electroencephalogram signals and belongs to the technical field of sleep monitoring and intervention. The method comprises the following steps: collecting electroencephalogram signals through dry electrodes worn on the head of a user; pre-processing the signals; automatically performing sleep staging on the pre-processed signals based on a hierarchical spatiotemporal joint modeling network, and outputting wake, N1, N2, N3 and REM period labels; judging whether an intervention condition is met based on the staging labels and real-time electroencephalogram frequency spectrum characteristics; if the intervention condition is met, generating and applying an alternating current stimulation signal to perform intervention. The system comprises a wearable electroencephalogram collection device, a signal analysis module and an intervention module. The application adopts a deep learning model integrating front-end adaptive processing, a graph neural network and a Transformer to perform sleep staging, and on the basis of the sleep staging, realizes the connection from sleep monitoring to closed-loop intervention by combining a closed-loop phase synchronization stimulation driven by a digital phase-locked loop, and effectively improves the accuracy of sleep monitoring and intervention effect.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of sleep monitoring and intervention, and particularly relates to a sleep monitoring and intervention method and system based on electroencephalogram signals. BACKGROUND

[0002] Quality sleep is essential for physical and mental health, and sleep disorders can indicate serious health problems such as hypertension, arrhythmia, narcolepsy, and insomnia. According to statistics, 10%-30% of the population suffers from insomnia. Accurate identification of sleep stages is crucial for diagnosing and treating these disorders. Sleep disorder patients may be at risk of hypertension, heart failure, etc. Polysomnography (PSG) is considered the gold standard for sleep scoring, used to assess typical sleep disorders such as sleep apnea, hypersomnia, and sleepwalking. The R&K standard divides sleep stages into wakefulness (W), rapid eye movement (REM), and non-rapid eye movement (NREM), with NREM further subdivided into S1, S2, S3, S4, or N1, N2, N3, N4. The AASM rule combines N3 and N4 into N3 and divides PSG into 5 sleep stages. The AASM rule is widely used in artificial sleep scoring, which requires experts to analyze the entire night's sleep, a complex and time-consuming process. In contrast, machine learning algorithms can complete sleep scoring in a few minutes, with results comparable to experts, so automatic sleep scoring is very important for healthcare systems.

[0003] Automatic sleep staging methods are mainly divided into traditional machine learning and the popular neural network method in recent years. Traditional machine learning extracts rich information from input signals through different size receptive field feature maps. For example, EEG patterns exhibit different frequency and time characteristics: sleep spindles in the N2 stage appear in the 12-14 Hz range, lasting 0.5 to 2 seconds; while slow wave activity in the N3 stage is in the 0.5-2 Hz range throughout the stage. However, traditional methods struggle to utilize multi-level features that can encompass a broader time scale and frequency range. In addition, existing automatic scoring methods, while addressing the lack of labeled PSG data, pay insufficient attention to the accuracy of the scoring and fail to fully utilize the large amount of annotated PSG data.

[0004] In terms of sleep intervention, research has shown that the brain exhibits characteristic neural oscillation patterns during different sleep stages. In particular, when the system detects that an individual is having difficulty falling asleep or is in a light sleep state, specific mild external stimuli can be applied through a closed-loop system to induce a shift in the brain's neural oscillation activity towards the characteristic patterns of deep sleep, which constitutes the basic principle of electroencephalogram regulation for sleep aid.

[0005] The deficiencies of existing technologies mainly manifest in the following aspects:

[0006] 1. Traditional PSG system: requires a large number of lead electrodes, installation is cumbersome, wearing is not comfortable, and is not suitable for long-term home use;

[0007] 2. Existing wearable EEG device: although it relieves some burden, it is still insufficient in signal quality assurance and automatic identification of artifacts;

[0008] 3. Existing sleep staging model: mostly relies on manual annotation or is not robust in real-world scenarios, making it difficult to accurately distinguish different sleep stages.

[0009] In summary, how to design a closed-loop intervention strategy that can improve sleep quality is a problem that needs to be solved by the technical personnel in the field. SUMMARY

[0010] The technical solution of the present application to solve the above technical problems is to provide a sleep monitoring and intervention method based on electroencephalogram signals, comprising the following steps:

[0011] S1, collecting electroencephalogram signals through dry electrodes worn on the user's head;

[0012] S2, preprocessing the collected electroencephalogram signals, the preprocessing including amplification, band-pass filtering and power frequency notch filtering;

[0013] S3, real-time analysis of the preprocessed electroencephalogram signals, automatic sleep staging based on a deep learning model, and output of a current sleep stage label; the sleep stage label at least includes a wake period, an N1 period, an N2 period, an N3 period and an REM period;

[0014] S4, determining whether a preset intervention trigger condition is met based on the sleep stage label and real-time electroencephalogram frequency spectrum features;

[0015] S5, generating and applying a transcranial alternating current stimulation signal to intervene in the user's sleep when the intervention trigger condition is met.

[0016] Further, the automatic sleep staging based on a deep learning model in step S3 specifically includes:

[0017] S31, dividing the preprocessed electroencephalogram signals into a plurality of data epochs according to a preset time window;

[0018] S32, each data epoch is first passed through a front-end adaptive module (including dynamic segmentation, double-scale convolution and adaptive pooling) to extract its high-quality multi-channel deep features;

[0019] S33, the DG2T-SleepNet is modeled by introducing a graph neural network (GNN) to model the topological relationship between multi-lead signals, and a Transformer encoder is used to capture long-range dependence features across time periods, and finally output sleep stage classification results corresponding to each data epoch.

[0020] Further, step S3 further includes a motion artifact identification step:

[0021] The median and absolute deviation of the median of the amplitude of the electroencephalogram signal of each data epoch are calculated in real time, and the upper and lower threshold values of the amplitude are dynamically set based on this;

[0022] If the amplitude of the electroencephalogram signal of the data epoch exceeds the upper and lower threshold values, further verification is performed in combination with the electrode impedance change information;

[0023] The data epoch confirmed as an artifact after verification is marked as an independent "artifact" category.

[0024] Further, the intervention trigger condition in step S4 includes The judgment of wave prominence includes the following steps:

[0025] S41, calculate the average power of the real-time electroencephalogram signal in the frequency band;

[0026] S42, calculate the average power of the frequency band adjacent to the frequency band;

[0027] S43, calculate the ratio of the frequency band power to the adjacent frequency band power, and convert the ratio to a decibel value;

[0028] S44, if the decibel value exceeds a first preset threshold value, it is determined that the wave is prominent, and the intervention trigger condition is met.

[0029] Further, in step S44, the intervention trigger condition further includes calculating the ratio of the frequency band power to the total power, and if the ratio exceeds a second preset threshold value, it is further confirmed that the intervention trigger condition is met.

[0030] Further, the generation and application of transcranial alternating current stimulation signals in step S5, specifically closed-loop phase-synchronous stimulation, includes the following steps:

[0031] S51, band-pass filtering the preprocessed electroencephalogram signal to extract the neural oscillation signal of the target frequency band;

[0032] S52, performing Hilbert transform on the filtered signal to calculate the instantaneous phase and the instantaneous frequency of the neural oscillation signal;

[0033] S53, calculating a target phase according to the instantaneous phase, the target phase maintaining a preset fixed phase difference with the instantaneous phase of the neural oscillation signal;

[0034] S54, generating a transcranial alternating current stimulation waveform with specific phase and frequency based on the target phase and the instantaneous frequency;

[0035] S55, applying the transcranial alternating current stimulation waveform to the user.

[0036] Further, before step S52, an adaptive filtering step is further included for suppressing artifacts in the electroencephalogram signal caused by the previously applied stimulation.

[0037] Further, the preset fixed phase difference in step S53 is used to compensate for the total time delay generated in the process from signal collection to stimulation application.

[0038] To solve the above technical problems, the present application further provides a sleep monitoring and intervention system based on electroencephalogram signals, comprising:

[0039] A wearable electroencephalogram acquisition device for acquiring electroencephalogram signals of a user, the device comprising a flexible wearing shell and a dry electrode assembly arranged on the inner side thereof;

[0040] A signal processing module connected to the electroencephalogram acquisition device for pre-processing, artifact identification and automatic sleep staging of the acquired electroencephalogram signals;

[0041] A closed-loop intervention module connected to the signal processing module for generating and applying intervention stimulation according to the sleep staging results and electroencephalogram rhythm analysis results;

[0042] The signal processing module is the DG2T-SleepNet model proposed in the present application, which uses a graph neural network (GNN) to model the spatial dependence relationship between multi-channel sleep physiological signals, and combines a Transformer encoder to capture the time dependence, so as to realize accurate classification of sleep stages and output sleep staging results including Wake, N1, N2, N3, and REM categories.

[0043] The closed-loop intervention module comprises A wave saliency detection unit and a digital phase-locked loop (DPLL) unit for generating a transcranial alternating current stimulation (tACS) signal phase-locked with endogenous neural oscillation when wave saliency enhancement is detected. ​

[0044] Furthermore, the dry electrodes of the wearable EEG acquisition device are comb-shaped or dome-shaped silver / silver chloride dry electrodes, and the flexible wearing shell is an arc-shaped flexible structure adapted to the contour of the human head.

[0045] The technical solution of the present invention has the following beneficial effects:

[0046] 1. Enhanced monitoring accuracy and robustness:

[0047] By introducing the proposed DG2T-SleepNet model, which innovatively integrates graph neural networks (GNNs) and Transformer encoders, it can effectively model the spatial topological relationships between signals from multi-channel sleep physiological signals (PSGs) and capture long-range contextual dependencies, thereby significantly improving the accuracy of automatic staging of sleep stages such as N1, N2, N3, REM, and wakefulness in complex real-world scenarios.

[0048] Traditional multi-scale convolutional neural networks (MMCNN) and sliding window structures commonly employ fixed-length signal segmentation strategies. However, this rigid segmentation method, unrelated to dynamic signal changes, has inherent drawbacks: it may forcibly truncate key physiological waveforms (such as K-complexes or sleep spindles) midway, leading to feature fragmentation; simultaneously, fixed window overlap introduces unnecessary information redundancy. Both of these problems disrupt the temporal continuity of local waveforms, thus limiting model performance. This paper integrates an automatic dynamic motion artifact recognition and labeling mechanism. Through joint verification using amplitude statistics and impedance changes, it effectively distinguishes EEG signals from artifacts, labeling artifacts as independent categories to avoid their interference with the segmentation results, further ensuring the system's reliability and robustness in real-world environments such as user movement.

[0049] 2. High level of precision and personalization in intervention:

[0050] Proposed based on Intelligent intervention triggering conditions for wave saliency, through quantitative analysis The power of a frequency band and its ratio to that of adjacent frequency bands and the total power can accurately identify key moments for difficulty falling asleep or maintaining sleep (such as excessively long awake periods or excessive light sleep), providing a scientific and objective basis for initiating intervention.

[0051] The transcranial alternating current stimulation (tACS) technology adopts closed-loop phase synchronization, generates and applies stimulation with fixed phase difference (which can compensate for system delay) by tracking the instantaneous phase of endogenous neural oscillation in real time, and realizes the "phase-locked" stimulation with the brain itself rhythm. The intervention mode of "going with the flow" is more in line with the physiological law, and theoretically can more effectively guide the neural oscillation to the desired sleep mode (such as slow wave activity), thereby improving the effectiveness and safety of the intervention, and realizing the truly personalized precise sleep aid.

[0052] In summary, the present application realizes precise, comfortable and personalized closed-loop sleep intervention on the basis of ensuring high-precision sleep staging, and has important clinical application value and market prospect. BRIEF DESCRIPTION OF DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or prior art description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from the structures shown in the drawings without creative labor.

[0054] Figure 1 The step flow chart of the sleep monitoring and intervention method based on the electroencephalogram signal of the present application;

[0055] Figure 2 The schematic diagram of the sleep regulation structure of the present application;

[0056] Figure 3 The tACS stimulation output schematic diagram of the present application;

[0057] Figure 4 The wearing schematic diagram of the wearable electroencephalogram acquisition device of the present application;

[0058] Figure 5 The electroencephalogram lead schematic diagram used in the present application. DETAILED DESCRIPTION

[0059] The present application proposes a sleep monitoring and intervention method and system based on electroencephalogram signal, aiming to design a closed-loop intervention strategy capable of improving sleep quality.

[0060] The sleep monitoring and intervention method based on electroencephalogram signal proposed by the present application will be described in the following specific embodiments:

[0061] Embodiment 1:

[0062] A sleep monitoring and intervention method based on electroencephalogram signal, such as Figure 1 , Figure 2As shown, the method comprises the following steps:

[0063] S1, collecting electroencephalogram signals through dry electrodes worn on the head of the user;

[0064] Specifically, the head of the user is collected by a wearable electroencephalogram collection device, which comprises a flexible wearing shell and a dry electrode assembly. The flexible wearing shell adopts an arc surface structure that is adapted to the contour of the human head, is formed by a three-dimensional printing process, and has flexible support performance and biocompatibility. The overall material can fit multiple areas of the forehead, occiput or scalp surface of the user, ensuring that no obvious compression or displacement occurs during long-term wearing, and is suitable for continuous monitoring during night sleep. The dry electrode assembly is fixed in a preset electrode groove on the inner side of the shell and is made of a silver / silver chloride composite material with stable conductivity. The electrode head is in a comb-tooth or dome-shaped structure to enhance the mechanical contact area with the skin surface and reduce the electrode-skin coupling impedance. The electrode does not require conductive paste or gel assistance and has non-invasive signal collection capability, easy cleaning, and reusability. The electrode assembly and the flexible shell adopt an integrated modular design. The user can flexibly adjust the electrode arrangement and shell tightness according to the head size and hairstyle, and has a self-wearing function without the need for professional installation and operation. The electroencephalogram collection device is suitable for continuous electroencephalogram signal collection in a natural sleep state and has the characteristics of light structure, stable wearing, reliable signal quality, and is suitable for individual physiological data monitoring in home, medical and mobile health scenarios.

[0065] S2, preprocessing the collected electroencephalogram signals, the preprocessing comprising amplification, band-pass filtering and power frequency notch filtering;

[0066] Specifically, amplification processing is performed by a high-input-impedance differential amplifier, band-pass filtering processing is performed by a 0.5-35 Hz band-pass filter (low-pass filter), and power frequency notch filtering processing is performed by a 50 Hz notch filter. A voltage follower is used to buffer the reference voltage signal to prevent signal distortion caused by load effects.

[0067] S3, real-time analysis of the preprocessed electroencephalogram signals, automatic sleep staging based on a deep learning model, and output of a current sleep stage label; the sleep stage label at least includes a wake period, an N1 period, an N2 period, an N3 period and a REM period;

[0068] S4, determining whether a preset intervention trigger condition is met based on the sleep stage label and real-time electroencephalogram frequency spectrum characteristics;

[0069] S5, generating and applying a transcranial alternating current stimulation signal to intervene in the sleep of the user when the intervention trigger condition is met.

[0070] Further, the automatic sleep staging based on the deep learning model in step S3 specifically comprises:

[0071] S31, segmenting the preprocessed electroencephalogram signal into multiple data epochs according to a preset time window;

[0072] S32, first, receiving a continuous original physiological signal x(t) and transforming it into a discrete event sequence. In an embodiment, the transformation can be converting the signal waveform into a pulse sequence or a neural pulse sequence. A sliding analysis window with a preset length (0.5 seconds) is used to process the discrete event sequence to calculate a quantitative index representing the local dynamic characteristics of the signal. In a specific embodiment, the quantitative index is the pulse density, i.e. the number of events (pulses) per unit time.

[0073] At least two predetermined thresholds are set: a high activity threshold T-h and a low activity threshold T-l. The quantitative index calculated in step two is compared with the two thresholds to classify the local region of the current signal into one of the following at least three types:

[0074] High activity segment: when the quantitative index is greater than the high activity threshold T-h. h

[0075] Low activity segment: when the quantitative index is less than the low activity threshold T-l. l

[0076] Transition segment: when the quantitative index is between or equal to T-h and T-l. l h

[0077] According to the determination result of step three, a corresponding segment parameter set is selected from a preset parameter library for the current signal region, and a segmentation operation is performed on the original physiological signal x(t). The parameter set at least includes a segment length and an overlap rate. In a preferred embodiment:

[0078] For the high activity segment (corresponding to the N1 sleep stage), a shorter first segment length (2 seconds) and a higher first overlap rate (60%) are used for fine analysis.

[0079] For the low activity segment (corresponding to the N3 sleep stage), a longer second segment length (4 seconds) and a lower second overlap rate (15%) are used to improve the calculation efficiency and capture long-term features.

[0080] For the transition segment, a third segment length (3 seconds) between the first and second segment lengths and a third overlap rate (40%) between the first and second overlap rates are used. ​​​​

[0081] The segmentation strategy can be dynamically adjusted according to the inherent characteristics of the signal itself, and a series of data epochs with variable length and overlap rate can be generated, so as to effectively avoid the feature breakage problem caused by fixed segmentation, and retain the physiological correlation and time domain continuity of the signal.

[0082] Each of the data epochs is input into a feature extraction module comprising at least two parallel convolution branches as a signal block. In a preferred embodiment, the module comprises:

[0083] The signal block is input into a first one-dimensional convolution layer, which is configured with a convolution kernel with a first convolution kernel size k1. The smaller convolution kernel size k1 makes the branch have a higher time domain resolution, which is suitable for capturing high-frequency components or rapidly changing local patterns in the signal.

[0084] The signal block is input into a second one-dimensional convolution layer in parallel, which is configured with a convolution kernel with a second convolution kernel size k2, wherein the second convolution kernel size k2 is greater than the first convolution kernel size k1. The larger convolution kernel size k2 makes the branch have a wider time receptive field, which is suitable for capturing low-frequency components or slowly changing macro trends in the signal.

[0085] The output feature maps of the first and second convolution branches are spliced along their feature dimensions to fuse into a single, more representative combined feature vector.

[0086] ;

[0087] Wherein the convolution kernel k1<k2 is used to capture high-frequency and low-frequency features respectively. After output, splicing is performed:

[0088] ;

[0089] In order to process the variable length input introduced by adaptive segmentation and provide a uniform size feature representation for subsequent modules, the present application introduces an adaptive pooling layer after the combined feature map F.

[0090] It can map the combined feature map F of any time length to an output feature vector with a preset fixed output size (d_out). Specifically, for each position of the output feature vector, the operation dynamically determines a corresponding receptive field region R on the input feature map F, and performs pooling operation on the feature values in the region.

[0091] ;

[0092] where R_ij represents the region on the input feature map F corresponding to the output position (i,j), which can be understood as a kind of dynamic resampling, mapping the feature map of arbitrary length to a fixed output size , that is:

[0093] ;

[0094] After the above double-scale convolution and adaptive pooling operation, the system generates a feature matrix X_feat for each input data epoch. The feature matrix has good time domain continuity due to the inheritance of adaptive segmentation; through the design of double-scale convolution and the realization of channel alignment and dimension unification through adaptive pooling. The feature matrix will be used as the input of the next stage of the graph neural network (GNN) module.

[0095] To effectively model the complex spatial dependence relationship between multiple lead physiological signals (several channels), a graph neural network module is introduced.

[0096] The C signal channels in a single epoch are regarded as C nodes in a graph structure. Let the node feature matrix be , and the adjacency matrix A can be constructed according to the lead topology; if there is no prior connection information, a fully connected graph is used. The attention weight of nodes i and j is defined as:

[0097] ;

[0098] a is a learnable attention parameter. The node feature update formula is:

[0099] ;

[0100] (∙) is the ELU activation function, and after stacking two layers of GAT, the global average pooling is used to obtain the graph-level representation g of a single epoch ∈R^(d_g ), realizing feature fusion and topology preservation across channels.

[0101] To capture the long-term temporal dependence between different data epochs, the present application cascades a Transformer encoder module after the graph neural network module.

[0102] The time sequence feature sequence generated by the GNN is input into the Transformer encoder to capture long-term temporal dependence. To preserve the temporal order, a sine-cosine position encoding is added. Then, the multi-head self-attention mechanism is used to weight the context between epochs:

[0103] ;

[0104] By stacking several layers of encoders and adding residual connections and layer normalization (LayerNorm), the model can capture both short-term and long-term dependency features, .

[0105] The output of the transformer layer is mapped to the class space using a fully connected layer and the class probabilities are obtained using softmax. The training phase uses a label smoothed weighted cross-entropy loss function and contrastive learning.

[0106] ;

[0107] where L is the number of samples, C is the number of classes, is the true label of the i-th sample, is the logit output of the i-th sample on the j-th class, is the smoothing parameter, is the indicator function.

[0108] The above neural network structure supports output of corresponding sleep stage labels at an epoch granularity of 30 seconds, and the classification results can be five categories (Wake, N1, N2, N3, REM); the model supports dynamic inference window length adjustment, which can perform high-precision offline analysis in the complete history segment, and also can perform real-time prediction in a single epoch, suitable for various application scenarios such as closed-loop stimulation triggering and trend evaluation.

[0109] Further, the step S3 further comprises a motion artifact identification step:

[0110] The median and median absolute deviation of the amplitude of the electroencephalogram signal of each data epoch are calculated in real time, and the upper and lower threshold values of the amplitude are dynamically set based on this;

[0111] If the amplitude of the electroencephalogram signal of the data epoch exceeds the upper and lower threshold values, further verification is performed in combination with the electrode impedance change information;

[0112] The data epoch confirmed as an artifact after verification is marked as an independent "artifact" category.

[0113] Specifically, the artifact identification adopts a multi-dimensional dynamic analysis method, and the system calculates the median and median absolute deviation (MAD) of the electroencephalogram amplitude of each 30-second epoch in real time through a sliding time window, and dynamically sets the upper and lower threshold values to adapt to the physiological differences of different individuals and the changes in night state.

[0114] ;

[0115] Lower threshold value:

[0116] ;

[0117] Upper threshold value:

[0118] ;

[0119] When the amplitude of the certain epoch signal is out of bounds, a multi-modal joint verification mechanism is further triggered, and the impedance change of the electrode (such as impedance greater than 50kΩ or change rate exceeding 20%) is analyzed.

[0120] ;

[0121] If the verification is passed, it is directly marked as Phantom, and if the verification is not passed, it is sent to the network for micro-artifact identification, and finally the determination result is output to the staging model.

[0122] Further, the intervention trigger condition in step S4 includes Wave significance judgment, the specific steps of which include:

[0123] S41, calculating the average power of the real-time electroencephalogram signal in band;

[0124] S42, calculating the average power of the frequency band adjacent to band;

[0125] S43, calculating the ratio of band power to adjacent band power, and converting the ratio to a decibel value;

[0126] S44, if the decibel value exceeds a first preset threshold, it is determined that wave is significant, and the intervention trigger condition is met.

[0127] In step S44, the intervention trigger condition further includes: calculating the ratio of band power to total power, and if the ratio exceeds a second preset threshold, it is further confirmed that the intervention trigger condition is met.

[0128] Specifically, the average value of the adjacent frequency band spectral intensity can be represented as:

[0129] ;

[0130] In order to be comparable to the neighborhood average, first define the average power of wave:

[0131] ;

[0132] In order to quantify the relative significance of wave, the ratio of the two is calculated:

[0133] ;

[0134] The index represents The degree of enhancement of the wave power relative to the neighborhood power. In order to more intuitively represent the significance, it is converted into dB form:

[0135] ;

[0136] Threshold setting principle: > 3 dB (indicating Energy is about 2 times the neighborhood), it is considered The wave is in a significant state.

[0137] At the same time, the ratio threshold of Wave power and total power is also defined:

[0138] ;

[0139] Wherein Indicates the total power outside the target frequency band.

[0140] In the closed-loop mechanism, if the set threshold Is met The system determines that The wave is significantly enhanced, triggering the corresponding neural intervention operation.

[0141] Further, the generating and applying transcranial alternating current stimulation signal in step S5, specifically, closed-loop phase synchronization stimulation, comprises the following steps:

[0142] S51, band-pass filtering the pre-processed electroencephalogram signal to extract the neural oscillation signal of the target frequency band;

[0143] S52, Hilbert transform is performed on the filtered signal to calculate the instantaneous phase and instantaneous frequency of the neural oscillation signal;

[0144] S53, according to the instantaneous phase, a target phase is calculated, the target phase and the instantaneous phase of the neural oscillation signal maintain a preset fixed phase difference;

[0145] S54, based on the target phase and the instantaneous frequency, a transcranial alternating current stimulation waveform with specific phase and frequency is generated;

[0146] S55, the transcranial alternating current stimulation waveform is applied to the user.

[0147] Specifically, first, the signal is cleaned by hardware-level preprocessing (including 50 Hz power frequency suppression and 0.5-35 Hz band-pass filtering) to ensure signal stability and effectiveness. Then, a N-order Butterworth digital band-pass filter is used to effectively extract the brain electrical activity in the target frequency band (13-30 Hz) to provide a reliable basis for subsequent phase estimation. Subsequently, a specially designed adaptive filtering method is used to suppress tACS artifacts. The processed signal is sent to the subsequent feature extraction module.

[0148] Instantaneous phase and frequency tracking: Hilbert transform can convert real signals into analytic signals (containing real and imaginary parts), and by calculating these two parts, the instantaneous amplitude and phase information of the signal can be extracted.

[0149] ;

[0150] The original signal and the Hilbert-transformed signal are superimposed to generate an analytic signal in complex form.

[0151] ;

[0152] The instantaneous amplitude and instantaneous phase of the analytic signal are calculated as follows:

[0153] ;

[0154] ;

[0155] The core strategy of closed-loop tACS is to maintain a fixed target phase difference between the applied tACS waveform and the tracked endogenous neural oscillation .

[0156] ;

[0157] ;

[0158] where represents the real-time estimation of the neural instantaneous phase, is used to compensate for the total delay of acquisition-computation-D / A-power amplifier-electrode.

[0159] The DPLL takes this target phase as the reference input, and through phase comparison, loop filtering, and numerically controlled oscillator (NCO) structure, it realizes dynamic tracking of the instantaneous frequency and phase of the stimulation signal. When there is a deviation between the reference phase and the internal NCO output phase _nco[n], the loop filter adjusts the control quantity according to the error signal, so that gradually approaches to realize phase locking.

[0160] tACS parameter determination and waveform generation: In addition to the instantaneous phase, other parameters of the tACS waveform are determined by the control logic. Amplitude is usually set in a safe and effective range, can be a fixed value, or adaptively adjusted according to the amplitude of the endogenous oscillation. tACS frequency is usually set as the center frequency of the target endogenous oscillation, and the instantaneous frequency estimated by the DPLL is tracked in real time .

[0161] The system generates a sequence of tACS digital waveforms using a principle similar to a direct digital synthesizer (DDS), and a schematic diagram of the tACS stimulation output is shown in Figure 3 According to the real-time target instantaneous phase and amplitude calculated by the control logic, a waveform sample is generated at each sampling point:

[0162] ;

[0163] This digital sequence is converted into an analog tACS current output through a digital-to-analog converter (DAC) and a current driving circuit and applied to the electrodes. By directly controlling the instantaneous phase of the output waveform, it is ensured that the applied tACS waveform can maintain an accurate phase-locked relationship with the endogenous neural oscillation.

[0164] Further, before step S52, an adaptive filtering step is further included for suppressing artifacts in the brain electrical signal caused by previously applied stimulation.

[0165] Further, the preset fixed phase difference in step S53 is used to compensate for the total time delay generated by the system from signal acquisition to stimulation application.

[0166] Embodiment 2:

[0167] A sleep monitoring and intervention system based on brain electrical signals, comprising:

[0168] A wearable brain electrical signal acquisition device for acquiring brain electrical signals of a user, the device comprising a flexible wearing shell and a dry electrode assembly arranged on the inner side thereof;

[0169] A signal processing module connected to the brain electrical signal acquisition device for pre-processing, artifact identification and automatic sleep staging of the acquired brain electrical signals;

[0170] A closed-loop intervention module connected to the signal processing module for generating and applying intervention stimulation according to the sleep staging results and brain electrical rhythm analysis results;

[0171] The signal processing module includes a neural network model based on a feature pyramid network (FPN) and a Transformer encoder, is used for multi-scale feature extraction and sleep stage classification on a single-channel electroencephalogram signal, and outputs a staging result including Wake, N1, N2, N3, REM and Phantom categories.

[0172] The closed-loop intervention module includes a wave salience detection unit and a digital phase-locked loop (DPLL) unit, which are used for generating a transcranial alternating current stimulation (tACS) signal phase-locked with an endogenous neural oscillation when wave salience enhancement is detected.

[0173] Further, the dry electrode of the wearable electroencephalogram acquisition device is a comb-shaped or dome-shaped silver / silver chloride dry electrode, and the flexible wearing shell is an arc surface flexible structure matched with the contour of a human head.

[0174] Specifically, the wearable electroencephalogram acquisition device includes an electrode assembly, an analog front-end circuit, an analog-to-digital converter (ADC), a micro control unit (MCU), a power supply system, a wireless communication module and a local storage unit, and constitutes a complete electroencephalogram acquisition and data processing channel for continuous monitoring in a natural sleep state.

[0175] The electrode assembly adopts a silver chloride dry electrode structure, and the electrode surface is treated by a silver / silver chloride coating to reduce the skin electrode contact impedance, and has a reusable characteristic. The electrode is a comb-shaped or dome-shaped structure, attached to the forehead or occipital region of a user, and is adapted to different head contours.

[0176] The analog front-end circuit includes a high input impedance differential amplifier, a 0.5-35 Hz band-pass filter, a 50 Hz notch filter and a voltage reference follower. The voltage follower is used to buffer the reference voltage signal to prevent signal distortion caused by load effects.

[0177] The analog-to-digital converter selects a multi-channel high-performance sampling chip ADS1299, which supports 24-bit resolution and a sampling rate of not less than 256 Hz, has high common-mode rejection ratio and low input bias current characteristics. The micro control unit adopts an STM32F407 chip based on an ARM Cortex-M4 architecture, which is responsible for ADC control, data buffering, power consumption scheduling and communication instruction analysis.

[0178] The power supply system is powered by a 3.7V lithium battery, cooperates with a boost / buck circuit, a charging management chip and multiple linear voltage stabilizing modules, and provides 3.3V, ±2.5V and -5V voltages for each unit of the system, respectively.

[0179] ​The wireless communication module is based on nRF24L01 chip to build a low-power bidirectional communication link, adopts a serial port protocol to interact with a host computer or a mobile terminal in real time, and has a frequency hopping anti-interference mechanism and an automatic retransmission protocol, so as to improve the data transmission reliability in a complex environment.

[0180] The local storage unit is an SD card module, which automatically enables a cache-storage cooperative mechanism when a wireless channel is unstable or interrupted, records raw brain electrical data, has breakpoint resuming capability, ensures that more than 8 hours of continuous data is not lost, and realizes real-time uploading and offline backup dual-path data redundancy storage.

[0181] Embodiment 3

[0182] A sleep monitoring and intervention method based on brain electrical signals, comprising the following steps:

[0183] S10: Signal acquisition and preprocessing:

[0184] Under the guidance of a clinician or a researcher, a subject wears a wearable brain electrical acquisition device according to the present application during a natural sleep process, and records brain electrical signals (EEG) during the entire sleep process. As shown in Figure 5 , only 4 lead electrodes (Fp1, Fp2, AFZ, EOG) in the forehead area are required during the acquisition process, with CZ as a reference electrode, to ensure that the system is light and easy to wear and has high signal stability. The sampling rate is set to 512 Hz.

[0185] During the EEG acquisition process, the signal is first subjected to hardware-level preprocessing, including 0.5-35 Hz band-pass filtering and power frequency notch filtering (50 Hz). to remove electromyographic and power frequency interference.

[0186] ;

[0187] ;

[0188] Further, the software-level preprocessing includes re-referencing (AFZ, CZ) and the like. The final obtained brain electrical data is divided into an epoch sequence with a unit of 30 seconds.

[0189] ;

[0190] Remove DC drift to make EEG stable around zero fluctuation, and perform baseline correction (de-meaning):

[0191] ;

[0192] Segment into 30s epochs: record the first epoch as , with a length of . Sleep stage according to AASM standard

[0193] S20: Motion artifact judgment mechanism:

[0194] S21, upper and lower bound derivation,

[0195] Calculate the amplitude median for each epoch And the median absolute deviation MAD:

[0196] ;

[0197] ;

[0198] Robust standard deviation estimation:

[0199] ;

[0200] Construct upper and lower bounds, if the EEG amplitude exceeds the range, mark it as a suspicious artifact:

[0201] ;

[0202] ;

[0203] S22, joint verification,

[0204] When an epoch is out of bounds, the system further verifies it in combination with electrode impedance and accelerometer information. If it meets the requirements, it is marked as a "Phantom" class.

[0205] ;

[0206] S30: Automatic sleep staging:

[0207] First, for each epoch, the waveform integrity is preserved by adaptive segmentation, multi-scale features are captured by double-scale convolution, and dimension normalization is performed by adaptive pooling. This stage aims to extract a high-quality, format-unified deep feature matrix for each epoch from the original signal .

[0208] ;

[0209] Second, input the feature matrix output in the previous stage to the graph attention network (GAT), which regards multi-channel as graph nodes, responsible for modeling the spatial topological relationship within a single epoch, and refining it into a comprehensive graph-level representation.

[0210] Finally, the graph-level representation representing the spatiotemporal snapshot of different epochs is collected into a time sequence and input into the Transformer encoder. This module is responsible for global context modeling to capture long-range temporal dependencies across epochs. The model can capture both short-term and long-term dependency features simultaneously, outputting .

[0211] A fully connected layer is used to map the output of the Transformer layer to the class space and softmax is used to obtain the class probability. After training on the dataset, the final output is a five-class label.

[0212] S40: Wave saliency detection:

[0213] Before entering the closed-loop intervention, it is necessary to confirm that the individual is in wave saliency state.

[0214] S41, power spectrum estimation:

[0215] Smooth power spectrum is calculated for epochs:

[0216] ;

[0217] Let the three frequency band index set (3-8 Hz), (8-13 Hz), (13-18 Hz), corresponding to the number of sample points .

[0218] S42, neighborhood power and saliency:

[0219] The neighborhood average power, wave average power and saliency are calculated:

[0220] ;

[0221] The neighborhood average power (approximately twice the energy), then the wave saliency is considered to be established, and the intervention stage can be entered.

[0222] S50: Closed-loop intervention mechanism:

[0223] S51, analysis of signal and instantaneous phase:

[0224] The target frequency band (alpha wave 8-13 Hz) is first extracted using a band-pass filter, and the analytic signal is calculated:

[0225] ;

[0226] Then the instantaneous phase and instantaneous frequency are calculated:

[0227] ;

[0228] S52, delay compensation and target phase setting:

[0229] System total delay (acquisition -> calculation -> DAC -> drive -> electrode) compensated with estimated phase offset:

[0230] ;

[0231] Target tACS phase:

[0232] ;

[0233] S53, DPLL (Digital Phase-Locked Loop):

[0234] Update NCO phase with first-order DPLL:

[0235] ;

[0236] ;

[0237] where , is the loop gain, (phase error is less than a given threshold), it is considered that the PLL is successfully locked.

[0238] S54, output waveform and amplitude adaptation:

[0239] Generate tACS samples:

[0240] ;

[0241] In order to realize amplitude adaptation:

[0242] ;

[0243] where , can reflect the strength of the current brain electrical oscillation, is the safety upper limit, is the proportional coefficient, the stimulation current intensity can be adaptively adjusted following the brain electrical amplitude (the brain wave fluctuates greatly, the stimulation is strong, the brain wave fluctuates small, the stimulation is weak), avoid excessive stimulation.

[0244] Electrical stimulator output test

[0245] The frequency of the electric stimulator is tested below. During the experiment, the output sine signal is taken as an example, which outputs the sine signal with the frequency of 10 Hz to 1000 Hz, the amplitude of 2.5 V and the phase of 0° in turn. The output frequency is collected by using the oscilloscope described above, and the corresponding error accuracy is calculated. The experimental results are shown in Table 1.

[0246] Table 1: Partial frequency output test

[0247]

[0248] As shown in Table 1, the output frequency of the electric stimulator is normal, and the error accuracy is controlled within 1%, which indicates that the overall error of the device output is irrelevant to the input frequency, and is maintained within 1%.

[0249] The current value output by the electric stimulator is represented by the amplitude input by the upper computer. Since it is inconvenient to observe the current output, the peak-to-peak value and the effective value collected by the oscilloscope are used instead of calculation. In this experiment, the amplitude of 1 The error of different input amplitudes is tested under the conditions of load, 500 Hz frequency, no time delay and phase. The specific test data are shown in Table 2.

[0250] Table 2: Partial amplitude test of electric stimulator

[0251]

[0252] As shown in the table, the amplitude parameter signal can be successfully output, the output error can be controlled within 1%, and the minimum unit of amplitude can be controlled within 0.1 mA. According to the amplitude test results and the waveform measured by the oscilloscope, the signal output meets the setting requirements.

[0253] Each cell in the matrix represents the percentage of prediction of each actual class, and the color depth in the matrix represents the consistency between the prediction result and the actual class. The rows correspond to different sleep stages, including W, N1, N2, N3 and REM, and the columns represent the stages predicted by the model. The deeper the color, the higher the consistency between the prediction result and the actual class. The diagonal line represents the accuracy of each stage classification.

[0254] Based on the public data set and data, 10-fold cross-validation is performed, as shown in Table 3, to test the overall performance of the sleep staging method.

[0255] Table 3: Specific performance index parameters

[0256]

[0257] In the preliminary experiment of the present application, 5 healthy subjects were preliminarily included, and the performance of the system before and after intervention in the automatic sleep staging task was compared and tested. The experiment used the wearable EEG acquisition device and the staging network model described in the present application, combined with the closed-loop intervention method, to analyze and stage the EEG data of the subjects during the whole night sleep. The present application significantly improves the staging performance of each sleep stage after intervention: N3 stage (deep sleep): the N3 stage is improved from 72.94% to 83.94% after intervention, and the average duration and proportion of N3 stage after intervention are increased, which verifies that the closed-loop intervention can effectively improve the deep sleep time, which is helpful to evaluate the proportion of deep sleep of the individual; REM stage (rapid eye movement period): the duration and proportion are increased to a certain extent after intervention, which suggests that it has potential benefits for memory consolidation and emotion regulation; Wake, N1 and N2 stages: the recognition accuracy remains at a high level and is not affected by the artifacts and negative effects of intervention.

[0258] The above is only the preferred specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A sleep monitoring and intervention method based on electroencephalogram signals, characterized in that, The method comprises the following steps: S1, collecting electroencephalogram signals through dry electrodes worn on the head of a user; S2, preprocessing the collected electroencephalogram signals, the preprocessing comprising amplification, band-pass filtering and power frequency notch filtering; S3, performing real-time analysis on the preprocessed electroencephalogram signals, automatically performing sleep staging based on a deep learning model, and outputting a current sleep stage label; the sleep stage label at least comprises a wake period, an N1 period, an N2 period, an N3 period and an REM period; S4, judging whether a preset intervention triggering condition is met based on the sleep stage label and real-time electroencephalogram frequency spectrum characteristics; S5, when the intervention triggering condition is met, generating and applying a transcranial alternating current stimulation signal to intervene in the sleep of the user; The automatic sleep staging based on the deep learning model in step S3 specifically comprises: S31, dividing the preprocessed electroencephalogram signals into a plurality of data epochs according to a preset time window; S32, inputting each data epoch into a "spatial encoder" formed by cascading a front-end adaptive module and a graph attention network, aiming to extract and output a comprehensive graph-level representation sequence from the multi-channel signals and their inherent spatial topological relationship; S33, inputting a time sequence sequence composed of the graph-level representations generated by the continuous epochs into a Transformer encoder classification module to model sequence context information and capture long-term dependencies, and finally outputting a sleep stage classification result corresponding to each data epoch; Step S3 further comprises a motion artifact identification step: Real-time calculation of the median and absolute deviation of the median of the amplitude of the electroencephalogram signal of each data epoch, and dynamic setting of the upper and lower threshold values of the amplitude based thereon; If the amplitude of the electroencephalogram signal of the data epoch exceeds the upper and lower threshold values, further verification is performed in combination with the electrode impedance change information; The data epoch verified as an artifact is marked as an independent "artifact" category.

2. The electroencephalogram-based sleep monitoring and intervention method according to claim 1, characterized in that, The intervention triggering condition in step S4 comprises a judgment based on alpha wave prominence, and the specific steps thereof comprise: S41, calculating the average power of the real-time electroencephalogram signal in the alpha frequency band; S42, calculating the average power of the frequency band adjacent to the alpha frequency band; S43, calculating the ratio of the alpha frequency band power to the adjacent frequency band power, and converting the ratio to a decibel value; S44, if the decibel value exceeds a first preset threshold value, it is determined that the alpha wave is prominent, and the intervention triggering condition is met.

3. The electroencephalogram-based sleep monitoring and intervention method of claim 2, wherein, In step S44, the intervention triggering condition further comprises: calculating the ratio of the alpha frequency band power to the total power, and if the ratio exceeds a second preset threshold value, it is further confirmed that the intervention triggering condition is met.

4. The electroencephalogram-based sleep monitoring and intervention method of claim 1, wherein, The generation and application of the transcranial alternating current stimulation signal in step S5 is specifically a closed-loop phase-synchronous stimulation, comprising the following steps: S51, performing band-pass filtering on the preprocessed electroencephalogram signals to extract neural oscillation signals in the target frequency band; S52, performing Hilbert transform on the filtered signals to calculate the instantaneous phase and instantaneous frequency of the neural oscillation signals; S53, according to the instantaneous phase, a target phase is calculated, the target phase and the instantaneous phase of the neural oscillation signal maintain a preset fixed phase difference; S54, based on the target phase and the instantaneous frequency, a transcranial alternating current stimulation waveform with a specific phase and frequency is generated; S55, the transcranial alternating current stimulation waveform is applied to the user.

5. The electroencephalogram-based sleep monitoring and intervention method of claim 4, wherein, Before step S52, an adaptive filtering step is further included for suppressing artifacts in the electroencephalogram signal caused by previously applied stimulation.

6. The electroencephalogram-based sleep monitoring and intervention method of claim 4, wherein, The preset fixed phase difference in step S53 is used to compensate for the total time delay generated in the process from signal acquisition to stimulation application.

7. A sleep monitoring and intervention system based on electroencephalogram signals for implementing the sleep monitoring and intervention method based on electroencephalogram signals according to any one of claims 1 to 6, characterized in that, Comprise: A wearable electroencephalogram acquisition device for acquiring electroencephalogram signals of a user, the device comprising a flexible wearing shell and a dry electrode assembly arranged inside the shell; A signal processing module connected to the electroencephalogram acquisition device for pre-processing, artifact identification and automatic sleep staging of the acquired electroencephalogram signals; A closed-loop intervention module connected to the signal processing module for generating and applying intervention stimulation according to sleep staging results and electroencephalogram rhythm analysis results; Wherein, the signal processing module is a set of hierarchical space-time joint modeling network, which integrates front-end adaptive feature extraction, graph neural network and Transformer encoder; it aims to process multi-channel physiological signals: first, GNN is used to model the spatial dependence of each channel within a single epoch, and then Transformer is used to capture long-range temporal dynamics across epochs; the module finally outputs the classification results of sleep stages, including wakefulness, N1, N2, N3, REM and artifacts; the closed-loop intervention module includes an alpha wave significance detection unit and a digital phase-locked loop unit, which is used to generate a transcranial alternating current stimulation signal phase-locked with endogenous neural oscillation when alpha wave significance is detected.

8. The system of claim 7, wherein, The dry electrode of the wearable electroencephalogram acquisition device is a comb-shaped or dome-shaped silver / silver chloride dry electrode, and the flexible wearing shell is an arc-shaped flexible structure compatible with the contour of the human head.

Citation Information

Patent Citations

  • Automatic sleep staging method and system based on ResCNN-BiGRU

    CN119073924A

  • Adaptive deep brain stimulation for sleep stage targeting to treat sleep dysfunction

    WO2025101224A2