Mobile terminal sleep staging method based on lightweight deep learning and mixed time sequence correction

By using a dual-stream separable convolutional network and a hybrid temporal correction method on mobile devices, the computational resource and accuracy issues of existing sleep staging methods on mobile devices are solved, achieving efficient and accurate sleep staging while ensuring data privacy.

CN122050892APending Publication Date: 2026-05-15DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DALIAN UNIV OF TECH
Filing Date
2026-03-05
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing automatic sleep staging methods suffer from problems such as large number of parameters, heavy computational burden, insufficient accuracy, and insufficient physiological constraints when deployed on mobile devices, making it difficult to meet the requirements of lightweight design and high accuracy.

Method used

Feature extraction is performed using a lightweight deep learning-based two-stream separable convolutional network. Combined with Savitzky-Golay filters and Viterbi decoding of hidden Markov models, hybrid temporal correction is performed to ensure that sleep staging results conform to physiological patterns.

Benefits of technology

It achieves high-precision real-time sleep monitoring on mobile devices, reduces computing resource requirements, ensures the accuracy and physiological rationality of the staged results, and protects data privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122050892A_ABST
    Figure CN122050892A_ABST
Patent Text Reader

Abstract

The invention provides a mobile terminal sleep staging method based on lightweight deep learning and mixed time sequence correction, and the method comprises the steps: constructing and training a lightweight feature extraction network based on double-flow separable convolution at a server side, converting a trained model into a special format for a mobile terminal, extracting parameters of the hidden Markov model to generate a configuration file; the method comprises the following steps: receiving a single-channel electroencephalogram signal data stream in real time at a mobile terminal, constructing a data buffer area in a memory for caching, and generating an input tensor when data accumulation reaches a preset duration; loading a lightweight feature extraction network at a mobile terminal, performing forward reasoning on an input tensor, and outputting an initial probability vector of each sleep stage; sequentially carrying out Savitzky-Golay filter smoothing processing and Viterbi decoding based on a hidden Markov model on the initial probability vector to obtain a global optimal sleep state sequence; and generating a local sleep time phase diagram and sleep indexes according to the global optimal sleep state sequence, and locally storing and displaying the local sleep time phase diagram and the sleep indexes at the mobile terminal without uploading to the cloud.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sleep monitoring technology, and more particularly to a mobile sleep staging method based on lightweight deep learning and hybrid temporal correction. Background Technology

[0002] Sleep staging is a technique that divides the sleep process into different stages by analyzing physiological signals, and it is a core step in diagnosing sleep disorders. Polysomnography (PSG), as the clinical gold standard, requires experts to manually interpret multimodal data such as EEG, EEG, and EMG, which suffers from low efficiency, high cost, and susceptibility to subjective influence on interpretation results. With the widespread adoption of wearable devices, developing automated sleep staging technology suitable for mobile devices has become a research hotspot, which places stringent demands on the lightweight deployment and real-time processing capabilities of algorithms.

[0003] Existing automatic sleep staging methods generally employ deep learning techniques, but they suffer from significant limitations in practical applications. First, most models are based on complex convolutional neural network architectures, resulting in a massive number of parameters that makes deployment on mobile devices difficult. For example, DeepSleepNet uses a CNN-LSTM hybrid structure with tens of millions of parameters; TinySleepNet, despite optimization, still retains millions of parameters, failing to meet the storage limitations of smartphones and other terminal devices. Second, attention mechanisms or graph neural networks introduced to improve accuracy further exacerbate the computational burden. For instance, AttnSleep uses a multi-resolution CNN combined with a self-attention mechanism, and JK-STGCN uses a spatiotemporal graph convolutional network. While these designs can capture long-range dependencies, they significantly increase floating-point operations and energy consumption. Furthermore, existing purely data-driven methods lack physiological constraints, easily leading to erroneous predictions that violate sleep cycle patterns, such as jumping directly from deep sleep (N3) to wakefulness. Although PicoSleepNet and others attempt to compress parameters to 26,000 using spiking neural networks, their advantages rely on dedicated hardware, making it difficult to achieve performance on general-purpose mobile platforms. These shortcomings mean that existing technologies are either too bulky to be practical, or they sacrifice accuracy excessively for lightweight design, making it difficult to balance the needs of mobile deployment with clinical-grade accuracy. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides a mobile sleep staging method based on lightweight deep learning and hybrid temporal correction. This invention primarily utilizes a two-stream separable convolutional network to extract features from single-channel EEG signals and explicitly output the posterior probabilities of five sleep stages. It combines Savitzky-Golay filter smoothing with Viterbi decoding of a Hidden Markov Model based on physiological prior constraints for hybrid temporal correction. This achieves the technical effects of clearly defining the physical meaning and dimensions of the probability output, ensuring that sleep staging results conform to physiological laws, realizing real-time high-precision sleep monitoring on mobile devices, and protecting data privacy.

[0005] The technical means employed in this invention are as follows:

[0006] A mobile sleep staging method based on lightweight deep learning and hybrid temporal correction includes: S1. Build and train a lightweight feature extraction network based on two-stream separable convolution on the server side, convert the trained model into a mobile-specific format, and extract the parameters of the hidden Markov model to generate a configuration file. S2. Receive single-channel EEG signal data stream in real time on the mobile terminal, build a data buffer in memory for caching, and generate an input tensor when the data accumulation reaches a preset duration. S3. Load the lightweight feature extraction network on the mobile device, perform forward inference on the input tensor, and output the initial probability vector for each sleep stage. S4. The initial probability vector is smoothed by Savitzky-Golay filter and then Viterbi decoding based on hidden Markov model to obtain the globally optimal sleep state sequence. S5. Generate a local sleep phase diagram and sleep indicators based on the global optimal sleep state sequence, and store and display them locally on the mobile device without uploading to the cloud.

[0007] Further, step S1 includes: S11. Construct a two-stream separable convolutional backbone network using TensorFlow or PyTorch framework. The two-stream separable convolutional backbone network includes a parallel-designed main feature extraction path and a residual preservation path. Depth-separable convolution is used to decompose the standard convolution into depthwise convolution and pointwise convolution. The network is trained using a public sleep dataset. S12. Convert the trained model weight file to TensorFlow Lite format and perform quantization compression to generate a lightweight model file; S13. Statistically analyze the state transition matrix and confusion matrix of all sleep stage labels in the training set, and solidify the transition matrix and confusion matrix into a lightweight configuration file. The transition matrix is ​​constructed based on sleep physiology priors, and the confusion matrix is ​​statistically generated based on the model classification results.

[0008] Further, step S2 includes: S21. Receive single-channel EEG signal data stream from the front-end EEG acquisition device in real time via Bluetooth or Wi-Fi interface; S22. Create a circular buffer in the mobile device's memory to continuously cache the raw EEG data sampled. S23. Monitor the amount of data in the buffer. When the accumulated data reaches a set duration, convert the original EEG data into a tensor format that meets the network input requirements and generate an input tensor.

[0009] Further, step S3 includes: S31. When the mobile application starts, initialize the terminal-side inference interpreter and load the lightweight model file into the mobile terminal memory; S32. Input the input tensor into the lightweight feature extraction network, extract transient microstructure and continuous macro features through the two-stream separable convolution module, reduce the dimension through the global average pooling layer, and calculate the posterior probability of the input tensor belonging to the five sleep stages: wakefulness, REM sleep, light sleep N1, light sleep N2 and deep sleep N3 through the Softmax classifier. S33. Output a 5-dimensional probability vector corresponding to the time segment. The 5-dimensional probability vector corresponds to five sleep stages: wakefulness, REM sleep, light sleep N1, light sleep N2, and deep sleep N3. The 5-dimensional probability vector is temporarily stored in a local database or memory queue.

[0010] Further, step S4 includes: S41. Using a sliding window real-time processing mode, the initial probability vector is smoothed by local polynomial fitting to suppress short-term prediction noise caused by signal artifacts, and a smoothed probability sequence is obtained. S42. Read the parameters preset in step S1 to generate a configuration file, load the state transition matrix and emission matrix, the emission matrix being obtained by converting the confusion matrix; S43. Construct a hidden Markov model based on the state transition matrix and emission matrix, decode the smoothed probability sequence using the Viterbi algorithm, search for the globally optimal state path that conforms to the physiological laws of sleep, and output the globally optimal sleep state sequence.

[0011] Further, step S5 includes: S51. Based on the global optimal sleep state sequence, draw a sleep phase diagram locally on the mobile device to visually display the sleep stage transition process throughout the night. S52. Calculate sleep efficiency, the proportion of each stage, and clinical indicators of sleep latency based on the global optimal sleep state sequence. S53. The original EEG signal data, feature vectors, staging results and sleep indicators are stored in the local sandbox of the mobile terminal without the need for a network connection, achieving fully localized privacy protection.

[0012] Furthermore, in step S32, the transient microstructure includes sleep spindle waves and K-complex waves; the continuous macroscopic features include sleep rhythm and spectral energy distribution.

[0013] Furthermore, the method achieves millisecond-level real-time response on mobile devices and supports continuous overnight sleep monitoring.

[0014] Compared with the prior art, the present invention has the following advantages: 1. This invention proposes a method for constructing a dual-stream residual backbone network based on deep-stream separable convolutional (DSSC). This method, through parallel design of DSSC modules containing main feature extraction paths and residual preservation paths, compresses the number of model parameters to approximately 11,000 (11k) and the floating-point operation volume (FLOPs) to only about 3.8M. Compared with traditional deep learning methods, this significantly reduces the demand for computing resources and storage space, effectively extracting transient microstructures (such as sleep spindle waves and K-complex waves) and continuous macroscopic features from single-channel EEG signals.

[0015] 2. This invention proposes a post-processing method that requires no training parameters to correct the temporal consistency of sleep stages. This strategy combines Savitzky-Golay smoothing filtering from signal processing with a Hidden Markov Model (HMM) from probabilistic graphical models: Savitzky-Golay filters are used to smooth the original probability sequence output by the classifier through local polynomial fitting, suppressing short-term noise interference; an HMM containing a state transition matrix (based on physiological priors) and an emission matrix (based on the model confusion matrix) is constructed, and the Viterbi algorithm is used to decode the globally optimal sleep state sequence. This invention combines probabilistic smoothing and HMM post-processing, reducing additional training parameters, avoiding overfitting on small sample data, and ensuring that the output conforms to the physiological patterns of human sleep.

[0016] 3. This invention protects a specific two-stage processing flow, which first uses a lightweight convolutional network for feature classification, and then uses non-deep learning statistical methods for temporal correlation correction. This combination of lightweight convolutional networks and statistical model post-processing significantly reduces computational complexity and memory usage while ensuring expert-level segmentation accuracy.

[0017] 4. On standard datasets such as Sleep-EDF, the method of this invention achieves accuracy comparable to large-scale complex models while maintaining extreme lightweightness.

[0018] Based on the above reasons, this invention can be widely applied in fields such as sleep monitoring. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart of the mobile deployment process of the MobileSleepNet of the present invention.

[0021] Figure 2 This is a diagram of the overall architecture of MobileSleepNet of the present invention. Detailed Implementation

[0022] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.

[0023] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products or devices.

[0024] This invention provides a mobile sleep staging method based on lightweight deep learning and hybrid temporal correction, comprising: S1. Build and train a lightweight feature extraction network based on two-stream separable convolution on the server side, convert the trained model into a mobile-specific format, and extract the parameters of the hidden Markov model to generate a configuration file. S2. Receive single-channel EEG signal data stream in real time on the mobile terminal, build a data buffer in memory for caching, and generate an input tensor when the data accumulation reaches a preset duration. S3. Load the lightweight feature extraction network on the mobile device, perform forward inference on the input tensor, and output the initial probability vector for each sleep stage. S4. The initial probability vector is smoothed by Savitzky-Golay filter and then Viterbi decoding based on hidden Markov model to obtain the globally optimal sleep state sequence. S5. Generate a local sleep phase diagram and sleep indicators based on the global optimal sleep state sequence, and store and display them locally on the mobile device without uploading to the cloud.

[0025] In a specific implementation, as a preferred embodiment of the present invention, step S1 includes: S11. Construct a two-stream separable convolutional backbone network using TensorFlow or PyTorch framework. The two-stream separable convolutional backbone network includes a parallel-designed main feature extraction path and a residual preservation path. Depth-separable convolution is used to decompose the standard convolution into depthwise convolution and pointwise convolution. The network is trained using a public sleep dataset. S12. Convert the trained model weight file to TensorFlow Lite format and perform quantization compression to generate a lightweight model file; S13. Statistically analyze the state transition matrix and confusion matrix of all sleep stage labels in the training set, and solidify the transition matrix and confusion matrix into a lightweight configuration file. The transition matrix is ​​constructed based on sleep physiology priors, and the confusion matrix is ​​statistically generated based on the model classification results.

[0026] In a specific implementation, as a preferred embodiment of the present invention, step S2 includes: S21. Receive single-channel EEG signal data stream from the front-end EEG acquisition device in real time via Bluetooth or Wi-Fi interface; S22. Create a circular buffer in the mobile device's memory to continuously cache the raw EEG data sampled. S23. Monitor the amount of data in the buffer. When the accumulated data reaches the set duration (30 seconds), convert the original EEG data into a tensor format that meets the network input requirements and generate an input tensor.

[0027] In a specific implementation, as a preferred embodiment of the present invention, step S3 includes: S31. When the mobile application starts, initialize the terminal-side inference interpreter and load the lightweight model file into the mobile terminal memory; S32. Input the input tensor into the lightweight feature extraction network, extract transient microstructure and continuous macro features through the two-stream separable convolution module, reduce the dimension through the global average pooling layer, and calculate the posterior probability of the input tensor belonging to the five sleep stages: wakefulness, REM sleep, light sleep N1, light sleep N2 and deep sleep N3 through the Softmax classifier. S33. Output a 5-dimensional probability vector corresponding to the time segment. The 5-dimensional probability vector corresponds to five sleep stages: wakefulness, REM sleep, light sleep N1, light sleep N2, and deep sleep N3. The 5-dimensional probability vector is temporarily stored in a local database or memory queue.

[0028] In a specific implementation, as a preferred embodiment of the present invention, step S4 includes: S41. Using a sliding window real-time processing mode, the initial probability vector is smoothed by local polynomial fitting to suppress short-term prediction noise caused by signal artifacts, and a smoothed probability sequence is obtained. S42. Read the parameters preset in step S1 to generate a configuration file, load the state transition matrix and emission matrix, the emission matrix being obtained by converting the confusion matrix; S43. Construct a hidden Markov model based on the state transition matrix and emission matrix, decode the smoothed probability sequence using the Viterbi algorithm, search for the globally optimal state path that conforms to the physiological laws of sleep, and output the globally optimal sleep state sequence.

[0029] In a specific implementation, as a preferred embodiment of the present invention, step S5 includes: S51. Based on the global optimal sleep state sequence, draw a sleep phase diagram locally on the mobile device to visually display the sleep stage transition process throughout the night. S52. Calculate sleep efficiency, the proportion of each stage, and clinical indicators of sleep latency based on the global optimal sleep state sequence. S53. The original EEG signal data, feature vectors, staging results and sleep indicators are stored in the local sandbox of the mobile terminal without the need for a network connection, achieving fully localized privacy protection.

[0030] In a specific implementation, as a preferred embodiment of the present invention, in step S32, the transient microstructure includes sleep spindle waves and K-complex waves; the continuous macroscopic features include sleep rhythm and spectral energy distribution.

[0031] In a preferred embodiment of the present invention, the method achieves millisecond-level real-time response on mobile devices and supports continuous overnight sleep monitoring.

[0032] In this embodiment, the MobileSleepNet mobile deployment process of the present invention is as follows: Figure 1 As shown. This process combines deep learning algorithms with mobile engineering implementation, mainly covering the following core steps: Offline phase: Model training: The DSSC backbone network was trained using a public dataset.

[0033] Format conversion: Convert the trained model weights to a mobile-specific format (such as .tflite) and perform quantization compression.

[0034] Parameter extraction: The transition and emission matrix parameters of the HMM are statistically analyzed and solidified to generate a lightweight configuration file.

[0035] Online phase: Data stream access: Real-time reception of EEG data streams.

[0036] Edge-side inference: Load the interpreter on the mobile device to perform lightweight feature extraction and classification.

[0037] Hybrid correction: Call the local algorithm library to perform Savitzky-Golay smoothing and Viterbi decoding.

[0038] Interactive display: Real-time generation and display of sleep phase diagrams (Hypnogram).

[0039] In the above deployment process, the overall architecture diagram of the core algorithm MobileSleepNet is as follows: Figure 2 As shown. Its logic mainly includes two stages: Phase 1: Lightweight Feature Extraction This stage utilizes a lightweight CNN network to extract features from the EEG signal and generate initial probability estimates. For efficient computation, the network employs a Dual-Stream Separable Convolution (DSSC) backbone architecture. The DSSC module decomposes standard convolution into depthwise convolution and pointwise convolution through parallel-designed master feature extraction and residual preservation paths, thereby effectively extracting key features from single-channel EEG signals with extremely low parameter counts. Subsequently, through global average pooling (GAP) layers and a softmax classifier, initial probability vectors are output indicating the sleep stage at each time segment.

[0040] Phase Two: Hybrid Temporal Refinement This stage consists of two steps: Savitzky-Golay filter smoothing: used for local probability smoothing. It suppresses short-term prediction noise caused by signal artifacts by performing local polynomial fitting on the probability sequence.

[0041] Hidden Markov Model (HMM) Optimization: Used for global sequence optimization. An HMM containing a state transition matrix (based on physiological priors) and an emission matrix is ​​constructed, and the globally optimal sleep state path is decoded using the Viterbi algorithm.

[0042] By combining probabilistic smoothing with HMM-based temporal optimization, the hybrid optimization method of this invention can jointly mitigate short-term prediction noise and enforce long-term sleep stage transitions that conform to physiological laws, thereby significantly improving the accuracy and robustness of staging.

[0043] Example: Embedding the sleep staging method into a mobile terminal This embodiment details how to fully embed the aforementioned "Mobile Sleep Staging Method Based on Lightweight Deep Learning and Hybrid Temporal Correction" into a resource-constrained mobile terminal (such as a smartphone or embedded medical handheld device) to achieve end-to-end edge inference. The specific implementation steps are as follows: Step 1: Model Training and Lightweight Format Conversion (Offline Stage) Model training: On the server side, build the DSSC backbone network using the TensorFlow or PyTorch framework, train it using a public dataset (such as Sleep-EDF), and obtain the model weight file. To adapt to mobile inference engines, convert the trained model (such as .h5 or .pt format) to a mobile-specific format (such as the .tflite format of TensorFlow Lite).

[0044] HMM parameter extraction: In the offline phase, the transition matrix and confusion matrix of all labels in the training set are statistically analyzed, and these matrix parameters are solidified into a lightweight configuration file (such as JSON or binary array) and packaged with the APP.

[0045] Step 2: Mobile Data Stream Access and Preprocessing (Online Stage) The mobile terminal receives a single-channel EEG data stream from a front-end acquisition device (such as an EEG headband) in real time via Bluetooth (BLE) or Wi-Fi. A buffer is allocated in the mobile terminal's memory to cache the raw data from continuous sampling. When the buffer data accumulates for 30 seconds, an input tensor is generated.

[0046] Step 3: Execution of the edge-side inference engine When the mobile application launches, the on-device inference interpreter (such as TFLite Interpreter) is initialized, and the lightweight model file generated in step 1 is loaded. A 30-second EEG tensor is input into the interpreter, which outputs a 5-dimensional probability vector corresponding to that segment. The generated probability vector is temporarily stored in a local database or memory queue. Savitzky-Golay smoothing is then performed using the mobile native code in a sliding window real-time processing mode. The pre-set HMM parameter matrix from step 1 is read, and the Viterbi algorithm is executed locally on the mobile device.

[0047] Step 4: Result Generation and Interaction Based on the optimal state sequence decoded by Viterbi, a sleep phase diagram (Hypnogram) is directly drawn on the mobile device. Clinical indicators such as sleep score and percentage of each stage are calculated locally and displayed to the user. All data (raw EEG, feature vector, staging results) are stored in a local sandbox on the mobile device, without uploading to the cloud, achieving complete privacy protection.

[0048] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A mobile sleep staging method based on lightweight deep learning and hybrid temporal correction, characterized in that, include: S1. Build and train a lightweight feature extraction network based on two-stream separable convolution on the server side, convert the trained model into a mobile-specific format, and extract the parameters of the hidden Markov model to generate a configuration file. S2. Receive single-channel EEG signal data stream in real time on the mobile terminal, build a data buffer in memory for caching, and generate an input tensor when the data accumulation reaches a preset duration. S3. Load the lightweight feature extraction network on the mobile device, perform forward inference on the input tensor, and output the initial probability vector for each sleep stage. S4. The initial probability vector is smoothed by Savitzky-Golay filter and then Viterbi decoding based on hidden Markov model to obtain the globally optimal sleep state sequence. S5. Generate a local sleep phase diagram and sleep indicators based on the global optimal sleep state sequence, and store and display them locally on the mobile device without uploading to the cloud.

2. The mobile sleep staging method based on lightweight deep learning and hybrid temporal correction according to claim 1, characterized in that, Step S1 includes: S11. Construct a two-stream separable convolutional backbone network using TensorFlow or PyTorch framework. The two-stream separable convolutional backbone network includes a parallel-designed main feature extraction path and a residual preservation path. Depth-separable convolution is used to decompose the standard convolution into depthwise convolution and pointwise convolution. The network is trained using a public sleep dataset. S12. Convert the trained model weight file to TensorFlow Lite format and perform quantization compression to generate a lightweight model file; S13. Statistically analyze the state transition matrix and confusion matrix of all sleep stage labels in the training set, and solidify the transition matrix and confusion matrix into a lightweight configuration file. The transition matrix is ​​constructed based on sleep physiology priors, and the confusion matrix is ​​statistically generated based on the model classification results.

3. The mobile sleep staging method based on lightweight deep learning and hybrid temporal correction according to claim 1, characterized in that, Step S2 includes: S21. Receive single-channel EEG signal data stream from the front-end EEG acquisition device in real time via Bluetooth or Wi-Fi interface; S22. Create a circular buffer in the mobile device's memory to continuously cache the raw EEG data sampled. S23. Monitor the amount of data in the buffer. When the accumulated data reaches a set duration, convert the original EEG data into a tensor format that meets the network input requirements and generate an input tensor.

4. The mobile sleep staging method based on lightweight deep learning and hybrid temporal correction according to claim 1, characterized in that, Step S3 includes: S31. When the mobile application starts, initialize the terminal-side inference interpreter and load the lightweight model file into the mobile terminal's memory; S32. Input the input tensor into the lightweight feature extraction network, extract transient microstructure and continuous macro features through the two-stream separable convolution module, reduce the dimension through the global average pooling layer, and calculate the posterior probability of the input tensor belonging to the five sleep stages: wakefulness, REM sleep, light sleep N1, light sleep N2 and deep sleep N3 through the Softmax classifier. S33. Output a 5-dimensional probability vector corresponding to the time segment. The 5-dimensional probability vector corresponds to five sleep stages: wakefulness, REM sleep, light sleep N1, light sleep N2, and deep sleep N3. The 5-dimensional probability vector is temporarily stored in a local database or memory queue.

5. The mobile sleep staging method based on lightweight deep learning and hybrid temporal correction according to claim 1, characterized in that, Step S4 includes: S41. Using a sliding window real-time processing mode, the initial probability vector is smoothed by local polynomial fitting to suppress short-term prediction noise caused by signal artifacts, and a smoothed probability sequence is obtained. S42. Read the parameters preset in step S1 to generate a configuration file, load the state transition matrix and emission matrix, the emission matrix being obtained by converting the confusion matrix; S43. Construct a hidden Markov model based on the state transition matrix and emission matrix, decode the smoothed probability sequence using the Viterbi algorithm, search for the globally optimal state path that conforms to the physiological laws of sleep, and output the globally optimal sleep state sequence.

6. The mobile sleep staging method based on lightweight deep learning and hybrid temporal correction according to claim 1, characterized in that, Step S5 includes: S51. Based on the global optimal sleep state sequence, draw a sleep phase diagram locally on the mobile device to visually display the sleep stage transition process throughout the night. S52. Calculate sleep efficiency, the proportion of each stage, and clinical indicators of sleep latency based on the global optimal sleep state sequence. S53. The original EEG signal data, feature vectors, staging results and sleep indicators are stored in the local sandbox of the mobile terminal without the need for a network connection, achieving fully localized privacy protection.

7. The mobile sleep staging method based on lightweight deep learning and hybrid temporal correction according to claim 4, characterized in that, In step S32, the transient microstructure includes sleep spindle waves and K-complex waves; the continuous macroscopic features include sleep rhythm and spectral energy distribution.

8. The mobile sleep staging method based on lightweight deep learning and hybrid temporal correction according to claim 4, characterized in that, The method achieves millisecond-level real-time response on mobile devices and supports continuous overnight sleep monitoring.