A short-time sleep cognitive recovery system and method based on lightweight deep learning
By employing a lightweight deep learning-based dual-stream discriminant architecture and a closed-loop acoustic intervention mechanism, the accuracy and portability issues of sleep monitoring on portable devices are resolved. This enables high-precision sleep staging and personalized intervention under low power consumption conditions, thereby improving cognitive recovery efficiency during short sleep periods.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING UNIV OF POSTS & TELECOMM
- Filing Date
- 2026-03-02
- Publication Date
- 2026-06-09
AI Technical Summary
Existing sleep monitoring and sleep aid technologies face a trade-off between portability and algorithm accuracy. Traditional devices are bulky and require high computing resources, while existing algorithms lack accuracy when running on low-power portable devices. They also lack closed-loop feedback and targeted intervention based on neural mechanisms, making it difficult to quantify and improve the efficiency of learning ability recovery.
Employing a lightweight deep learning-based dual-stream discriminant architecture, combined with XGBoost and SleepTransformer models, we achieve high-precision sleep staging at low sampling rates. Furthermore, we utilize a closed-loop acoustic intervention mechanism to provide personalized intervention based on the brain's functional connectivity, including signal preprocessing, sleep staging inference, and cognitive state assessment.
Achieving high-precision sleep staging on low-power devices improves memory consolidation efficiency and learning ability recovery during short sleep periods. Through assessment of functional connectivity in specific brain regions and acoustic intervention, the accuracy of staging and the specificity of intervention are significantly improved.
Smart Images

Figure CN122163968A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of biomedical signal processing and brain-computer interface technology, specifically to a short-term sleep cognitive recovery system and method based on lightweight deep learning. Background Technology
[0002] In today's high-intensity learning and work environment, cognitive fatigue has become a common phenomenon. Research shows that sleep is not only a process of restoring physical strength, but also a crucial window for the brain to consolidate memories, remodel synapses, and clear metabolic waste. In particular, short sleep (such as a 20-30 minute nap) has been proven to effectively improve executive function and enhance learning efficiency. During this process, the brain transitions from wakefulness to light sleep (N1), and then enters the middle sleep stage (N2), which includes sleep spindles, during which complex and dynamic changes occur in its internal neural mechanisms.
[0003] However, existing sleep monitoring and sleep aid technologies still have the following significant drawbacks when applied to everyday short-term sleep cognitive recovery scenarios:
[0004] First, there is a contradiction between the portability of monitoring devices and the accuracy of algorithms. Traditional sleep staging relies on polysomnography (PSG), which requires professional technicians and involves bulky equipment, making it unsuitable for everyday nap scenarios. Existing consumer wearable devices (such as smart bracelets) are mostly based on motion or heart rate signals, making it difficult to accurately identify key EEG features related to cognitive recovery (such as the transition from N1 to N2). Although deep learning algorithms (such as CNN and RNN) have made progress in sleep EEG staging in recent years, these models typically have a huge number of parameters (≥10MB), requiring high computational resources and often relying on high sampling rates (above 100Hz) of data, with inference times ≥100ms. When running on low-power portable devices at low sampling rates (such as 64Hz), the ability of existing algorithms to extract features decreases significantly, resulting in severely insufficient staging accuracy.
[0005] Second, intervention methods lack closed-loop feedback based on neural mechanisms. Most current sleep aids use an "open-loop" approach, blindly playing white noise, binaural beats, or soothing music. This method ignores the brain's real-time state and often presents two problems: first, the timing of intervention is imprecise; for example, continuing to play sleep aid music when the user has already entered N2 stage may disrupt the generation of sleep spindle waves, thus interfering with memory consolidation; second, it lacks specificity, failing to target specific brain functional networks (such as the prefrontal-temporal network responsible for consciousness transfer, or the central-occipital network responsible for memory recall) with specific neural modulation.
[0006] Third, existing technologies struggle to quantify and improve the efficiency of "learning ability recovery." Most systems focus solely on whether the patient is asleep, neglecting the intrinsic link between sleep quality and cognitive function recovery. There is a lack of a system capable of real-time monitoring of brain functional connectivity and dynamically adjusting intervention strategies to maximize memory consolidation.
[0007] Therefore, there is an urgent need to develop a system that can achieve high-precision real-time staging under low computing power and low sampling rate conditions, and can perform precise closed-loop acoustic intervention based on the functional connectivity status of key brain regions, in order to solve the above problems and help users efficiently restore cognitive and learning abilities during short periods of sleep. Summary of the Invention
[0008] The purpose of this invention is to provide a short-sleep cognitive recovery system and method based on lightweight deep learning. This method addresses the problems of existing deep learning sleep staging models, such as high computational complexity and difficulty in real-time operation on low-power portable devices, as well as the lack of closed-loop feedback based on real-time brain state and poor intervention targeting in existing acoustic intervention methods. By constructing a dual-stream discriminant architecture and a specific brain region functional connectivity assessment mechanism, this invention can achieve high-precision staging under low sampling rate conditions and implement personalized and precise intervention based on neural mechanisms, thereby significantly improving memory consolidation efficiency and learning ability recovery level during short sleep.
[0009] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0010] A short-term sleep cognitive recovery system based on lightweight deep learning, comprising: an EEG signal acquisition module, a signal preprocessing module, a sleep stage reasoning module, a cognitive state assessment module, and a closed-loop acoustic intervention module;
[0011] The EEG signal acquisition module is used to acquire the user's EEG signals;
[0012] The signal preprocessing module is used to filter, remove artifacts, and perform sliding window segmentation on the EEG signals.
[0013] The sleep stage reasoning module is connected to the signal preprocessing module and performs real-time sleep stage discrimination on the EEG signal of the current time window based on a preset dual-stream discrimination architecture.
[0014] The cognitive state assessment module is used to calculate the functional connectivity strength between specific brain regions based on the sleep stage discrimination results.
[0015] The closed-loop acoustic intervention module is used to dynamically generate and output acoustic stimulation signals based on the deviation between the functional connection strength and the preset reference value.
[0016] The dual-stream discrimination architecture of the sleep staging inference module includes a lightweight XGBoost model for low-power initial screening and a deep learning SleepTransformer model for precise judgment of temporal features.
[0017] The XGBoost model uses the SHAP algorithm to select the Top-20 features to construct a subset, employs a 6-layer decision tree, a learning rate of 0.1, a maximum depth of 6, and has ≤500KB of parameters. The single-window inference time is ≤10ms. The SleepTransformer model adopts a dual-branch architecture, containing a 4-layer encoder and 8 attention heads. The number of parameters is ≤2MB, the single-window re-judgment time is ≤30ms, and the switching threshold is set to a confidence level of 0.75. Re-judgment is activated when the power change rate of adjacent window bands is ≥30%.
[0018] Preferably, the EEG signal acquisition module adopts a 19-lead EEG cap, based on the international 10-20 system layout, covering at least the prefrontal lobe (Fp1, Fp2), temporal lobe (T3, T4), central region (C3, C4), and occipital lobe (O1, O2), with a sampling rate of 64-512Hz, input impedance ≥10MΩ, signal resolution ≤1μV, bandwidth 0.5-50Hz, common-mode rejection ratio (CMRR) ≥110dB, ensuring a signal integrity retention rate of ≥95% for the target frequency band (Theta, Sigma).
[0019] Preferably, the signal preprocessing module uses a 0.5-50Hz infinite impulse response (IIR) bandpass filter to attenuate the target frequency band signals of Theta (4-8Hz) and Sigma (12-15Hz) by ≤0.5dB. It removes electrooculography and electromyography artifacts using an independent component analysis (ICA) algorithm, achieving an artifact recognition accuracy of ≥92%. After artifact removal, the signal-to-noise ratio (SNR) is improved by ≥15dB. The sliding window is set to 30 seconds (including 1920 sampling points), with a sliding step size of 15 seconds, and the single-window preprocessing time is ≤50ms.
[0020] Preferably, the dual-stream discrimination architecture of the sleep staging inference module includes:
[0021] First processing flow: The input EEG signal is downsampled at 64Hz to extract time-frequency domain features, and then input to the preset XGBoost classifier;
[0022] The second processing flow: maintains the time-series structure of the input EEG signal or converts it into a time-frequency graph, and inputs it into a preset SleepTransformer neural network model based on a self-attention mechanism;
[0023] Switching logic: The system defaults to running the first processing stream; when the output confidence of the XGBoost classifier is lower than 0.75, or when the power change rate of adjacent window bands is detected to be ≥30%, it is determined to be the transition boundary of the sleep stage, and the second processing stream is activated for correction.
[0024] Preferably, the SleepTransformer neural network model adopts a dual-branch fusion architecture, including:
[0025] Signal processing branch: This branch is used to process the raw EEG time series. It contains a channel attention module, which is configured to compress features through average pooling and max pooling operations with a 100-sampling-point window in the time dimension, calculate channel weights with a weight calculation error of ≤3%, and adaptively weight the multi-channel signals. Then, it is connected to a multi-layer Transformer encoder to extract temporal features.
[0026] Feature auxiliary branch: used to process the extracted time-frequency domain statistical features, and to map the 20-dimensional statistical features to a 64-dimensional high-dimensional feature space through a multilayer perceptron;
[0027] Fusion classification layer: configured to concatenate the output vector of the signal processing branch with the output vector of the feature auxiliary branch, and then input it into the fully connected layer for classification.
[0028] Preferably, the input feature selection method for the XGBoost classifier includes:
[0029] The SHAP algorithm is used to rank the feature importance of the pre-trained model, calculate the mean absolute value of the SHAP of each feature, and select the top-20 features with the highest contribution to construct a feature subset.
[0030] The Top-20 features include the power ratio of the Alpha and Theta bands (SHAP value accounts for 32%), cross-channel correlation features (SHAP value accounts for 28%), and other key time-frequency domain features.
[0031] Preferably, the control logic of the closed-loop cognitive recovery system includes:
[0032] Sleep guidance mode: In response to the sleep stage inference module determining that the current stage is awake (W) or light sleep (N1) and the prefrontal-temporal lobe Theta frequency band synchronization is below the preset threshold of 0.65, background music with 6Hz isochronous audio is output, with an initial volume of 45±5dB(A). For every 0.1 increase in the difference between the prefrontal-temporal lobe Theta frequency band synchronization and the preset threshold of 0.65, the volume increases by 0.5dB(A), and the maximum volume does not exceed 60dB(A).
[0033] Memory consolidation mode: In response to the sleep stage reasoning module determining that the current sleep stage is N2 and the central zone-occipital lobe Sigma band functional connection strength is lower than the target value of 0.7, pink noise that enhances the energy of the Sigma band is output. The energy of this noise in the Sigma band is 30±5dB higher than that of the broad spectrum pink noise. The beat intensity is synchronized with the 13.5Hz center frequency and the adjustment step is 0.5Hz.
[0034] The closed-loop acoustic intervention module is also configured with a real-time adjustment function: based on the difference between the real-time calculated functional connection strength and the target threshold, the volume, beat intensity and frequency parameters of the output acoustic signal are dynamically adjusted; when the functional connection strength reaches or exceeds the target threshold, the volume is reduced at a rate of 1dB(A) / second, and the output stops after 30 seconds, with a single-round adjustment response delay of ≤100ms.
[0035] A short-sleep cognitive recovery method, comprising:
[0036] S100: The EEG signal acquisition module acquires the user's multi-channel EEG signals in real time. The acquisition parameters are 64-512Hz sampling rate and 0.5-50Hz bandwidth. The signal segments are extracted using a 30-second sliding window (15-second step).
[0037] S200: Input the signal segment into the preset dual-stream phased model. Prioritize the use of the XGBoost model (based on the Top-20 key feature subsets such as Alpha-Theta power ratio and cross-channel correlation) selected by SHAP features for lightweight inference. The single-window inference time is ≤10ms. When the confidence level is <0.75 or a phase transition boundary is detected, the SleepTransformer model is used for time-series feature re-judgment. The re-judgment time is ≤30ms. Output the current sleep stage.
[0038] S300. If the current stage is light sleep (N1), the phase synchronicity of the Theta band (4-8Hz) between the prefrontal and temporal lobes is calculated using the phase lock value (PLV), with a calculation window of 1 second and a step size of 0.5 seconds, and a calculation error ≤3%. If the current stage is intermediate sleep (N2), the functional connectivity strength of the central region and occipital lobe in the Sigma band (12-15Hz) is calculated using the weighted phase lag index (wPLI), with a sensitivity to Sigma band-specific connectivity ≥0.85 and a false positive rate ≤5%.
[0039] S400. Compare the calculated synchronicity or connection strength with the preset cognitive recovery baseline curve. The baseline threshold for stage N1 is 0.65, and the target threshold for stage N2 is 0.7.
[0040] S500: Based on the comparison results, generate corresponding acoustic intervention strategies. By adjusting acoustic parameters (including volume, beat intensity and frequency), induce brain neural oscillation synchronization until the target connection strength is reached, and adjust the response delay ≤100ms.
[0041] Preferably, the pre-set dual-flow phased model in S200 includes:
[0042] S201, First-class: Lightweight feature engineering and XGBoost model construction;
[0043] S202, Second Stream: Construction of SleepTransformer Model Based on Dual-Branch Fusion Attention;
[0044] S203. Model Quantization and Integration: Perform INT8 quantization on the trained XGBoost model to compress the model size and improve inference speed; set the confidence threshold of the dual-stream switching logic to 0.75.
[0045] Preferably, the lightweight feature engineering and XGBoost model construction in S201 include:
[0046] First, a full multidimensional feature set is extracted from the preprocessed signal, including time-domain features such as mean, variance, skewness, kurtosis, sample entropy, and Hjorth parameter.
[0047] The mean value reflects the DC offset of the signal, and its calculation formula is: mean value ;in, This represents the amplitude of the i-th sampling point, and N is the number of sampling points within the window;
[0048] Variance characterizes the intensity of signal fluctuations, and its calculation formula is: Variance ;
[0049] Skewness measures the asymmetry of signal distribution, and its calculation formula is: Skewness ;
[0050] Kurtosis reflects the sharpness of a signal distribution, and is calculated using the formula: Kurtosis ;
[0051] Sample entropy is a nonlinear dynamic metric that measures the complexity of a signal. Its calculation begins by defining a template vector: Statistical similarity vector ratio: ;in, Let r be the Heaviside function, and r be the similarity threshold (usually taken as 0.2 times the standard deviation); then the final formula for calculating sample entropy is: Sample Entropy Where m=2;
[0052] The Hjorth parameters include: Activity, Mobility, and Complexity.
[0053] The total power of the activity characterization signal is calculated using the following formula: ;
[0054] Mobility reflects the dominant signal frequency, and is calculated using the following formula: ;in, The variance of the first-order difference signal;
[0055] Complexity describes the degree of waveform change, and the calculation formula is: All time-domain features were calculated using rigorous parameter optimization and standardization. Statistical features and Hjorth parameters were standardized using z-scores, and sample entropy was normalized within the [0,1] interval. This process ensured the uniformity of different feature dimensions, laying the foundation for subsequent classification model training.
[0056] Frequency domain characteristics were calculated using the Welch method to determine the power and relative power ratio of each frequency band, employing a 2-second Hanning window and a 50% overlap rate to ensure the stability of the spectrum estimation.
[0057] The power calculation for the delta band (0.5-4Hz) uses the integral method: ;in, It is the power spectral density function;
[0058] The relative power of the band (4-8Hz) is calculated using the following formula: ;
[0059] Peak frequency detection in the α band (8-13Hz) employs the local extremum method to find the global maximum point of the power spectrum within this band. ;
[0060] Absolute power in the β band (13-30Hz) The calculation formula is: ;
[0061] The formula for calculating the β-band power asymmetry index of the left and right hemispheres of the frontal lobe is as follows: ;
[0062] in, and These represent the absolute power of the β band in the left frontal lobe (F3 electrode) and the right frontal lobe (F4 electrode), respectively.
[0063] Secondly, the SHAP interpretability feature selection strategy is introduced. During the tree model construction stage, the importance of feature splitting is calculated based on gain, and the calculation formula is as follows:
[0064] ;
[0065] in, and These are the left and right node sample sets after the split, respectively. and Let these represent the first and second derivatives of the loss function, respectively. and For regularization parameters;
[0066] Secondly, TreeExplainer is used to analyze the initial training model, calculate the SHAP value of each feature and sort them, and retain the top-20 features with the highest contribution (32% of the alpha-theta ratio SHAP value and 28% of the cross-channel correlation) to construct a feature subset;
[0067] Finally, the filtered feature set is input into the XGBoost classifier, with a learning rate of 0.1 and a maximum depth of 6. Multi-class Log-loss is used as the loss function to complete the training. The model parameter size is ≤500KB, and the inference time at a sampling rate of 64Hz is ≤10ms.
[0068] Preferably, the construction of the SleepTransformer model based on dual-branch fusion attention in S202 includes:
[0069] The model network structure consists of three main parts: a signal processing branch, a feature-assisted branch, and a multimodal fusion and classification layer;
[0070] The signal processing branch input dimension is Batch×1920×Channels, which is mapped to 64 dimensions through a linear projection layer, and position encoding is superimposed. Temporal features are extracted through a channel attention module and a 4-layer Transformer encoder.
[0071] The feature auxiliary branch maps the 20-dimensional statistical features into a 64-dimensional vector using an MLP;
[0072] The output vectors of the multimodal fusion and classification layers are concatenated and then input into the fully connected layer to output the probability distribution.
[0073] Based on this, the model is trained using the AdamW optimizer and cross-entropy loss function, and the ReduceLROnPlateau strategy and early stopping mechanism (tolerance of 10 epochs) are introduced. The model parameter size is ≤2MB and the re-judgment time is ≤30ms.
[0074] Compared with the prior art, the beneficial effects achieved by the present invention are:
[0075] 1. To balance real-time performance on portable devices with accuracy in sleep staging, this invention proposes a dual-stream architecture. This architecture combines a lightweight machine learning model (XGBoost) with a deep learning sequence model (SleepTransformer). The XGBoost model has ≤500KB of parameters and inference time ≤10ms, while the SleepTransformer model has ≤2MB of parameters and re-determination time ≤30ms, for a total parameter count ≤2.5MB. This represents a 75% reduction compared to existing 128Hz sampling rate CNN models, with a total inference time ≤40ms (a 60% reduction). Simultaneously, the transition period recognition error is reduced by 20%. Through parallel or switched processing paths, it leverages both the fast inference advantage of XGBoost on low-dimensional features and the performance of SleepTransformer in capturing long-distance temporal dependencies, effectively resolving the technical contradiction of low accuracy in existing models on low sampling rates and low-computing-power devices.
[0076] 2. To adapt to the lightweight computing requirements of edge computing, this invention performs 64Hz downsampling on the acquired EEG signals and introduces an interpretability feature selection strategy based on the SHAP (Shapley Additive exPlanations) algorithm. By retaining only the Top-20 key time-frequency domain features that contribute the most to the staging (such as the Alpha / Theta power ratio and cross-channel correlation), the input dimension and computational load of the model are significantly reduced, achieving efficient initial screening with low power consumption.
[0077] 3. This invention utilizes a SleepTransformer model based on a self-attention mechanism to handle complex sleep stage transitions. Addressing the signal ambiguity during the transition from light sleep (N1) to moderate sleep (N2), this model calculates channel weights through a pooling operation with a 100-sampling-point window. With a weight error ≤3%, it can uncover deep temporal features in the original signal sequence or time-frequency graph, correcting the identification errors of traditional lightweight models in such transition stages and ensuring the robustness of stage segmentation.
[0078] 4. To accurately assess the cognitive recovery state of the brain, this invention establishes a quantitative assessment mechanism based on the functional connectivity strength of specific brain regions. Specifically, during the sleep onset and light sleep stages, the Theta band (4-8Hz) synchronicity between the prefrontal and temporal lobes is monitored, using the Phase Locking Value (PLV) as a quantitative indicator, with a preset baseline threshold of 0.65 (based on the 70th quartile value of N1 statistics from 50 healthy subjects). During the memory consolidation stage, the Sigma band (12-15Hz) connectivity strength between the central region and the occipital lobe is monitored, using the weighted Phase Lag Index (wPLI) as a quantitative indicator, with a preset target threshold of 0.7. This indicator has a sensitivity of ≥0.85 to Sigma band-specific connectivity and a false positive rate of ≤5%, accurately characterizing memory replay and synaptic plasticity levels. Statistical analysis showed that prefrontal-temporal Theta synchronicity was significantly negatively correlated with sleep latency (Pearson correlation coefficient r = -0.78, P < 0.01), while central-occipital Sigma connectivity was significantly positively correlated with memory accuracy (r = 0.82, P < 0.01), demonstrating the scientific validity of the target assessment.
[0079] 5. This invention constructs a closed-loop acoustic intervention mechanism based on brain functional connectivity, realizing real-time feedback from "state monitoring" to "dynamic intervention." The system compares the real-time calculated functional connectivity strength with a preset benchmark value, dynamically adjusts the acoustic stimulation parameters, outputs 6Hz isochronous audio in the sleep guidance mode, outputs enhanced pink noise in the Sigma band in the memory consolidation mode, adjusts the response delay to ≤100ms, induces synchronous brain neural oscillations until the target connectivity level is reached, and effectively promotes the consolidation of learning and memory. Attached Figure Description
[0080] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0081] Figure 1 This is a system overall flowchart of the present invention, which describes a short-term sleep cognitive recovery system and method based on lightweight deep learning.
[0082] Figure 2 This is a schematic diagram of the SleepTransformer model structure of the present invention. Detailed Implementation
[0083] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0084] Please see Figures 1-2 The present invention provides the following technical solution:
[0085] Example 1: As Figure 1 As shown, this embodiment proposes a short-sleep cognitive recovery system based on lightweight deep learning. This system aims to accelerate the recovery of cognitive abilities after learning by monitoring the user's short-sleep state in real time and dynamically adjusting acoustic stimulation according to the neural synchronicity of specific brain regions. The system workflow of this embodiment mainly includes five core steps: signal acquisition and buffering, preprocessing and feature engineering, dual-stream staged inference, functional connectivity analysis, and closed-loop intervention control, as detailed below:
[0086] Step S1. Signal Acquisition and Data Buffering. The system first acquires the user's EEG signals in real time through the EEG acquisition module. This module uses a 19-lead EEG cap based on the international 10-20 system layout, focusing on monitoring key brain regions such as the prefrontal cortex (Fp1, Fp2), temporal lobe (T3, T4), central region (C3, C4), and occipital lobe (O1, O2). The acquisition parameters are set as follows: sampling rate of 64Hz-521Hz, input impedance ≥10MΩ, signal resolution ≤1μV, bandwidth of 0.5-50Hz, and CMRR ≥110dB, ensuring that the signal integrity retention rate of the target frequency bands Theta (4-8Hz) and Sigma (12-15Hz) is ≥95%. To achieve near real-time processing, the system constructs a first-in-first-out (FIFO) data buffer with a sliding window length of 30 seconds (containing 30×64=1920 sampling points) and a sliding step size of 15 seconds. Whenever the buffer accumulates 30 seconds of new data, the subsequent processing flow is triggered.
[0087] Step S2. Signal Preprocessing and Feature Engineering. After the processor reads the raw EEG signal within the current time window, it performs standardized preprocessing: a 0.5-50Hz IIR bandpass filter is applied to remove extremely low-frequency drift and high-frequency noise, and the signal attenuation in the target frequency band is controlled to ≤0.5dB; the ICA algorithm is used to automatically remove EEG and EMG artifacts. After verification with 100,000 samples containing artifacts, the artifact recognition accuracy is ≥92%, and the SNR of the signal after removal is improved by ≥15dB. In the feature extraction stage, the system extracts features according to different paths of the subsequent model: for the XGBoost path, multi-dimensional statistical features are extracted from the 64Hz downsampled signal, covering basic statistics, waveform features, differential features, and abrupt change features; for the SleepTransformer path, a dual-modal input construction is adopted, on the one hand maintaining the time series structure of the original multi-channel signal (dimension of Batch×1920×Channels), and on the other hand reusing the above statistical feature vectors as auxiliary feature branch inputs.
[0088] Step S3. Real-time sleep staging inference based on the dual-stream model. This step is the core discrimination process of the system. It adopts a pre-set dual-stream staging strategy. The model is pre-trained in full supervision based on the DREAMT Dataset (containing 64Hz-200Hz EEG data of 100 subjects and AASM standard annotation). By default, the system calls the lightweight XGBoost classification model for rapid initial screening. This model is filtered by SHAP feature importance and only uses the top-20 key features such as Alpha-Theta ratio and cross-channel correlation for inference. It adopts a 6-layer decision tree, a learning rate of 0.1, a maximum depth of 6, and a parameter size of ≤500KB. The single-window inference time is ≤10ms at a 64Hz sampling rate, and the proportion of non-transition period samples with a discrimination confidence of ≥0.85 is ≥90%. When the XGBoost output confidence is below 0.75, or when a power change rate of ≥30% is detected in adjacent window frequency bands (determined as a critical transition period from N1 to N2), the SleepTransformer deep learning model is activated. This model adopts a dual-branch architecture. The signal processing branch has an input dimension of Batch×1920×Channels. The channel attention module compresses features through average pooling and max pooling with a 100-sampling-point window. The weight calculation error is ≤3%. The weighted sequence is input into a 4-layer stacked Transformer encoder (8 attention heads per layer, Dropout ratio 0.1). The feature auxiliary branch inputs 20-dimensional statistical features into an independent MLP network, which is mapped to a 64-dimensional vector through a "linear layer-ReLU-layer normalization" structure. Finally, the output vectors of the two branches are concatenated by a fusion classification layer and input into a fully connected layer to output the sleep stage label (Wake, N1, N2, N3, REM). The model parameter size is ≤2MB, and the single-window re-judgment time is ≤30ms.
[0089] Step S4. Key Brain Functional Connectivity Analysis. After the staging module determines the current sleep stage, the system immediately calculates the functional connectivity strength for the specific neural mechanisms of that stage: If it is determined to be the sleep onset and light sleep stage (N1), the phase lock value (PLV) of the prefrontal and temporal lobes in the Theta band (4-8Hz) is calculated. The formula for calculating the phase lock value (PLV) is as follows: .
[0090] in, For time points, and In the two signals respectively The instantaneous phase at any given moment. Since brain activity in phase N1 is mainly characterized by the synchronized reorganization of neural oscillation phases rather than coordinated changes in amplitude, the phase-locked value (PLV) was chosen as the evaluation indicator. This separates amplitude information and quantifies only the stability of the phase, thus enabling the sensitive capture of the weak coupling characteristics of the prefrontal-temporal network even when signal amplitude fluctuations are large in the early stages of sleep onset. The calculation window was 1 second, the step size was 0.5 seconds, the calculation error was ≤3%, and the preset baseline threshold was 0.65 (based on the 70th percentile of the Theta synchronicity statistics of 50 healthy subjects in phase N1).
[0091] If the period is determined to be the memory consolidation period (N2), calculate the wPLI functional connectivity strength between the central region and the occipital lobe in the Sigma band (12-15Hz). The formula for calculating the weighted phase lag index (wPLI) is as follows:
[0092] .
[0093] in, The imaginary part of the cross spectrum. The phase difference is used. Because the Sigma band in phase N2 is often accompanied by a strong volume conduction effect (i.e., the same source signal is simultaneously acquired by multiple electrodes), spurious zero-delay correlations occur. wPLI effectively suppresses false positive connections introduced by volume conduction by weighting components with non-zero phase lag, thereby accurately locating the true functional coupling between the central and occipital lobes during memory consolidation. This index ranges from 0 to 1, with a sensitivity ≥0.85 for Sigma band-specific connections. Simulated signal verification shows a false positive rate of ≤5% for non-target band connections, and a preset target threshold of 0.7 (corresponding to the critical value for active memory replay).
[0094] Step S5. Closed-loop acoustic intervention control. The control module implements closed-loop acoustic intervention based on the staged results and connection strength: In sleep guidance mode (W or N1 stage and Theta synchronicity < 0.65), background music carrying 6Hz isochronous audio is played, with an initial volume of 45±5dB(A). The volume is dynamically adjusted according to the difference between synchronicity and the baseline threshold. For every 0.1 increase in the difference, the volume increases by 0.5dB(A), with a maximum volume not exceeding 60dB(A). In Sigma consolidation mode (N2 stage and wPLI < 0.7), pink noise with enhanced Sigma band energy is played. This noise has 30±5dB more energy in the Sigma band than the broad-spectrum pink noise, and the beat intensity is synchronized with the 13.5Hz center frequency, with an adjustment step size of 0.5Hz. When PLV ≥ 0.65 or wPLI ≥ 0.7 is detected, the system activates the attenuation mechanism, reducing the volume at a rate of 1dB(A) / second, and stops outputting after 30 seconds. The response delay for a single round of intervention parameter adjustment is ≤ 100ms. In addition, when the system detects that the user is about to enter the N3 deep sleep period or the preset nap time is over, it switches to the smart wake-up mode and provides a gradually stronger wake-up sound during the light sleep period.
[0095] Through iterative steps, the system achieves a complete closed loop from "signal perception" to "state understanding" and then to "precise intervention." It effectively utilizes the generalization ability of deep learning models and specific neural mechanism physiological indicators, solving the technical problems of delayed intervention timing and lack of personalized feedback in traditional methods.
[0096] Example 2: This example details the construction process of the core algorithm modules (XGBoost lightweight model and SleepTransformer deep learning model) in the system described in Example 1. It utilizes pre-training on publicly available standard datasets and employs feature selection and model tuning strategies to address the technical challenges of low grading accuracy and limited computing resources on portable devices with low sampling rates. The specific steps are as follows:
[0097] Step S1. Data Preparation and Standardization. The DREAMTDataset, containing 100 participants (aged 20-80 years), was selected. This dataset includes multimodal sleep signal data and expert annotations. The original annotations were uniformly mapped to the AASM standard five-category labels (Wake, N1, N2, N3, REM). Based on the latest standards of the American Academy of Sleep Medicine (AASM) Manual for the Scoring of Sleep and Associated Events, the stages are defined as follows: Wake (W stage) represents the awake state, with EEG characteristics dominated by occipital-dominant alpha rhythms (8-13Hz) or low-amplitude mixed-frequency activity; N1 stage is the first stage of non-rapid eye movement (NREM) sleep, a transitional stage from wakefulness to sleep, characterized by the disappearance of background alpha waves, replaced by low-amplitude, mixed-frequency (4-7Hz) theta waves, possibly accompanied by vertex sharp waves; N2 stage is the second stage of NREM, characterized by the appearance of sleep spindles. The frequency range is 11-16Hz or K-complexes; N3 is the third stage of NREM, i.e., slow-wave sleep, characterized by more than 20% of slow-wave activity with a frequency of 0.5-2Hz and an amplitude ≥75μV across all leads; REM is the rapid eye movement sleep stage, characterized by mixed-frequency EEG activity, rapid eye movements, and extremely low muscle tone. To simulate the actual operating environment of portable hardware, the original high-resolution EEG signal was downsampled to 64Hz as the baseline data format for model training.
[0098] Step S2. Sample equalization. To address the imbalance problem in sleep data categories (too many samples in N2 stage, and scarce samples in N1 and N3 stages), a data augmentation strategy is introduced during the training phase: a 30-second sliding window is used to segment the continuous signal; an overlapping sliding strategy is used to increase the sample size for the scarce categories (N1, N3), and a non-overlapping sliding strategy is used for the majority categories (W, N2); combined with the SMOTE algorithm, minority class samples are synthesized in the feature space to ensure the model's sensitivity to the N1 transition period and prevent the decision boundary from shifting towards the majority class.
[0099] Step S3. First-line: Lightweight Feature Engineering and XGBoost Model Construction. First, extract the full multidimensional feature set from the preprocessed signal, where time-domain features include mean, variance, skewness, kurtosis, sample entropy, and Hjorth parameter. The mean reflects the DC offset of the signal, and its calculation formula is:
[0100] .
[0101] in, Let N represent the amplitude of the i-th sampling point, and N be the number of sampling points within the window. Variance characterizes the intensity of signal fluctuations and is calculated using the following formula: .
[0102] Skewness measures the asymmetry of signal distribution, and its calculation formula is as follows:
[0103] .
[0104] Kurtosis reflects the sharpness of the signal distribution, and the calculation formula is:
[0105] .
[0106] Sample entropy (SampEn) is a nonlinear dynamic metric that measures the complexity of a signal. The calculation begins by defining a template vector: .
[0107] Statistical similarity vector ratio: .
[0108] in Here, r is the Heaviside function, and r is the similarity threshold (usually taken as 0.2 times the standard deviation). The final formula for calculating sample entropy is: .
[0109] Where m=2. The Hjorth parameters include Activity, Mobility, and Complexity. Activity characterizes the total signal power and is calculated using the following formula: .
[0110] Mobility reflects the dominant signal frequency, and is calculated using the following formula: .
[0111] in Let Variance be the variance of the first-order difference signal. Complexity describes the degree of waveform variation and is calculated using the following formula:
[0112] .
[0113] All time-domain features underwent rigorous parameter optimization and standardization. Statistical features and Hjorth parameters were standardized using z-scores, and sample entropy was normalized within the [0,1] interval. This process ensured the uniformity of different feature dimensions, laying the foundation for subsequent classification model training.
[0114] Frequency domain characteristics were calculated using the Welch method to determine the power and relative power ratio of each frequency band, employing a 2-second Hanning window and a 50% overlap rate to ensure the stability of the spectrum estimation. Power calculation for the delta band (0.5-4Hz) used an integral method.
[0115] .
[0116] in is the power spectral density function. The relative power of the band (4-8Hz) is calculated using the following formula:
[0117] .
[0118] Among them, the peak frequency detection of the α band (8-13Hz) adopts the local extremum method to find the global maximum point of the power spectrum within this frequency band. Absolute power in the β band (13-30Hz) The calculation formula is:
[0119] .
[0120] The formula for calculating the β-band power asymmetry index of the left and right hemispheres of the frontal lobe is as follows:
[0121] .
[0122] in, and These represent the absolute power of the β band in the left frontal lobe (F3 electrode) and the right frontal lobe (F4 electrode), respectively.
[0123] Secondly, the SHAP interpretability feature selection strategy is introduced. During the tree model construction stage, the importance of feature splitting is calculated based on gain, and the calculation formula is as follows:
[0124] .
[0125] in, and These are the left and right node sample sets after the split, respectively. and Let these represent the first and second derivatives of the loss function, respectively. and This is the regularization parameter.
[0126] Then, TreeExplainer was used to analyze the initially trained model, calculate the SHAP value of each feature and sort them, retaining the top-20 features with the highest contribution (32% alpha-theta ratio SHAP value and 28% cross-channel correlation) to construct a feature subset. Finally, the filtered feature set was input into the XGBoost classifier, with a learning rate of 0.1, a maximum depth of 6, and multi-class log-loss as the loss function for training. The model parameters were ≤500KB, and the inference time at a 64Hz sampling rate was ≤10ms.
[0127] Step S4. Second Stream: Construction of the SleepTransformer model based on dual-branch fusion attention. The network structure consists of three main parts: a signal processing branch (input dimension Batch×1920×Channels, mapped to 64 dimensions through a linear projection layer, with positional encoding superimposed, and temporal features extracted through a channel attention module and a 4-layer Transformer encoder), a feature auxiliary branch (mapping 20-dimensional statistical features to a 64-dimensional vector through an MLP), and a multimodal fusion and classification layer (concatenating the output vectors of the two branches, inputting the probability distribution to the fully connected layer). Training uses the AdamW optimizer and cross-entropy loss function, introducing the ReduceLROnPlateau strategy and an early stopping mechanism (tolerance of 10 epochs), with model parameters ≤2MB and re-judgment time ≤30ms.
[0128] Step S5. Model Quantization and Integration. The trained XGBoost model is quantized using INT8 to compress the model size and improve inference speed; the confidence threshold for the dual-stream switching logic is set to 0.75. Experimental results show that this dual-stream strategy reduces the transition period recognition error by 20% on a 64Hz low sampling rate test set, effectively supporting the system's performance in practical applications.
[0129] Example 3: This example aims to verify the effectiveness of the closed-loop system described in Example 1 in improving learning ability and accelerating cognitive recovery in real-world application scenarios (such as short naps). A test environment based on real users is constructed to record in detail the system's operational status and intervention effects throughout the entire process of sleep guidance, sleep maintenance, and wake-up.
[0130] Step S1. Experimental Setup and Data Collection. To verify the actual effectiveness of the system, a standardized experimental environment was first constructed. Regarding the selection of subjects, this embodiment comprehensively considered the statistical power of the experimental design and the feasibility of engineering validation, selecting 12 healthy subjects aged 22 to 26 years as the first batch of validation users for this system. This sample size conforms to the design specifications of small-sample self-controlled pre- and post-intervention experiments, meaning that each subject must complete the test under both no-intervention and closed-loop intervention conditions. This design eliminates the interference of baseline differences between individuals, significantly improves the statistical power, and is sufficient to reflect the significant differences brought about by the system intervention in the preliminary validation stage. According to the post-hoc power analysis of G*Power software, with the existing sample size, the statistical power (Power) for the expected significant intervention effect (effect size d ≥ 0.8) of this system exceeds 80%, which is sufficient to scientifically and effectively verify the actual effect of the technical solution. All subjects had normal or corrected vision and no history of hearing or sleep disorders. The experiment employed a self-controlled design, with each participant completing two 30-60 minute lunch break experiments, spaced one week apart to eliminate fatigue effects. Two modes were used: a control mode where participants wore the system hardware during their lunch break, but the system only performed signal acquisition and phased recording functions without outputting any acoustic stimulation; and an experimental mode where participants wore the system hardware and activated the closed-loop intervention function. The system identified sleep stages in real time according to the process described in Example 1 and automatically generated enhanced music in the Theta or Sigma bands when trigger conditions were met. To quantify cognitive recovery, participants were required to complete a standardized N-back working memory task before and after each lunch break, recording reaction time and accuracy.
[0131] Step S2. Specific execution process of closed-loop intervention. During the operation of the experimental mode, the system background recorded detailed automatic control logs, verifying the triggering accuracy of the dual-stream model and intervention logic. Log data showed that during the sleep induction stage, when the XGBoost model continuously determined that the subject was in stage N1, and the cognitive state assessment module calculated that the Theta wave synchronicity of the prefrontal and temporal lobes (Fp-T area) was lower than the preset baseline threshold, the system was able to quickly activate the acoustic module and play background music carrying 6Hz isochronous audio. As the Theta synchronicity in the EEG signal gradually increased, the system automatically lowered the volume until the subject entered a deeper sleep stage. Subsequently, during the memory consolidation stage, when the system confirmed that the subject had entered stage N2 through the SleepTransformer model and detected characteristic sleep spindle activity, the system successfully switched to a pink noise mode enhanced in the Sigma band (12-15Hz). This process, through acoustic resonance at specific frequencies, strengthened the functional connection between the central area and the occipital lobe (CO area), effectively promoting cortical consolidation of hippocampal information.
[0132] Step S3. Verification Results Analysis. By comprehensively comparing behavioral and electrophysiological data from the experimental and control modes, the beneficial effects of the system of this invention in improving cognitive recovery efficiency were verified. Data analysis showed that, compared to the control mode without intervention, subjects exhibited significant performance improvements in the N-back task after closed-loop intervention using this system. Specifically, task accuracy showed an upward trend, with an average improvement of approximately 15%, while average reaction speed was significantly accelerated and response time shortened by approximately 19%, indicating that the system intervention effectively alleviated cognitive fatigue and improved mental acuity. Furthermore, offline source analysis of the recorded EEG data confirmed the accuracy of the system's real-time monitoring. During the transition from wakefulness to light sleep (W-N1), the EEG signals in the experimental mode showed stronger synchronicity of the Theta bands in the prefrontal and temporal lobes; during the sleep consolidation phase (N2), the functional connectivity strength of the Sigma bands in the central and occipital regions was significantly higher than in the control mode (P<0.05). Spearman correlation analysis further revealed that the increase in connection strength is positively correlated with the improvement in task accuracy, proving the scientific validity and effectiveness of the neural modulation target selected in this invention.
[0133] Step S4. Conclusion. This embodiment confirms that by integrating XGBoost lightweight initial screening, SleepTransformer precise staging, and closed-loop acoustic intervention based on functional connectivity, the system of this invention can accurately capture key sleep characteristics and implement precise intervention without changing the user's sleep habits, significantly optimizing the quality of short sleep and cognitive recovery efficiency, and possessing extremely high practical application value.
[0134] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A short-term sleep cognitive recovery system based on lightweight deep learning, characterized in that: The system includes: an EEG signal acquisition module, a signal preprocessing module, a sleep stage reasoning module, a cognitive state assessment module, and a closed-loop acoustic intervention module; The EEG signal acquisition module is used to acquire the user's EEG signals; The signal preprocessing module is used to filter, remove artifacts, and perform sliding window segmentation on the EEG signals. The sleep stage reasoning module is connected to the signal preprocessing module and performs real-time sleep stage discrimination on the EEG signal of the current time window based on a preset dual-stream discrimination architecture. The cognitive state assessment module is used to calculate the functional connectivity strength between specific brain regions based on the sleep stage discrimination results. The closed-loop acoustic intervention module is used to dynamically generate and output acoustic stimulation signals based on the deviation between the functional connection strength and the preset reference value. The dual-stream discrimination architecture of the sleep staging inference module includes a lightweight XGBoost model for low-power initial screening and a deep learning SleepTransformer model for precise judgment of temporal features.
2. The short-term sleep cognitive recovery system based on lightweight deep learning as described in claim 1, characterized in that, The dual-stream discrimination architecture of the sleep staging inference module includes: First processing flow: The input EEG signal is downsampled at 64Hz to extract time-frequency domain features, and then input to the preset XGBoost classifier; The second processing flow: maintains the time-series structure of the input EEG signal or converts it into a time-frequency graph, and inputs it into a preset SleepTransformer neural network model based on a self-attention mechanism; Switching logic: The system defaults to running the first processing stream; when the output confidence of the XGBoost classifier is lower than 0.75, or when the power change rate of adjacent window bands is detected to be ≥30%, it is determined to be the transition boundary of the sleep stage, and the second processing stream is activated for correction.
3. The short-term sleep cognitive recovery system based on lightweight deep learning as described in claim 2, characterized in that, The SleepTransformer neural network model adopts a dual-branch fusion architecture, including: Signal processing branch: This branch is used to process the raw EEG time series. It contains a channel attention module, which is configured to compress features through average pooling and max pooling operations with a 100-sampling-point window in the time dimension, calculate channel weights with a weight calculation error of ≤3%, and adaptively weight the multi-channel signals. Then, it is connected to a multi-layer Transformer encoder to extract temporal features. Feature auxiliary branch: used to process the extracted time-frequency domain statistical features, and to map the 20-dimensional statistical features to a 64-dimensional high-dimensional feature space through a multilayer perceptron; Fusion classification layer: configured to concatenate the output vector of the signal processing branch with the output vector of the feature auxiliary branch, and then input it into the fully connected layer for classification.
4. The short-term sleep cognitive recovery system based on lightweight deep learning as described in claim 2, characterized in that, The input feature selection method for the XGBoost classifier includes: The SHAP algorithm is used to rank the feature importance of the pre-trained model, calculate the mean absolute value of the SHAP of each feature, and select the top-20 features with the highest contribution to construct a feature subset. The Top-20 features include the power ratio of the Alpha and Theta bands, cross-channel correlation features, and other key time-frequency domain features.
5. The short-term sleep cognitive recovery system based on lightweight deep learning as described in claim 1, characterized in that, The control logic of the closed-loop cognitive recovery system includes: Sleep guidance mode: In response to the sleep stage inference module determining whether the current state is wakefulness or light sleep and the prefrontal-temporal lobe Theta frequency band synchronization is below the preset threshold of 0.65, background music with 6Hz isochronous audio is output. The initial volume is 45±5dB. For every 0.1 increase in the difference between the prefrontal-temporal lobe Theta frequency band synchronization and the preset threshold of 0.65, the volume increases by 0.5dB, and the maximum volume does not exceed 60dB. Memory consolidation mode: In response to the sleep stage reasoning module determining that the current sleep stage is in the middle sleep stage and the functional connection strength of the central zone-occipital lobe Sigma band is lower than the target value of 0.7, pink noise with enhanced Sigma band energy is output. The energy of this noise in the Sigma band is 30±5dB higher than that of the broad spectrum pink noise. The beat intensity is synchronized with the 13.5Hz center frequency and the adjustment step is 0.5Hz. The closed-loop acoustic intervention module is also configured with a real-time adjustment function: based on the difference between the real-time calculated functional connection strength and the target threshold, the volume, beat intensity, and frequency parameters of the output acoustic signal are dynamically adjusted; when the functional connection strength reaches or exceeds the target threshold, the volume is reduced at a rate of 1dB / second, and the output stops after 30 seconds, with a single-round adjustment response delay of ≤100ms.
6. A short-term sleep cognitive recovery method based on a lightweight deep learning-based short-term sleep cognitive recovery system as described in any one of claims 1-5, characterized in that, The method includes: S100: Real-time acquisition of the user's multi-channel EEG signals via the EEG signal acquisition module; S200. Input the signal segment into the preset dual-stream phased model. Prioritize the use of the XGBoost model with SHAP feature filtering for lightweight inference. The single-window inference time is ≤10ms. When the confidence level is <0.75 or a phase transition boundary is detected, use the SleepTransformer model for time-series feature re-judgment. The re-judgment time is ≤30ms. Output the current sleep stage. S300. If the current stage is light sleep, the phase-locked value is used to calculate the Theta band phase synchronization between the prefrontal and temporal lobes, with a calculation window of 1 second and a step size of 0.5 seconds, and a calculation error of ≤3%. If the current stage is intermediate sleep, the weighted phase lag index is used to calculate the Sigma band functional connectivity strength between the central region and the occipital lobe, with a sensitivity to Sigma band specific connectivity ≥0.85 and a false positive rate of ≤5%. S400. Compare the calculated synchronicity or connection strength with the preset cognitive recovery baseline curve. The baseline threshold for stage N1 is 0.65, and the target threshold for stage N2 is 0.
7. S500: Based on the comparison results, generate corresponding acoustic intervention strategies, and induce brain neural oscillation synchronization by adjusting acoustic parameters until the target connection strength is reached, with the response delay adjusted to ≤100ms.
7. The short-sleep cognitive recovery method as described in claim 6, characterized in that, The pre-set dual-flow phased model in S200 includes: S201, First-class: Lightweight feature engineering and XGBoost model construction; S202, Second Stream: Construction of SleepTransformer Model Based on Dual-Branch Fusion Attention; S203. Model Quantization and Integration: Perform INT8 quantization on the trained XGBoost model to compress the model size and improve inference speed; set the confidence threshold of the dual-stream switching logic to 0.
75.
8. The short-sleep cognitive recovery method as described in claim 7, characterized in that, The lightweight feature engineering and XGBoost model construction in S201 include: First, a full multidimensional feature set is extracted from the preprocessed signal, including time-domain features such as mean, variance, skewness, kurtosis, sample entropy, and Hjorth parameter. The mean value reflects the DC offset of the signal, and its calculation formula is: mean value ;in, This represents the amplitude of the i-th sampling point, and N is the number of sampling points within the window; Variance characterizes the intensity of signal fluctuations, and its calculation formula is: Variance ; Skewness measures the asymmetry of signal distribution, and its calculation formula is: Skewness ; Kurtosis reflects the sharpness of a signal distribution, and is calculated using the formula: Kurtosis ; Sample entropy is a nonlinear dynamic metric that measures the complexity of a signal. Its calculation begins by defining a template vector: Statistical similarity vector ratio: ;in, Let r be the Heaviside function and r be the similarity threshold; then the final formula for calculating sample entropy is: Sample Entropy Where m=2; Hjorth parameters include: activity, mobility, and complexity; The total power of the activity characterization signal is calculated using the following formula: ; Mobility reflects the dominant signal frequency, and is calculated using the following formula: ;in, The variance of the first-order difference signal; Complexity describes the degree of waveform change, and the calculation formula is: ; Frequency domain characteristics were calculated using the Welch method to determine the power and relative power ratio of each frequency band, employing a 2-second Hanning window and a 50% overlap rate to ensure the stability of the spectrum estimation. The delta band power calculation uses the integral method: ;in, It is the power spectral density function; The relative power of a band is calculated using the following formula: ; The α-band peak frequency detection employs the local extremum method to find the global maximum point of the power spectrum within this frequency band. ; Absolute power of the beta band The calculation formula is: ; The formula for calculating the β-band power asymmetry index of the left and right hemispheres of the frontal lobe is as follows: ; in, and These represent the absolute power of the β band in the left and right frontal lobes, respectively. Secondly, the SHAP interpretability feature selection strategy is introduced. During the tree model construction stage, the importance of feature splitting is calculated based on gain, and the calculation formula is as follows: ; in, and These are the left and right node sample sets after the split, respectively. and Let these represent the first and second derivatives of the loss function, respectively. and For regularization parameters; Secondly, TreeExplainer is used to analyze the initial trained model, calculate the SHAP value of each feature and sort them, and retain the top-20 features with the highest contribution to construct a feature subset; Finally, the filtered feature set is input into the XGBoost classifier, with a learning rate of 0.1 and a maximum depth of 6. Multi-class Log-loss is used as the loss function to complete the training. The model parameter size is ≤500KB, and the inference time at a sampling rate of 64Hz is ≤10ms.
9. The short-sleep cognitive recovery method as described in claim 7, characterized in that, The construction of the SleepTransformer model based on dual-branch fusion attention in S202 includes: The model network structure consists of three main parts: a signal processing branch, a feature-assisted branch, and a multimodal fusion and classification layer; The signal processing branch input dimension is Batch×1920×Channels, which is mapped to 64 dimensions through a linear projection layer, and position encoding is superimposed. Temporal features are extracted through a channel attention module and a 4-layer Transformer encoder. The feature auxiliary branch maps the 20-dimensional statistical features into a 64-dimensional vector using an MLP; The output vectors of the multimodal fusion and classification layers are concatenated and then input into the fully connected layer to output the probability distribution. Based on this, the model is trained using the AdamW optimizer and cross-entropy loss function, and the ReduceLROnPlateau strategy and early stopping mechanism are introduced. The model parameter size is ≤2MB and the re-judgment time is ≤30ms.