A seizure prediction system and processing method based on subcutaneous implanted electrodes

CN121370082BActive Publication Date: 2026-10-27RENJI HOSPITAL AFFILIATED TO SHANGHAI JIAO TONG UNIV SCHOOL OF MEDICINE +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511975103.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-25
Publication Date
2026-10-27
Estimated Expiration
2045-12-25

AI Technical Summary

Technical Problem

在实时、在线的智能预测算法集成方面,特别是如何利用有限的植入设备计算资源实现高精度、个性化的发作预测,现有技术尚未提供成熟且高效的解决方案

Benefits of technology

[0026]本发明提供了一种基于皮下植入电极的癫痫发作预测系统及处理方法,具备以下有益效果:通过皮下颅骨内植入式电极方式,可有效衰减了颅骨、头皮等组织对信号造成的衰减与干扰,从而获取信噪比显著优于头皮脑电的颅内脑电信号。信号预处理模块通过工频陷波与特定频带的带通滤波,进一步抑制了环境噪声和生理伪迹,为后续分析提供了高质量的干净信号源。另外,本发明通过采用双级联特征编码器结构,将低层次特征映射到一个蕴含丰富上下文信息的高层次特征空间中。这种特征表征具有更强的判别力和对个体差异、噪声干扰的鲁棒性。预测分析模块通过一个集成了多尺度时序建模的预测头网络,计算出未来发作的概率值。为应对不同患者间的生理差异,系统引入了基于知识蒸馏的本地化增量学习机制。该机制允许预测模型在用户本地设备上,利用个体数据持续进行微调,实现个性化适配。并且,通过知识蒸馏损失函数,约束个性化模型在适应新数据时,其输出决策与原始通用模型保持对齐,从而有效防止过拟合于个体数据而丧失对其他病例的泛化能力。整个系统通过硬件植入与软件算法的协同优化,在信号质量、模型性能、个性化适配与隐私保护之间实现了平衡,为癫痫发作的精准预测提供了可靠的技术方案。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121370082B_ABST
    Figure CN121370082B_ABST
Patent Text Reader

Abstract

The application discloses a seizure prediction system and processing method based on subcutaneous implanted electrodes. It includes a signal acquisition module, a preprocessing module, a feature extraction module, a prediction analysis module and a warning module. The signal acquisition module obtains high-quality electroencephalogram signals through electrodes implanted in the skull; the preprocessing module filters and denoises the signals; the feature extraction module extracts low-level time and frequency domain features through a first encoding unit and converts them into high-level feature representations using a pre-trained Transformer encoder; the prediction analysis module calculates the seizure risk probability value based on the high-level features; and the warning module triggers a local warning when the probability value exceeds a threshold. The application combines innovative hardware implantation with advanced algorithms to achieve high-precision, high-robustness and personalized seizure prediction, providing an effective warning time window for patients.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of biosignal processing technology, specifically to an epileptic seizure prediction system and processing method based on subcutaneously implanted electrodes. Background Technology

[0002] Epilepsy is a chronic neurological disorder caused by abnormal synchronous discharges of neurons in the brain, characterized by recurrent and sudden seizures. Therefore, the ability to predict epileptic seizures minutes to hours in advance, providing a valuable "warning window" for patient intervention, has become an urgent clinical and research need and a core challenge in this field.

[0003] Currently, the monitoring and early warning of epilepsy mainly rely on the analysis of electroencephalogram (EEG) signals. However, existing technologies have significant limitations in signal acquisition, long-term monitoring, and prediction algorithms.

[0004] 1) Limitations of EEG signal acquisition methods: Currently, mainstream EEG signal acquisition typically involves collecting EEG signals from the scalp surface using a helmet or electrode cap worn on the head. Although this method is completely non-invasive and easy to deploy, the scalp EEG signals must pass through multiple layers of tissue, including the skull and scalp, resulting in severe signal attenuation. Furthermore, it is highly susceptible to physiological noise from electromyography (EMG), electrooculography (EOG), and environmental power frequency interference, resulting in an extremely low signal-to-noise ratio. Additionally, the electrode paste dries easily, leading to poor contact; the equipment is bulky and conspicuous, resulting in poor patient comfort and making long-term, continuous daily monitoring difficult. It is only suitable for short-term diagnosis within hospitals.

[0005] 2) Shortcomings of existing implantable monitoring devices: In recent years, some subcutaneous implantation solutions have emerged as compromises, such as the Minder implantable continuous electroencephalography (EEG) monitoring system developed by Epiminder, which is implanted under the scalp through minimally invasive surgery for long-term monitoring. These devices demonstrate the feasibility of subcutaneous monitoring. However, their functions are mainly focused on data recording and transmission for subsequent analysis by doctors; their core is "monitoring" rather than "real-time prediction." Regarding the integration of real-time, online intelligent prediction algorithms, especially how to utilize the limited computing resources of implantable devices to achieve high-precision, personalized seizure prediction, existing technologies have not yet provided mature and efficient solutions.

[0006] 3) Performance bottlenecks of existing prediction algorithms; At the algorithm level, existing epilepsy prediction models mostly rely on traditional machine learning methods (such as support vector machines and decision trees) or shallow neural networks. These models do not incorporate large-scale EEG data into their construction, resulting in certain deficiencies in EEG signal feature extraction and the generalization of epilepsy prediction models. Furthermore, current prediction models do not simultaneously combine intracranial and scalp EEG data for model construction. Summary of the Invention

[0007] To address the shortcomings of existing technologies, this invention provides an epilepsy seizure prediction system and processing method based on subcutaneously implanted electrodes. This system overcomes the deficiencies of existing technologies and achieves a balance between signal quality, model performance, personalized adaptation, and privacy protection through the synergistic optimization of hardware implantation and software algorithms. This provides a reliable technical solution for the accurate prediction of epilepsy seizures.

[0008] To achieve the above objectives, the present invention provides the following technical solution:

[0009] An epileptic seizure prediction system based on subcutaneously implanted electrodes includes a signal acquisition module, a signal preprocessing module, a feature extraction module, a prediction analysis module, and an early warning module; The signal acquisition module includes at least one subcutaneous electrode for acquiring intracranial electroencephalogram (EEG) signals. The signal preprocessing module is communicatively connected to the signal acquisition module and is used to filter and detrend the acquired raw EEG signals. The feature extraction module is communicatively connected to the signal preprocessing module and is used to extract features from the preprocessed EEG signal. The feature extraction module includes a first encoding unit and a second encoding unit. The first encoding unit is used to extract preset time-domain features and frequency-domain features from the preprocessed EEG signal and concatenate them to form a low-level feature vector. The second encoding unit is constructed based on a pre-trained Transformer model and is used to receive the low-level feature vector and encode the low-level feature vector into a high-level feature representation containing contextual semantic information. The predictive analysis module is communicatively connected to the feature extraction module, and is used to receive high-level feature representations, calculate and output a risk probability value representing the epileptic seizure within a specific future time period. The early warning module is communicatively connected to the predictive analysis module and is used to trigger an early warning notification when the risk probability value exceeds a preset threshold. The signal acquisition module further includes an implant shell and a wireless communication module. The implant shell is used to encapsulate the subcutaneous electrodes and their related signal conditioning circuits. The wireless communication module is integrated inside the implant shell and is used to transmit the acquired EEG signals to an external processing device. The implant shell is embedded in a groove formed by grinding on the skull, and mechanical fixation and electrical isolation are achieved by a biocompatible fixation material, which includes biocompatible bone cement or a microporous coating that promotes bone integration. The predictive analysis module includes a multi-scale temporal analysis module, a predictive head network, and a probability calibration module. The multi-scale temporal analysis module is used to process EEG features from different time windows in parallel. The predictive head network integrates temporal convolutional layers and a lightweight attention mechanism to decode the high-level feature representation and generate initial probabilities. The probability calibration module uses temperature scaling technology to calibrate the initial probabilities to output calibrated risk probability values.

[0010] Preferably, the filtering process performed by the signal preprocessing module includes at least: using a 50Hz notch filter to suppress power frequency interference; and using a bandpass filter with a passband frequency of 0.5Hz to 1000Hz to filter out high-frequency noise and baseline drift.

[0011] Preferably, the time-domain features extracted by the first coding unit include the maximum value, minimum value, variance, mean, and first-order difference sequence of the EEG signal; The frequency domain features extracted by the first coding unit include: the power spectral density estimated by the Welch method, the band power in the delta, theta, alpha, beta and gamma bands, and the power ratio features calculated based on the band power.

[0012] Preferably, the Transformer model in the second coding unit is pre-trained on a large-scale unlabeled EEG dataset through a self-supervised task of reconstructing signals by masking, wherein the masking ratio is 40% to 60%.

[0013] Preferably, the predictive analysis module further includes a personalized adaptation module, which is configured to fine-tune the parameters of the predictive head network or part of the second encoder using newly generated user data on the user's local device. The loss function of the fine-tuning process consists of the standard classification loss and the knowledge distillation loss. The knowledge distillation loss is used to constrain the output probability distribution of the fine-tuned model to remain aligned with the output probability distribution of the original model before fine-tuning.

[0014] This invention also discloses a method for processing electroencephalogram (EEG) signal data based on subcutaneously implanted electrodes. The method is executed by a computing device and includes the following steps:

[0015] Step S1: Continuously acquire the user's electroencephalogram (EEG) signals through subcutaneously implanted electrodes;

[0016] Step S2: Preprocess the acquired raw EEG signals, including 50Hz notch filtering and 0.5Hz to 1000Hz bandpass filtering;

[0017] Step S3: Extract low-level feature vectors from the preprocessed signal, the low-level feature vectors including time-domain features and frequency-domain features;

[0018] Step S4: Use a pre-trained Transformer encoder to convert low-level feature vectors into high-level feature representations;

[0019] Step S5: Based on the high-level feature representation, calculate the risk probability value of epileptic seizures within a specific future time period using a prediction model;

[0020] Step S6: Compare the obtained risk probability value with a preset threshold. If the value exceeds the threshold, a local warning is triggered.

[0021] Preferably, in step S5, the prediction model is a model that has been personalized and fine-tuned; the personalized fine-tuning specifically involves: using the user's local data on the user's local device and employing an incremental learning algorithm based on knowledge distillation to fine-tune the global prediction model;

[0022] Among them, the loss function of the incremental learning algorithm based on knowledge distillation Represented as:

[0023]

[0024] in, For standard cross-entropy loss, Where y is the true label of the new data. The output probability of the student model after passing through the softmax function layer; is a scaling factor used to balance the numerical scale of the KL divergence term and the cross-entropy term; Let KL divergence be the KL divergence. For the softened output of the teacher model, This is the softened output of the student model; T is the temperature parameter. These are the balancing weighting coefficients.

[0025] The present invention also discloses a computer-readable storage medium storing a computer program, which, when executed, implements the steps of the electroencephalogram (EEG) signal data processing method described above.

[0026] This invention provides a seizure prediction system and processing method based on subcutaneously implanted electrodes, offering the following advantages: The subcutaneous intracranial electrode implantation effectively attenuates signal attenuation and interference from the skull and scalp, resulting in intracranial EEG signals with a significantly better signal-to-noise ratio than scalp EEG. The signal preprocessing module further suppresses environmental noise and physiological artifacts through power frequency notch filtering and bandpass filtering in specific frequency bands, providing a high-quality, clean signal source for subsequent analysis. Furthermore, this invention employs a dual-cascaded feature encoder structure to map low-level features into a high-level feature space rich in contextual information. This feature representation exhibits stronger discriminative power and robustness to individual differences and noise interference. The prediction analysis module calculates the probability of future seizures using a prediction head network integrating multi-scale temporal modeling. To address physiological differences among patients, the system introduces a localized incremental learning mechanism based on knowledge distillation. This mechanism allows the prediction model to be continuously fine-tuned on the user's local device using individual data, achieving personalized adaptation. Furthermore, by employing a knowledge distillation loss function, the personalized model is constrained to maintain alignment between its output decisions and the original general model when adapting to new data. This effectively prevents overfitting to individual data and the loss of generalization ability to other cases. Through the collaborative optimization of hardware implantation and software algorithms, the entire system achieves a balance between signal quality, model performance, personalized adaptation, and privacy protection, providing a reliable technical solution for the accurate prediction of epileptic seizures. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in this invention or the prior art, the accompanying drawings used in the description of this invention or the prior art will be briefly introduced below.

[0028] Figure 1 A schematic block diagram of the prediction system of this invention;

[0029] Figure 2 Flowchart of the data processing method of the present invention;

[0030] Figure 3 The flowchart of step S5 in the data processing method of the present invention. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings.

[0032] Example 1, as Figure 1 As shown, this embodiment provides an epileptic seizure prediction system based on subcutaneous implanted electrodes, including a signal acquisition module 1, a signal preprocessing module 2, a feature extraction module 3, a prediction analysis module 4, and an early warning module 5;

[0033] The signal acquisition module 1 includes multiple subcutaneous electrodes made of biocompatible materials (such as platinum-iridium alloy), which are encapsulated within a biocompatible titanium alloy implant shell. Through precise, minimally invasive surgery, grooves matching the shape of the implant shell are ground into the patient's skull (typically near the clinically determined epileptic focus) to embed the entire implant shell. The contact points of the subcutaneous electrodes are located between the outer table of the skull and the scalp, without penetrating the dura mater, thus ensuring effective acquisition of intracranial EEG signals while significantly reducing surgical risks. Fixation is achieved using biocompatible bone cement (such as polymethyl methacrylate, PMMA), which provides stable mechanical support and good electrical isolation after curing. The implant shell integrates a low-noise amplifier, an analog-to-digital converter, and a low-power Bluetooth chip. The acquired analog EEG signals are amplified and digitized, then wirelessly transmitted via Bluetooth to an external device (such as a smartphone or a dedicated receiver).

[0034] The signal preprocessing module 2 runs as software on an external device. The signal preprocessing module 2 is communicatively connected to the signal acquisition module 1 and is used to receive raw EEG signals from the signal acquisition module 1.

[0035] After receiving the raw EEG signal, it is first passed through a 50Hz notch filter to attenuate power frequency interference introduced by the environment. Subsequently, it is passed through a finite-length unit impulse response bandpass filter (e.g., an FIR filter) with a passband frequency of 0.5Hz to 1000Hz. A 0.5Hz high-pass cutoff is used to eliminate baseline drift, and a 1000Hz low-pass cutoff is used to suppress high-frequency noise and satisfy the Nyquist sampling theorem. In this embodiment, bidirectional filtering is used to eliminate phase distortion, ensuring the accuracy of subsequent feature extraction. The preprocessed clean signal... (Where C is the number of leads and N is the number of sampling points) is sent to the subsequent feature extraction module 3.

[0036] The feature extraction module 3 also runs on an external device. The feature extraction module 3 is communicatively connected to the signal preprocessing module 2 and is used to extract features from the preprocessed EEG signal. The feature extraction module 3 includes a first coding unit 31 and a second coding unit 32.

[0037] The first encoding unit 31 performs feature calculations on the preprocessed signal within a fixed time window. For each electrode channel signal within the window, preset time-domain and frequency-domain features are extracted and concatenated to form a low-level feature vector.

[0038] Temporal features include the maximum, minimum, variance, mean, and first-order difference sequence of the EEG signal; the calculation method is as follows: within an analysis window of duration T=2 seconds, for each lead signal... Calculate the following features:

[0039] Maximum value: ;

[0040] Minimum value: ;

[0041] Mean: ;

[0042] variance: ;

[0043] Mean of the absolute values ​​of the first-order differences: .

[0044] Frequency domain characteristics include:

[0045] Perform a Fourier transform on the signal to obtain the spectrum. With frequency index ;

[0046] For signals The power spectral density PSD(f) was calculated using the Welch method.

[0047] Based on Simpson numerical integration, the relative power in the Delta (0.5-4Hz), Theta (4-8Hz), Alpha (8-13Hz), Beta (13-30Hz), and Gamma (30-100Hz) frequency bands was calculated respectively. , , , , ;

[0048] Calculate the power ratio characteristics: , , .

[0049] Finally, all time-domain and frequency-domain feature vectors are concatenated to form the low-level feature vector of this channel. Then, the features of all channels are merged to form the final low-level feature representation. .

[0050] The second encoding unit 32 uses a Transformer encoder as its backbone network. Through self-supervised learning during the pre-training phase, the model acquires a deep understanding of EEG signals. The specific implementation is as follows:

[0051] Key hyperparameters of Transformer: 12 encoder layers, 200 hidden layer dimensions, 10 attention heads, and 800 feedforward network dimensions.

[0052] The model was pre-trained on a large-scale dataset containing over 10,000 hours of multi-center scalp and intracranial EEG data, using a self-supervised mask reconstruction task with a mask ratio of 60%. Through a multi-head self-attention mechanism, the model was able to capture long-range dependencies and spatiotemporal dynamic patterns among multi-lead EEG signals, learning highly discriminative EEG representations.

[0053] In practical applications, a pre-trained Transformer model is used as the feature encoder, and the low-level feature vector sequence (multiple time windows) output by the first encoding unit 31 is used as input. Leveraging the Transformer model's powerful sequence modeling capabilities and cross-lead information integration advantages, a high-level feature representation containing long-range dependencies and global contextual information is output. This structure not only effectively models the global contextual relationships of EEG signals but also significantly improves the model's generalization performance on limited labeled data through prior knowledge obtained during pre-training.

[0054] Predictive analysis module 4 is communicatively connected to feature extraction module 3 and is used for high-level feature representation of the output of second encoding unit 32. It calculates and outputs a probability value P representing the risk of epileptic seizures within a specific future time period. Predictive analysis module 4 includes a multi-scale temporal analysis module, a prediction head network, and a probability calibration module, wherein:

[0055] The multi-scale time series analysis module internally maintains three time windows of different lengths (e.g., 30 seconds, 5 minutes, and 1 hour) in parallel to perform moving averages and feature recombination on the input features in order to capture patterns at different time scales, from instantaneous abrupt changes to long-term trends.

[0056] The prediction head network consists of a lightweight multi-scale temporal convolutional network. It processes features H at different time scales (e.g., the current instant, the past 1 minute, the past 5 minutes) in parallel, and then fuses these multi-scale information through a learnable gating mechanism to form a comprehensive feature. . It is mapped to an initial probability value between 0 and 1 through a fully connected layer and a sigmoid activation function.

[0057] The probability calibration module uses temperature scaling technology to calibrate the initial probability values. During calibration, the temperature parameter T (T>0) is optimized on a reserved validation set so that the confidence level of the output risk probability value P better matches the actual accuracy, thereby providing more reliable clinical reference value.

[0058] In this embodiment, the predictive analysis module 4 further includes a personalized adaptation module, which runs on the external device and employs incremental learning based on knowledge distillation. The specific process is as follows:

[0059] 1) The initial model is a global model that has been pre-trained on a large scale and fine-tuned with a small amount of labeled data.

[0060] 2) When the amount of locally accumulated EEG data (already labeled by user or doctor feedback) reaches a certain level as the user uses the device, fine-tuning is triggered.

[0061] 3) Using the global model as the teacher, train a student model (i.e., a personalized model) on local data. The loss function is:

[0062]

[0063] in, These are balancing weights, ranging from [0,1], used to adjust the relative importance of the two types of losses. In this embodiment, Take 0.7. Standard cross-entropy loss is used to measure the difference between the model's predictions and the true labels of the new data. Where y is the true label of the new data. This represents the output probability of the student model after passing through the softmax function layer. This is a scaling factor used to balance the numerical scale of the KL divergence term and the cross-entropy term, ensuring gradient stability. The Kullback-Leibler divergence measures the difference between the output distributions of the teacher and student models. Specifically, . This is the softened output of the teacher model, i.e., the probability distribution of the original global model at temperature T. This is the softened output of the student model, representing the probability distribution of the personalized model being fine-tuned at temperature T. T is the temperature parameter. .

[0064] This loss function ensures that the new model retains the original generalization knowledge while adapting to individual characteristics, and all data is processed locally, protecting user privacy.

[0065] After fine-tuning, the system automatically switches to the personalized model for subsequent predictions, thereby continuously improving the accuracy of predictions for that user.

[0066] The early warning module 5 communicates with the predictive analysis module 4 to continuously monitor the calibrated risk probability value P output by the predictive analysis module 4 and compares it with a configurable clinical threshold (e.g., 0.75). When the average value of this value exceeds the preset threshold within a continuous 2-minute window, a high-risk state is determined. Subsequently, the early warning module 5 immediately triggers a local early warning. Early warning methods include: displaying a red warning pop-up window on the mobile app interface; emitting a continuous, rapid alarm sound; and activating strong phone vibration.

[0067] The early warning system aims to prompt patients to immediately move to a safe environment or take pre-set intervention measures. If the probability does not exceed the threshold, the system will continue to monitor, forming a closed loop of real-time monitoring-analysis-decision-early warning.

[0068] This invention fundamentally resolves the conflict between signal quality and implantation risk through a subcutaneous intracranial implantation of electrodes. The subcutaneous electrodes are precisely implanted within a cranial groove, placing them closer to brain tissue than surface electrodes on the scalp. This effectively attenuates signal attenuation and interference from the skull and scalp, resulting in intracranial EEG signals with a significantly better signal-to-noise ratio than those obtained via scalp EEG. Simultaneously, this method avoids the significant risks associated with craniotomy to access the brain parenchyma, achieving a balance between low risk and high signal quality. The implant transmits data wirelessly via Bluetooth Low Energy, ensuring the feasibility of long-term, continuous monitoring. Subsequently, the signal preprocessing module 2 further suppresses environmental noise and physiological artifacts through power frequency notch filtering and bandpass filtering of specific frequency bands, providing a high-quality, clean signal source for subsequent analysis.

[0069] Furthermore, this invention employs a dual-cascaded feature encoder structure. First, the first encoding unit 31 (low-level feature encoder) extracts classic time-domain (e.g., variance, first-order difference) and frequency-domain (e.g., relative power and power ratio of each frequency band) features from the preprocessed signal. These features provide a quantitative description of the signal in traditional dimensions. The second encoding unit 32 (high-level feature encoder) is based on the Transformer architecture and undergoes self-supervised pre-training on large-scale unlabeled EEG data (e.g., mask reconstruction tasks). This process enables the model to learn inherent, general spatiotemporal dynamic patterns and long-range dependencies in EEG signals, rather than relying solely on limited, episode-labeled data. In application, this pre-trained model acts as a powerful, general EEG signal interpreter, mapping low-level features to a high-level feature space rich in contextual information. This feature representation has stronger discriminative power and robustness to individual differences and noise interference. The predictive analysis module 4 calculates the probability of future episodes through a predictive head network integrating multi-scale temporal modeling (e.g., simultaneous analysis of second-level and minute-level trends). To address the physiological differences among patients, the system introduces a localized incremental learning mechanism based on knowledge distillation. This mechanism allows the predictive model to be continuously fine-tuned on the user's local device using individual data, achieving personalized adaptation. Furthermore, through the knowledge distillation loss function, the personalized model is constrained to maintain alignment between its output decisions and the original general model when adapting to new data, effectively preventing overfitting to individual data and loss of generalization ability for other cases. Finally, the early warning module 5 triggers multimodal alarms in a timely manner based on the dynamic comparison between the calibrated probability value and a preset threshold, guiding patients to take protective measures. The entire system achieves a balance between signal quality, model performance, personalized adaptation, and privacy protection through the collaborative optimization of hardware implantation and software algorithms, providing a reliable technical solution for the accurate prediction of epileptic seizures.

[0070] Example 2, as Figures 2-3 As shown, this invention also discloses a method for processing electroencephalogram (EEG) signal data based on subcutaneously implanted electrodes. This method is executed by a computing program running on a user-carried handheld device or smartphone, working in conjunction with the subcutaneously implanted electrode module, and includes the following steps:

[0071] Step S1: EEG signal acquisition

[0072] Electroencephalogram (EEG) signals are continuously acquired via an electrode array pre-implanted under the skin of the user's skull. The subcutaneous electrodes are embedded into cranial grooves via minimally invasive surgery, encapsulated with biocompatible materials, and secured long-term using a microporous structure that promotes osseointegration. The sampling frequency is set to 2000Hz to ensure complete capture of EEG signal components within the 0-1000Hz frequency band. The acquired raw analog signals are amplified and converted from analog to digital within the implant, then wirelessly transmitted to a computing device via Bluetooth Low Energy.

[0073] Step S2: Signal Preprocessing

[0074] The received raw EEG signals are preprocessed on a computing device to improve signal quality. This specifically includes:

[0075] A zero-phase-distortion IIR (Infinite Length Unit Impulse Response) or FIR (Finite Length Unit Impulse Response) notch filter with a center frequency of 50Hz is used to effectively suppress power frequency interference.

[0076] Subsequently, a zero-phase-off FIR bandpass filter with a passband frequency range of 0.5 Hz to 1000 Hz is used. This step filters out low-frequency baseline drift (<0.5 Hz) caused by breathing, sweating, etc., as well as irrelevant high-frequency noise (>1000 Hz), while preserving the signal frequency bands valuable for epilepsy prediction.

[0077] Step S3: Low-level feature vector extraction

[0078] Low-level feature vectors are extracted from the preprocessed signal, specifically including time-domain features and frequency-domain features.

[0079] The temporal feature extraction process involves slicing the preprocessed signal from each electrode channel into segments according to a set time window (e.g., 2 seconds). For the signal within each time window, its temporal features are calculated, specifically including the signal's maximum, minimum, mean, variance, and the mean of the absolute values ​​of the first-order differences. These temporal features reflect the signal's fundamental statistical characteristics in the time domain, providing basic data for subsequent feature analysis.

[0080] Frequency domain feature extraction converts the time-domain signal into a frequency-domain representation using Fourier transform, and then calculates the power spectral density and relative power of each frequency band. Specifically, the Welch method is used to calculate the power spectral density to reduce the variance of the estimate. Based on the Simpson numerical integration technique, the relative power of the Delta, Theta, Alpha, Beta, and Gamma bands is calculated, as these bands are closely related to different functional states of the brain. In addition, power ratio features between different frequency bands are calculated, such as the power ratio between the Delta and Alpha bands. These ratio features can reveal the energy distribution of the signal across different frequency bands, which helps to capture spectral change patterns before epileptic seizures.

[0081] Finally, the time-domain and frequency-domain features extracted from each electrode channel are concatenated to form a low-level feature vector for that channel. Then, the low-level feature vectors of all electrode channels are merged to construct a complete low-level feature representation, providing input data for subsequent high-level feature extraction and predictive analysis.

[0082] Step S4: High-level feature representation transformation

[0083] The low-level feature vector sequence (multiple consecutive time windows) obtained in step S3 is used as input and fed into a pre-trained Transformer encoder. This Transformer encoder has been self-supervised pre-trained on a large-scale unlabeled EEG dataset through a signal reconstruction task with a 60% mask ratio. It possesses powerful sequence modeling capabilities, enabling it to capture long-range dependencies and complex spatiotemporal dynamic patterns between multi-lead EEG signals.

[0084] The Transformer encoder performs deep processing on the input low-level feature vector sequence. Through a multi-head self-attention mechanism, the model can automatically capture the long-range dependencies and spatiotemporal dynamic patterns of EEG signals between different electrode channels, mapping low-level features to a high-level feature space rich in contextual information. In this process, multiple encoder layers of the Transformer encoder progressively abstract and refine the features. The settings of key hyperparameters such as the hidden layer dimension, attention head, and feedforward network dimension ensure that the model can learn a highly discriminative EEG representation, ultimately outputting a high-level feature representation corresponding to the input sequence and containing rich contextual semantic information. This representation is a deep abstraction of the original signal, exhibiting greater discriminative power and robustness than low-level features.

[0085] Step S5: Calculation of the probability value of epileptic seizure risk

[0086] The high-level feature representation obtained in step S4 is input into the prediction model (e.g., a lightweight fully connected neural network or a temporal convolutional network). The prediction model maps this high-level feature to a scalar value between 0 and 1, which represents the probability of a specific physiological event (i.e., a seizure) occurring within a specific time period in the future (e.g., the next 5 minutes). The output of the prediction model is temperature-scaled to ensure the accuracy and reliability of its risk probability value.

[0087] In this step, the prediction model is a personalized, fine-tuned model. The specific fine-tuning process is as follows:

[0088] 1) Initialization: When a user starts using the system, a global prediction model trained on large-scale labeled EEG data is loaded;

[0089] 2) Local data accumulation: During local operation, the system continuously records EEG data and episode annotations from user or doctor feedback, forming a local dataset;

[0090] 3) When the local dataset reaches a certain size (e.g., containing records of 3 or more seizures), fine-tuning is triggered on the user's local device. An incremental learning algorithm based on knowledge distillation is used, employing a global prediction model as the teacher model to train the student model (i.e., the personalized model) on the local dataset. The optimization objective is to minimize the following loss function:

[0091]

[0092] in, For standard cross-entropy loss, Let KL divergence be the KL divergence. and This is the logits output for the global model and the student model, where T is the temperature parameter (T=2). It is a balancing weight ( =0.7).

[0093] 4) After fine-tuning, the system automatically switches the prediction model to a personalized model, which can better adapt to the current user's EEG characteristic pattern.

[0094] Step S6: Warning Judgment and Triggering

[0095] The real-time risk probability value calculated in step S5 is compared with a preset decision threshold (e.g., 0.72). If the probability value consistently exceeds the threshold (e.g., the average value over 1 minute), a high-risk state is determined, and a local warning is immediately triggered. Warning methods include, but are not limited to: vibrating the mobile device, playing a specific warning sound, and displaying a warning message on the screen. If the probability value is lower than the threshold, the system returns to step S1 to continue the next round of data collection and processing, achieving closed-loop real-time monitoring.

[0096] This invention utilizes a Transformer encoder pre-trained on large-scale EEG data. This method automatically learns and extracts deep, highly discriminative spatiotemporal feature representations from EEG signals. Compared to traditional manual feature extraction methods that rely on expert experience, this large-model-based representation approach can more comprehensively capture subtle changes and complex patterns in pre-seizure EEG activity, including nonlinear and long-range dependencies. In validation on a multi-center clinical retrospective dataset, this method achieved prediction results with sensitivity and specificity exceeding 85% in over 85% of the test cases, significantly outperforming baseline methods based on traditional machine learning models such as support vector machines and random forests.

[0097] This method employs incremental learning based on knowledge distillation for personalized fine-tuning. This mechanism effectively addresses the core challenge of significant individual variability in epileptic EEG patterns. By fine-tuning the global model using the user's own historical data on their local device, the generated personalized prediction model accurately captures and adapts to the user's unique pre-seizure aura characteristics. From signal preprocessing and feature extraction to model inference, the entire data processing flow has been meticulously optimized, enabling a single prediction to be completed within seconds on mainstream mobile computing devices, meeting the real-time requirements of epilepsy early warning.

[0098] In summary, this method organically combines subcutaneous signal acquisition, deep feature learning based on a large model, and privacy-preserving personalized incremental learning. This not only achieves a comprehensive improvement in prediction accuracy, robustness, and real-time performance at the technical level, but also provides epilepsy patients with a reliable, usable, and long-term trustworthy personalized risk management tool at the application level. It solves many long-standing pain points in existing technologies and has significant technological progress and broad clinical application prospects.

[0099] In embodiment three, the present invention also discloses a computer-readable storage medium storing a computer program, wherein the computer-readable storage medium may take various physical forms, including but not limited to:

[0100] Built-in memory in mobile devices: such as flash memory chips (eMMC, UFS storage devices) in smartphones or tablets, which is the most common and preferred implementation.

[0101] Removable storage cards: such as Micro SD cards, SD cards, etc., facilitate program distribution and updates.

[0102] Solid-state drives or embedded multimedia cards: used in dedicated handheld medical monitoring devices.

[0103] Read-only memory: In dedicated devices that require firmware to be embedded, the program can be burned into ROM or EPROM.

[0104] Furthermore, the computer-readable storage medium is non-transient, meaning that program instructions are persistently stored on it, rather than being temporary like signal transmissions.

[0105] At least one computer program is stored on the storage medium. This program contains machine instructions that can be loaded and executed by the device's processor (such as a mobile phone's CPU / GPU). When the processor executes these instructions, the EEG signal data processing method based on subcutaneously implanted electrodes described in Embodiment 2 is executed in its entirety.

[0106] Specifically, the program is configured to execute the following functional modules:

[0107] Preprocessing module: Contains algorithm code for implementing 50Hz notch filtering and 0.5Hz to 1000Hz bandpass filtering.

[0108] Feature extraction module 3: contains code for calculating time-domain features (maximum, minimum, variance, mean, first-order difference) and frequency-domain features (power and power ratio of each frequency band), as well as logic for concatenating them to form a low-level feature vector.

[0109] Model Loading and Inference Module: Contains code for loading pre-trained Transformer encoders and initial prediction models, as well as an inference engine that performs forward propagation, converts low-level feature vectors into high-level feature representations, and finally calculates risk probability values.

[0110] Personalized Adaptation Module: Contains code implementing an incremental learning algorithm based on knowledge distillation, specifically including functions for calculating cross-entropy loss and KL divergence, as well as training loop logic for performing local model fine-tuning.

[0111] Early warning module 5: contains code for continuously comparing risk probability values ​​with preset thresholds and calling the operating system API to trigger device vibration, sound, or display alarms when conditions are met.

[0112] Taking a user's smartphone as an example, the workflow is as follows:

[0113] S001: Startup and Initialization: The user launches a dedicated application. The operating system loads the program's instructions from computer-readable storage media (the phone's built-in flash memory) into memory. The program initializes and loads the Transformer model and global prediction model parameters pre-installed in the phone's storage.

[0114] S002: Real-time processing loop: The program enters background service state.

[0115] S003: This program receives EEG data packets from the subcutaneous implant via the phone's Bluetooth interface.

[0116] S004: The processor executes the instructions of the preprocessing module and feature extraction module 3 in the storage medium to process the data.

[0117] S005: Executes the model loading and inference module instructions, calls the phone's neural network API (such as AndroidNNAPI) or CPU to perform efficient calculations, and obtains the risk probability value.

[0118] S006: Execute the warning logic module instruction to determine whether an alarm needs to be triggered.

[0119] Additionally, when the phone is idle, the system may schedule and execute instructions from the personalization adaptation module. This module reads historical data stored locally on the phone, labeled by the user, fine-tunes the prediction model according to the loss function described in Example 2, and saves the optimized model parameters back to the phone's internal storage for use in the next real-time prediction.

[0120] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. 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 of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A seizure prediction system based on subcutaneously implanted electrodes, characterized in that: It includes a signal acquisition module, a signal preprocessing module, a feature extraction module, a predictive analysis module, and an early warning module; The signal acquisition module includes at least one subcutaneous electrode for acquiring intracranial electroencephalogram (EEG) signals. The signal preprocessing module is communicatively connected to the signal acquisition module and is used to filter and detrend the acquired raw EEG signals. The filtering process includes at least: using a 50Hz notch filter to suppress power frequency interference; and using a bandpass filter with a passband frequency of 0.5Hz to 1000Hz to filter out high-frequency noise and baseline drift. The feature extraction module is communicatively connected to the signal preprocessing module and is used to extract features from the preprocessed EEG signal. The feature extraction module includes a first encoding unit and a second encoding unit. The first encoding unit is used to extract preset time-domain features and frequency-domain features from the preprocessed EEG signal and concatenate them to form a low-level feature vector. The second encoding unit is constructed based on a pre-trained Transformer model and is used to receive the low-level feature vector and encode the low-level feature vector into a high-level feature representation containing contextual semantic information. The predictive analysis module is communicatively connected to the feature extraction module, and is used to receive high-level feature representations, calculate and output a risk probability value representing the epileptic seizure within a specific future time period. The early warning module is communicatively connected to the predictive analysis module and is used to trigger an early warning notification when the risk probability value exceeds a preset threshold. The signal acquisition module further includes an implant shell and a wireless communication module. The implant shell is used to encapsulate the subcutaneous electrodes and their related signal conditioning circuits. The wireless communication module is integrated inside the implant shell and is used to transmit the acquired EEG signals to an external processing device. The implant shell is embedded in a groove formed by grinding on the skull, and mechanical fixation and electrical isolation are achieved by a biocompatible fixation material, which includes biocompatible bone cement or a microporous coating that promotes bone integration. The predictive analysis module includes a multi-scale temporal analysis module, a predictive head network, and a probability calibration module. The multi-scale temporal analysis module is used to process EEG features from different time windows in parallel. The predictive head network integrates temporal convolutional layers and a lightweight attention mechanism to decode the high-level feature representation and generate initial probabilities. The probability calibration module uses temperature scaling technology to calibrate the initial probabilities to output calibrated risk probability values. The temporal features extracted by the first coding unit include the maximum value, minimum value, variance, mean, and first-order difference sequence of the EEG signal; The frequency domain features extracted by the first coding unit include: power spectral density estimated by the Welch method, band power in the delta, theta, alpha, beta and gamma bands, and power ratio features calculated based on band power. The Transformer model in the second coding unit is pre-trained on a large-scale unlabeled EEG dataset through a self-supervised task of reconstructing signals by masking, where the masking ratio is 40% to 60%. The predictive analysis module also includes a personalized adaptation module, which is configured to fine-tune the parameters of the predictive head network or part of the second encoder using newly generated user data on the user's local device. The loss function of the fine-tuning process consists of the standard classification loss and the knowledge distillation loss. The knowledge distillation loss is used to constrain the output probability distribution of the fine-tuned model to remain aligned with the output probability distribution of the original model before fine-tuning.

2. A method for processing electroencephalogram (EEG) signal data based on subcutaneously implanted electrodes, implemented using the epileptic seizure prediction system based on subcutaneously implanted electrodes as described in claim 1, characterized in that... The method is executed by a computing device and is characterized by comprising the following steps: Step S1: Continuously acquire the user's electroencephalogram (EEG) signals through subcutaneously implanted electrodes; Step S2: Preprocess the acquired raw EEG signals, including 50Hz notch filtering and 0.5Hz to 1000Hz bandpass filtering; Step S3: Extract low-level feature vectors from the preprocessed signal, the low-level feature vectors including time-domain features and frequency-domain features; Step S4: Use a pre-trained Transformer encoder to convert low-level feature vectors into high-level feature representations; Step S5: Based on the high-level feature representation, calculate the risk probability value of epileptic seizures within a specific future time period using a prediction model; Step S6: Compare the obtained risk probability value with a preset threshold. If the value exceeds the threshold, a local warning is triggered.

3. The EEG signal data processing method according to claim 2, characterized in that: In step S5, the prediction model is a model that has been personalized and fine-tuned; the personalized fine-tuning specifically involves using the user's local data on the user's local device and employing an incremental learning algorithm based on knowledge distillation to fine-tune the global prediction model. Among them, the loss function of the incremental learning algorithm based on knowledge distillation Represented as: ; in, For standard cross-entropy loss, Where y is the true label of the new data. The output probability of the student model after passing through the softmax function layer; is a scaling factor used to balance the numerical scale of the KL divergence term and the cross-entropy term; Let KL divergence be the KL divergence. For the softened output of the teacher model, This is the softened output of the student model; T is the temperature parameter. These are the balancing weighting coefficients.

4. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the steps of the method as described in any one of claims 2 to 3.

Citation Information

Patent Citations

  • SEEG epileptic wave detection method and system based on layered graph diffusion learning, and storage medium

    CN114938946A

  • Sample similarity knowledge distillation method and device based on multichannel electroencephalogram

    CN119721124A