Individual fine-tuning online adaptive closed-loop neuromodulation system based on timing model
By using a time-series model-based individual fine-tuning online adaptive closed-loop neuromodulation system, the shortcomings of sleep staging methods in terms of individualization and real-time performance are addressed. This system achieves high-accuracy sleep-phase neuromodulation, meets the clinical needs of patients with neuropsychiatric disorders, and ensures data security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI JIAOTONG UNIV
- Filing Date
- 2026-02-12
- Publication Date
- 2026-06-05
AI Technical Summary
Existing sleep staging methods are difficult to achieve individualization, real-time performance, and accuracy, and cannot meet the precise sleep neuromodulation needs of patients with neuropsychiatric disorders. In particular, they suffer from weak cross-individual generalization ability and signal bias in online deployment scenarios.
An online adaptive closed-loop neural modulation system based on a time-series model is adopted to achieve end-to-end closed-loop neural modulation through the construction of a multimodal feature system, training of a cross-domain generalization enhanced population basic model, two-night progressive individualized adaptation, and real-time inference updates.
It improves the accuracy of sleep staging, meets the needs of real-time clinical intervention, achieves high-confidence online updates and targeted neural electrical stimulation, adapts to the fragmented sleep patterns of patients with sleep disorders, and ensures data security and compliance.
Smart Images

Figure CN122157993A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of neural modulation system technology, and more specifically, to an individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model. Background Technology
[0002] Sleep staging is the core foundation for objectively assessing sleep quality and precisely implementing sleep-phase neuromodulation. Its real-time nature, accuracy, and individual suitability directly determine the clinical efficacy of sleep-phase interventions for neuropsychiatric disorders (such as post-traumatic stress disorder, depression, and Alzheimer's disease). With the development of sleep medicine and neuromodulation technology, sleep staging has evolved from traditional manual interpretation to automated intelligent analysis. However, existing technologies still have significant limitations and cannot meet the needs of refined clinical interventions.
[0003] Existing sleep staging methods are mainly divided into two categories: manual interpretation and automated models. Although manual interpretation is considered the "gold standard," requiring professional clinicians to analyze polysomnography (PSG) according to the standards of the American Academy of Sleep Medicine (AASM), it suffers from limitations such as low efficiency, reliance on experience, and difficulty in large-scale application. While automated models simplify the process, they face multiple technical bottlenecks: On the one hand, traditional machine learning methods rely on manual extraction of features such as frequency domain energy and power spectral density, combined with classifiers such as support vector machines and random forests to achieve staging, resulting in low accuracy and inability to respond to real-time needs. On the other hand, although recent deep learning models (such as convolutional neural networks and recurrent neural networks) have improved offline staging accuracy, most are deployed on the server side, relying on the statistical analysis of long-term contextual information from global electrophysiological data throughout the night, which has the problem of "future information leakage." They cannot follow the temporal causality law and can only reason segment by segment based on current and historical data, making it difficult to migrate to online deployment scenarios of "collecting and outputting simultaneously," and failing to meet the real-time intervention needs of sleep-related neural electrical stimulation.
[0004] To achieve online sleep staging, existing technologies attempt two approaches: First, by setting fixed thresholds to identify sleep characteristic waves (such as spindle waves and slow waves) to infer sleep stages. However, significant differences exist between individuals' sleep signals, and signal biases exist across nights and devices. Fixed thresholds are prone to decision bias, and the lack of typical characteristic waves during rapid eye movement (REM) sleep makes this method difficult to apply. Second, deep learning architectures are used for direct online inference or to optimize results through temporal smoothing and sleep cycle constraints. However, these methods generally suffer from weak cross-individual generalization ability. Significant differences exist between individuals in sleep structure, brain wave frequencies, and other physiological characteristics. PSG signals from the same subject can experience domain drift across nights. General models trained on group data show significant performance degradation on new individuals or records, with accuracy often below 80%, and even dropping to around 73% on independent datasets. Furthermore, existing online update algorithms lack high-confidence features or label supervision, requiring additional hyperparameter control, making them prone to erroneous updates, performance fluctuations, and even negative transfer, and difficult to adapt to the fragmented sleep patterns of patients with sleep disorders.
[0005] Sleep neuromodulation, as an effective way to improve sleep quality and emotional memory function in patients with neuropsychiatric disorders, relies heavily on the organic connection between "precise staging and real-time triggering" for its intervention effect. However, existing systems either rely on manual real-time monitoring of polysomnography and manual triggering of stimulation, which is time-consuming, labor-intensive, has significant delays, and poor stability; or they lack a connection mechanism between individualized precise staging and real-time modulation, resulting in insufficient targeting and timeliness of neural electrical stimulation, thus limiting the clinical promotion and application of sleep neuromodulation technology.
[0006] To address these issues, this application proposes a novel online adaptive closed-loop neuromodulation system based on a time-series model for individual fine-tuning. Summary of the Invention
[0007] The purpose of this invention is to provide an online adaptive closed-loop neuromodulation system based on a time-series model for individual fine-tuning, in order to solve the problems mentioned in the background art.
[0008] To achieve the above objectives, the present invention provides the following technical solution: A time-series model-based individual fine-tuning online adaptive closed-loop neural modulation system, the system comprising the following steps: S1. Individual Fit Determination and Multimodal Feature System Construction: Determine the sleep monitoring needs of the target subjects, check whether the subjects have the conditions for collecting polysomnography data for two consecutive nights, adapt the group basic model and the individualized fitting exclusive scoring system for them, and at the same time build a multi-dimensional feature system that combines general feature modules and individualized fitting modules. The general feature modules cover EEG / EOG / EMG multimodal physiological signal features, and the individualized fitting modules include cross-subject alignment features, self-supervised pre-training features and domain adaptive features. S2. Multimodal data acquisition and preprocessing: EEG / EOG / EMG multimodal physiological signals of subjects are collected simultaneously for two consecutive nights using a polysomnography device. Data is acquired by combining direct batch acquisition with real-time synchronization. Valid authorization from the subject must be obtained before acquisition. Layered preprocessing is performed on the acquired data. S3. Training of cross-domain generalization enhanced population base model: Select data from multiple subjects other than the target subjects to construct training and validation sets, train the DBConformer dual-branch temporal backbone network, configure pluggable cross-domain enhancement modules as needed, optimize model parameters through eigenvalue method, and generate a population base model with cross-individual adaptation ability. S4. Two-night progressive individualized adaptation: The two-night protocol of supervised individualized fine-tuning in night 1 and real-time inference in night 2 is adopted. The parameters of the population basic model are loaded, and a small amount of labeled data of the target subjects in night 1 is used for short-term fine-tuning to obtain the individualized model. The night 2 data is input into the model in time sequence and real-time sleep stage inference is performed. S5. Real-time inference and online stable update: During the real-time inference process of Night 2, the sleep stage results and confidence are output only based on the current and historical data. The sliding window cache is maintained simultaneously, and high-confidence segments are selected at preset intervals to generate pseudo-labels. The model is updated in small steps online adaptively without interrupting the real-time inference process. S6. Closed-loop neural modulation triggering and result output: Based on the real-time sleep stage results, the target sleep stage is determined. The trigger command is sent to the neural electrical stimulation device through the data acquisition card. The device is controlled to apply the stimulation current with preset parameters. A result report containing the sleep stage sequence, accuracy, inference time and modulation log is generated and output. At the same time, the data is fed back to the model engine for iterative optimization.
[0009] Preferably, the multi-dimensional feature system in S1 includes general feature modules such as EEG rhythm features, electrooculography (EOG) activity features, and electromyography (EMG) tension features, and individualized adaptation modules such as distribution calibration features generated by cross-subject feature alignment, robust temporal features generated by masked self-supervised pre-training, and domain-invariant features generated by unsupervised domain adaptive generation. The target sleep period includes non-rapid eye movement (NREM) sleep stage 2, NREM sleep stage 3, and rapid eye movement (REM) sleep stage.
[0010] Preferably, the steps of the layered preprocessing operation in S2 are as follows: S22. Bandpass filtering is used to remove power frequency noise and baseline drift from the signal. Z-score normalization is used to map all feature data to a unified interval. A standard time window of 30 seconds / epoch is used to segment the continuous signal. The sampling rate of the resampled data is unified to 256Hz.
[0011] Preferably, the missing value processing is set with threshold rules: when the missing rate of continuous features exceeds 30%, the correlation between the feature and sleep stage is first judged in combination with sleep physiological logic. If the correlation is low, the feature is directly removed. If the correlation is high, a random forest regression model is used to fill in the missing value. When the missing rate of categorical features exceeds 40%, the feature is directly removed. The reasonable range of sleep physiological data is determined by sleep medicine experts in combination with clinical sleep monitoring data from the past 3 years.
[0012] Preferably, the DBConformer dual-branch architecture in S3 includes a time branch and a channel branch. The time branch captures local temporal patterns through one-dimensional convolution and generates time patch tokens by dividing the data into preset patch_size=128 segments. The channel branch models the spatial correlation of EEG / EOG / EMG multimodal signals through channel-dimensional convolution or projection. The features of the two branches are respectively input into the corresponding Transformer networks for global dependency modeling. After feature fusion, the softmax classification head outputs five sleep staging results: W, N1, N2, N3, and REM. The pluggable cross-domain enhancement module includes at least one of the following: a cross-subject feature alignment module, a masked self-supervised pre-training module, and an unsupervised domain adaptive module.
[0013] Preferably, in S4, Night 1 is supervised individualized fine-tuning, including using the cross-entropy loss function, setting a small learning rate of 1 / 10, using 30-50 labeled epochs of data, and completing model parameter calibration after 3-5 finite training rounds. The single epoch inference latency of Night 2 real-time inference is ≤5ms, and the inference process does not depend on future segments or global statistics for the whole night, and follows the constraints of time causality.
[0014] Preferably, the online stable update in S5 includes the following steps: S51. The sliding window cache is maintained according to the inference first, windowing later, and periodic update mechanism, with the preset update interval corresponding to 10 / 30 / 60 epochs (i.e. 5 / 15 / 30 minutes of data). S52. Select segments with a confidence level higher than 0.9 from the window and assign pseudo-labels to form a small batch of training samples; S53. A conservative learning rate, a 1-2 step update limit, a label smoothing coefficient of 0.1, and a gradient clipping stabilization strategy with a threshold of 1.0 are adopted to perform small-step online updates on the model, and the model is immediately switched back to inference mode after the update.
[0015] Preferably, the closed-loop neural modulation trigger in S6 sends a trigger command through the digital output port of the data acquisition card. The transmission delay of the trigger command is ≤10ms. The preset parameters include a current intensity of 0.5-2mA, a frequency of 1-10Hz, and a duration of 1-5 seconds. It can be flexibly configured according to different types of neuropsychiatric disorders. The result report also includes the proportion of each sleep stage, model update log, stimulation trigger time axis, and targeted intervention suggestions.
[0016] Preferably, the cross-subject feature alignment module estimates the reference covariance based on the training set and performs Euclidean alignment on the input signal; the masked self-supervised pre-training module pre-trains the encoder on unlabeled data through masked patch modeling; and the unsupervised domain adaptive module uses domain adversarial training combined with entropy minimization to reduce the distribution difference between the source domain and the target domain.
[0017] Preferably, the individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model includes the following modules: Individual Adaptation Determination and Feature System Construction Module: Used to determine the monitoring needs of subjects, adapt to a dedicated scoring system, and build a multi-dimensional feature system; Multimodal data acquisition and preprocessing module: used to acquire EEG / EOG / EMG signals, perform hierarchical preprocessing operations, and output standardized time-series data; Population base model training module: used to train the DBConformer dual-branch network, configure cross-domain enhancement modules, and generate population base model parameters; Two-Night Individualized Adaptation Module: Used to perform supervised fine-tuning for Night 1 and real-time inference for Night 2, enabling individualized model transfer; Real-time inference and update module: used to output sleep staging results segment by segment and synchronously perform online adaptive updates of the model; Closed-loop control trigger module: used to send trigger commands based on the staged results to control the nerve electrical stimulation device to perform intervention; Data Management and Iteration Module: Used to store model parameters, phased results, and adjustment logs, supporting regular iterative optimization of the model; Data security module: used to perform desensitization processing on the collected sensitive physiological data of subjects, ensuring compliance and security throughout the entire process of data collection, storage and transmission.
[0018] Compared with the prior art, the beneficial effects of the present invention are: 1) This invention, through a cross-domain generalization enhancement module and a two-night progressive adaptation strategy, effectively adapts individual physiological signal differences and cross-night distribution drift to the population base model through supervised fine-tuning in Night 1 (30-50 labeled epochs) and online sliding window adaptation in Night 2. Compared with the general model without individualized adaptation, the accuracy is improved by 1.57%, the Night-2 real-time inference accuracy reaches 82.06%, and the kappa coefficient is ≥0.69, solving the core pain point of weak cross-individual generalization ability of existing models.
[0019] 2) In this invention, Night 2 inference strictly follows the law of temporal causality, relies only on current and historical data, and has a single epoch inference latency of ≤5ms and a trigger instruction transmission latency of ≤10ms, which fully meets the needs of real-time clinical intervention. At the same time, through stabilization strategies such as high-confidence pseudo-label screening, conservative learning rate, and gradient pruning, the fluctuation of model performance during online updates is controllable, with no negative transfer phenomenon, and it is suitable for the fragmented sleep patterns of patients with sleep disorders.
[0020] 3) This invention achieves an end-to-end closed loop of "signal acquisition - individualized staging - triggering and control - data feedback", with a target sleep stage trigger accuracy of 98%. Stimulation parameters (current / frequency / duration) can be flexibly configured according to the type of neuropsychiatric disorder and can also be dynamically fine-tuned based on EEG feedback. The data security module ensures that the entire data process complies with the requirements of the Personal Information Protection Law through mechanisms such as graded desensitization, AES-256 encryption, and RBAC access control. Combined with regular and trigger-based iteration mechanisms, it ensures that the system adapts to clinical needs in the long term. Attached Figure Description
[0021] Figure 1 This is a system flowchart of the present invention; Figure 2 This is a system overview diagram of the present invention; Figure 3 This is a structural diagram of the main model of the present invention; Figure 4 This is a detailed flowchart of the online sliding window adaptive update of the present invention; Figure 5 This is a flowchart illustrating the interaction between all modules of the system according to the present invention. Figure 6 This is a flowchart of the closed-loop neural modulation hardware interaction process of the present invention. Detailed Implementation
[0022] For examples, please refer to Figures 1 to 6 This invention provides a technical solution: an individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model, the system comprising the following steps: S1. Individual Fit Determination and Multi-Dimensional Feature System Construction: Determine the sleep monitoring needs of the target subjects, check whether the subjects have the conditions for collecting polysomnography data for two consecutive nights, adapt the basic group model and the individualized fitting exclusive scoring system for them, and build a multi-dimensional feature system that combines general feature modules and individualized fitting modules. The general feature modules cover EEG / EOG / EMG multimodal physiological signal features (including EEG rhythm features, EEG activity features, and EMG tone features), and the individualized fitting modules include cross-subject alignment features, self-supervised pre-training features, and domain adaptive features. S2. Multimodal data acquisition and preprocessing: EEG / EOG / EMG multimodal physiological signals of subjects are collected simultaneously for two consecutive nights using a polysomnography device. Data is acquired by combining direct batch acquisition with real-time synchronization. Valid authorization from the subject must be obtained before acquisition. Layered preprocessing is performed on the acquired data. S3. Training of the Cross-Domain Generalization Enhanced Population Base Model: Training and validation sets are constructed using data from multiple subjects (excluding the target subjects). A DBConformer dual-branch temporal backbone network is trained (the temporal branch captures local temporal patterns through one-dimensional convolution, generating temporal patch tokens by segmenting according to a preset patch_size=128; the channel branch models the spatial correlation of multimodal signals through channel-dimensional convolution or projection). Pluggable cross-domain enhancement modules are configured as needed. Model parameters are optimized using the eigenvalue method to generate a population base model with cross-individual adaptability. After global modeling and fusion of the dual-branch features using Transformer, the softmax classification head outputs five sleep stage results: W, N1, N2, N3, and REM. The classification probability formula is P(y=k|X)= (z_k is the output of the k-th class of logits, and X is the input feature matrix); S4. Two-Night Progressive Individualized Adaptation: A two-night protocol is adopted, involving supervised individualized fine-tuning on Night 1 and real-time inference on Night 2. Population baseline model parameters are loaded, using 30-50 labeled epochs of target subjects' Night 1 data. A small learning rate of 1 / 10, 3-5 limited training rounds, and a cross-entropy loss function (formula omitted) are used. (N is the number of samples, yik is the true label) is fine-tuned in a short time to obtain an individualized model. Night 2 data is input into the model in chronological order and real-time sleep stage inference is performed. The inference latency per epoch is ≤5ms, and the inference process is based only on the current and historical data that has been reached, following the constraints of time causality. S5. Real-time Inference and Online Stable Updates: During Night 2's real-time inference process, sleep staging results and confidence levels are output only based on current and historical data (confidence level formula Conf(Xi)=max(P(y=k∣Xi))). A sliding window cache is maintained synchronously, and pseudo-labels are generated by filtering segments with confidence levels higher than 0.9 at preset intervals of 10 / 30 / 60 epochs (corresponding to 5 / 15 / 30 minutes of data). A conservative learning rate, a 1-2 step update limit, and a label smoothing coefficient of 0.1 are used (formula is...). Gradient clipping with a threshold of 1.0 (formula is...) A stable strategy is employed to perform small-step online updates to the model without interrupting real-time inference. S6. Closed-loop neural modulation triggering and result output: Based on real-time sleep staging results, the target sleep stage (non-REM sleep stage 2, non-REM sleep stage 3, and REM sleep stage) is determined. A trigger command is sent to the neural electrical stimulation device through the digital output port of the data acquisition card (transmission delay ≤10ms). The device is controlled to apply a stimulation current with preset parameters (0.5-2mA current intensity, 1-10Hz frequency, and 1-5 seconds duration). A multi-dimensional result report containing sleep staging sequence, accuracy, inference time, regulation log, proportion of each sleep stage, and model update log is generated and output. At the same time, the data is fed back to the model engine for iterative optimization.
[0023] The multi-dimensional feature system in S1 includes general feature modules such as EEG rhythm features, electrooculography features, and electromyography tension features. The individualized adaptation module includes distribution calibration features generated by cross-subject feature alignment, robust temporal features generated by masked self-supervised pre-training, and domain-invariant features generated by unsupervised domain adaptive generation. The target sleep stages include non-rapid eye movement (NREM) sleep stage 2, NREM sleep stage 3, and rapid eye movement (REM) sleep stage.
[0024] The steps of the layered preprocessing operation in S2 are as follows: S22. A 5-30Hz bandpass filter is used to remove power frequency noise and baseline drift from the signal, followed by Z-score normalization (formula: (where x is the original value, μ is the mean, and σ is the standard deviation) Map all feature data to a unified interval, use a standard time window of 30 seconds / epoch to segment the continuous signal, and unify the sampling rate of the resampled data to 256Hz.
[0025] Missing value handling threshold rules: When the missing rate of continuous features exceeds 30%, the correlation between the feature and sleep stage is first judged in conjunction with sleep physiology logic. If the correlation is low, the feature is directly removed. If the correlation is high, a random forest regression model is used to fill in the missing value. When the missing rate of categorical features exceeds 40%, the feature is directly removed. The reasonable range of sleep physiology is determined by sleep medicine experts in conjunction with clinical sleep monitoring data from the past 3 years.
[0026] The DBConformer dual-branch architecture in S3 includes a temporal branch and a channel branch. The temporal branch captures local temporal patterns through one-dimensional convolution and generates temporal patch tokens by dividing the data into segments with a preset patch size of 128. The channel branch models the spatial correlation of EEG / EOG / EMG multimodal signals through channel-dimensional convolution or projection. The features from both branches are input into the corresponding Transformer networks for global dependency modeling. After feature fusion, the softmax classification head outputs five sleep staging results: W, N1, N2, N3, and REM. The pluggable cross-domain enhancement modules include at least one of the following: a cross-subject feature alignment module, a masked self-supervised pre-training module, and an unsupervised domain adaptive module. The cross-subject feature alignment module estimates the reference covariance based on the training set and performs Euclidean alignment on the input signal, using the following formula: ( For reference covariance matrix, The training set mean is used for the masked self-supervised pre-training module, which pre-trains on unlabeled data using 15% masked patch modeling to initialize the encoder. An unsupervised domain adaptive module employs domain adversarial training combined with entropy minimization to reduce the distribution difference between the source and target domains. The total loss formula is... ( For classifying losses, For domain confrontation losses, (For entropy minimization loss).
[0027] In S4, Night 1 features supervised individualized fine-tuning, including the use of cross-entropy loss function, setting a small learning rate of 1 / 10, using 30-50 labeled epochs of data, and completing model parameter calibration after 3-5 finite training rounds. Night 2's real-time inference has a single epoch inference latency of ≤5ms, and the inference process does not depend on future segments or global statistics for the entire night, following the constraints of temporal causality.
[0028] Online stable updates in S5 include the following steps: S51. The sliding window cache is maintained according to the inference first, windowing later, and periodic update mechanism, with the preset update interval corresponding to 10 / 30 / 60 epochs (i.e. 5 / 15 / 30 minutes of data). S52. Select segments with a confidence level higher than 0.9 from the window and assign pseudo-labels to form a small batch of training samples; Label smoothing strategy: To reduce the impact of false label noise, label smoothing is introduced, as shown in the following formula: Where ε=0.1 is the smoothing coefficient. It is a pseudo-tag (one-hot encoding). For smoothed labels; S53. A conservative learning rate, a 1-2 step update limit, a label smoothing coefficient of 0.1, and a gradient clipping stabilization strategy with a threshold of 1.0 are adopted to perform small-step online updates on the model, and the model is immediately switched back to inference mode after the update. Gradient clipping: To prevent gradient explosion, the gradient norm is limited to a threshold of 1.0, as shown in the following formula: , where max_norm=1.0, and ||grad|| is the L2 norm of the gradient.
[0029] The closed-loop neural modulation trigger in S6 sends trigger commands through the digital output port of the data acquisition card. The transmission delay of the trigger command is ≤10ms. The preset parameters include a current intensity of 0.5-2mA, a frequency of 1-10Hz, and a duration of 1-5 seconds. It also supports flexible configuration according to different types of neuropsychiatric disorders. The results report also includes the proportion of each sleep stage, model update log, stimulus trigger time axis, and targeted intervention suggestions.
[0030] The cross-subject feature alignment module estimates the reference covariance based on the training set and performs Euclidean alignment on the input signal. The masked self-supervised pre-training module pre-trains the encoder on unlabeled data through masked patch modeling. The unsupervised domain adaptation module uses domain adversarial training combined with entropy minimization to reduce the distribution difference between the source domain and the target domain.
[0031] The time-series model-based individual fine-tuning online adaptive closed-loop neural modulation system includes the following modules: Individual Adaptation Judgment and Feature System Construction Module: This module is used to determine the monitoring needs of subjects, adapt to a specific scoring system, and build a multi-dimensional feature system. Through clinical consultation, it clarifies the subject's neuropsychiatric disorder type and target intervention sleep stage (N2 / N3 / REM stage). It checks whether the subject has the conditions for two consecutive nights (≥7 hours per night) of polysomnography and whether there are any contraindications to electrode wearing. It builds a 14-dimensional multi-dimensional feature system. The general feature module includes 8 items: EEG rhythm features (α / β / δ / θ wave power spectral density), electrooculography features (eye movement amplitude and frequency), and electromyography tone features (amplitude peak value and burst frequency). The individualized adaptation module includes 6 items: cross-subject alignment features, self-supervised pre-training features, and domain adaptive features. The feature dimensions can be dynamically added or removed according to the disease type. Multimodal data acquisition and preprocessing module: Used to acquire EEG / EOG / EMG signals, perform hierarchical preprocessing operations, and output standardized time-series data. It adopts a 32-channel PSG device (compatible with international 10-20 electrode systems, raw sampling rate 256Hz). Night-1 data is directly stored to the local server via the device, and Night-2 data is transmitted in real time with SSL / TLS 1.3 encryption. Preprocessing is performed according to "missing value imputation, outlier identification, filtering, normalization, segmentation, and resampling", and outputs standardized data. The population base model training module is used to train the DBConformer dual-branch network, configure cross-domain enhancement modules, generate population base model parameters, select subjects from the SS3 cohort of the MASS database, and divide the training, test, and validation sets into a 70:15:15 ratio. In the dual-branch network, the temporal branch uses a one-dimensional convolution with kernel_size=3 to capture local temporal patterns and generates 60 temporal patch tokens by splitting the data into patches with patch_size=128. The channel branch projects 14-dimensional features to 32-dimensional features through a 1×1 convolution. The AdamW optimizer (β=0.9, β=0.999, weight decay=0.01) is used for 200 epochs with an initial learning rate of 0.001, decaying by 1 / 10 every 50 epochs. The EA / MPM / UDA cross-domain enhancement modules are configured. The generated population base model validation set accuracy is ≥86% and the kappa coefficient is ≥0.69. The two-night individualized adaptation module is used to perform supervised fine-tuning in Night 1 and real-time inference in Night 2, realizing individualized model transfer. After loading the group model parameters in Night 1, it uses 30-50 epochs of data with AASM standard annotation (covering 5 sleep stages, with at least 6 in each stage), fine-tuning with a small learning rate of 0.0001, 3-5 rounds of training, a batch size of 4, and a cross-entropy loss function. Night 2 adopts a first-in-first-out caching mechanism (maximum 5 epochs cached), inputting data segment by segment, and inference based only on current and historical data. The inference latency per epoch is ≤5ms, and the inference results are output in JSON format (including stage category, confidence level, and timestamp). Real-time inference and update module: used to output sleep staging results segment by segment, synchronously perform online adaptive updates of the model, filter segments with confidence ≥0.9 to generate pseudo-labels, high-risk pseudo-labels (such as N3 stage samples) are automatically verified by the algorithm, and the model is updated with a conservative learning rate of 0.00002, 1-2 update steps, 0.1 coefficient label smoothing and 1.0 threshold gradient pruning. Update parameters are incrementally saved and support rollback, and the update process does not interrupt inference; Closed-loop control trigger module: Used to send trigger commands based on staging results, control the neurostimulation device to perform intervention, monitor staging results in real time, and when two consecutive epochs are in the target sleep stage and the confidence level is ≥0.95, send TTL level trigger commands (high level 5V, low level 0V) through the digital output port of DAQ. The command includes device ID, stimulation parameters, and trigger time. The transmission delay is ≤10ms. It supports Modbus-RTU protocol and is compatible with USB / RS485 interface. It controls the device to apply stimulation to the dorsolateral prefrontal cortex (F3 / F4 electrode position) of the subject at a current intensity of 0.5-2mA, a frequency of 1-10Hz, and a duration of 1-5 seconds. The parameters can be dynamically fine-tuned based on EEG signal feedback. The data management and iteration module stores model parameters, phased results, and adjustment logs. It supports regular model iteration and optimization, uses InfluxDB time-series database to store real-time data, and HDFS distributed file system to store model parameters and feature configurations. It supports a dual mechanism of quarterly regular iteration and iteration triggered by a 5% drop in accuracy. During iteration, the model is retrained and feature parameters are adjusted. Version information, iteration logs, and validation reports (including accuracy and recall metrics) are retained. New models must be tested on an independent validation set (accuracy ≥ 80%) and clinically tested on ≥ 10 subjects before they can be launched online. Data security module: Used to desensitize the collected sensitive physiological data of subjects, ensuring compliance and security throughout the entire process of data collection, storage, and transmission. Sensitive data such as electrode location information and raw EEG signals are desensitized in a graded manner. Key personal identifiers (name, ID number) are replaced with random strings. RBAC role-based access control is adopted, allowing access only to authorized personnel. Data storage is encrypted with AES-256, and transmission is enabled with SSL / TLS 1.3 protocol. An off-site disaster recovery backup mechanism is established, with daily incremental backups and weekly full backups. Backup data is retained for 6 months.
[0032] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. An individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model, characterized in that, The system includes the following steps: S1. Individual Fit Determination and Multimodal Feature System Construction: Determine the sleep monitoring needs of the target subjects, check whether they have the conditions for collecting polysomnography data for two consecutive nights, adapt the basic model of the population and the exclusive scoring system of individual adaptation, and build a multi-dimensional feature system that combines general feature modules and individual adaptation modules. S2. Multimodal data acquisition and preprocessing: Multimodal physiological signals of subjects were simultaneously acquired for two consecutive nights using a polysomnography device. Data were obtained by combining direct batch acquisition with real-time synchronization and the data were then subjected to stratified preprocessing. S3. Cross-domain generalization enhanced population basic model training: Select data from multiple subjects other than the target subjects to construct training and validation sets, train the DBConformer dual-branch temporal backbone network, and generate a population basic model with cross-individual adaptation capabilities. S4. Two-night progressive individualized adaptation: Using Night 1 and Night 2, load the basic parameters of the population model, use a small amount of labeled data from Night 1 of the target subjects for short-term fine-tuning to obtain the individualized model, and input the Night 2 data into the model segment by segment in chronological order to perform real-time sleep stage inference. S5. Real-time inference and stable online updates: Night 2 inference outputs sleep staging results and confidence levels based only on current and historical data, and updates the model in small steps online adaptively without interrupting inference; S6. Closed-loop neural modulation triggering and result output: Based on the real-time staging results, the target sleep stage is determined, and a trigger command is sent to the neural electrical stimulation device through the data acquisition card to generate a report and output it. The data is fed back to the model engine for iterative optimization.
2. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 1, characterized in that: The multi-dimensional feature system in S1 includes general feature modules such as EEG rhythm features, electrooculography features, and electromyography tension features. The individualized adaptation module includes distribution calibration features generated by cross-subject feature alignment, robust temporal features generated by masked self-supervised pre-training, and domain-invariant features generated by unsupervised domain adaptive generation. The target sleep period includes non-rapid eye movement sleep stage 2, non-rapid eye movement sleep stage 3, and rapid eye movement sleep stage.
3. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 1, characterized in that: The steps of the layered preprocessing operation in S2 are as follows: S22. Bandpass filtering is used to remove power frequency noise and baseline drift from the signal. After normalization, all feature data are mapped to a unified interval. A standard time window of 30 seconds / epoch is used to segment the continuous signal. The sampling rate of the resampled data is unified as 256Hz for the MASS dataset and 100Hz for the sleepEDF dataset.
4. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 3, characterized in that: The missing value handling settings include the following threshold rules: when the missing rate of a continuous feature exceeds 30%, the correlation between the feature and sleep stage is first determined by combining sleep physiological logic. If the correlation is low, the feature is directly removed. If the correlation is high, a random forest regression model is used to fill in the missing value. When the missing rate of a categorical feature exceeds 40%, the feature is directly removed. The reasonable range of sleep physiological conditions is determined by sleep medicine experts based on clinical sleep monitoring data from the past three years.
5. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 1, characterized in that: The DBConformer dual-branch architecture in S3 includes a temporal branch and a channel branch. The temporal branch captures local temporal patterns through one-dimensional convolution. The patch_size can be set to 125 or 128 according to the dataset sampling rate, and the time patch token is generated by segmentation. The channel branch models the spatial correlation of EEG / EOG / EMG multimodal signals through channel-dimensional convolution or projection. The features of the two branches are respectively input into the corresponding Transformer network for global dependency modeling. After feature fusion, the softmax classification head outputs five sleep staging results: W, N1, N2, N3, and REM. The pluggable cross-domain enhancement module includes at least one of the following: a cross-subject feature alignment module, a masked self-supervised pre-training module, and an unsupervised domain adaptive module.
6. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 1, characterized in that: The supervised individualized fine-tuning of Night 1 in S4 includes using the cross-entropy loss function, setting a small learning rate of 1 / 10, using 30-50 labeled epochs of data, and completing model parameter calibration after 3-5 finite training rounds. The single epoch inference latency of Night 2 real-time inference is ≤5ms.
7. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 1, characterized in that: The online stable update in S5 includes the following steps: S51. The sliding window cache is maintained according to the inference first, windowing later, and periodic update mechanism, with the preset update interval corresponding to 10 / 30 / 60 epochs (i.e. 5 / 15 / 30 minutes of data). S52. Select segments with a confidence level higher than 0.9 from the window and assign pseudo-labels to form a small batch of training samples; S53. A conservative learning rate, a 1-2 step update limit, a label smoothing coefficient of 0.1, and a gradient clipping stabilization strategy with a threshold of 1.0 are adopted to perform small-step online updates on the model, and the model is immediately switched back to inference mode after the update.
8. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 1, characterized in that: The closed-loop neural modulation trigger in S6 sends a trigger command through the digital output port of the data acquisition card. The transmission delay of the trigger command is ≤10ms. The preset parameters include a current intensity of 0.5-2mA, a frequency of 1-10Hz, and a duration of 1-5 seconds. It can be flexibly configured according to different types of neuropsychiatric disorders. The result report also includes the proportion of each sleep stage, model update log, stimulus trigger time axis, and targeted intervention suggestions.
9. The individual fine-tuning online adaptive closed-loop neural modulation system based on a time-series model according to claim 5, characterized in that: The cross-subject feature alignment module estimates the reference covariance based on the training set and performs Euclidean alignment on the input signal. The masked self-supervised pre-training module pre-trains the encoder on unlabeled data through masked patch modeling. The unsupervised domain adaptive module uses domain adversarial training combined with entropy minimization to reduce the distribution difference between the source domain and the target domain.
10. The individual fine-tuning online adaptive closed-loop neural modulation system based on any one of claims 1-9, characterized in that, Includes the following modules: Individual Adaptation Determination and Feature System Construction Module: Used to determine the monitoring needs of subjects, adapt to a dedicated scoring system, and build a multi-dimensional feature system; Multimodal data acquisition and preprocessing module: used to acquire EEG / EOG / EMG signals, perform hierarchical preprocessing operations, and output standardized time-series data; Population base model training module: used to train the DBConformer dual-branch network, configure cross-domain enhancement modules, and generate population base model parameters; Two-Night Individualized Adaptation Module: Used to perform supervised fine-tuning for Night 1 and real-time inference for Night 2, enabling individualized model transfer; Real-time inference and update module: used to output sleep staging results segment by segment and synchronously perform online adaptive updates of the model; Closed-loop control trigger module: used to send trigger commands based on the staged results to control the nerve electrical stimulation device to perform intervention; Data Management and Iteration Module: Used to store model parameters, phased results, and adjustment logs, supporting regular iterative optimization of the model; Data security module: used to perform desensitization processing on the collected sensitive physiological data of subjects, ensuring compliance and security throughout the entire process of data collection, storage and transmission.