Epilepsy electroencephalogram signal detection method based on multi-scale TCN-BiLSTM
By using the multi-scale TCN-BiLSTM model, automated and efficient detection of epileptic EEG signals was achieved, solving the problems of feature extraction relying on human experience and insufficient multi-scale information fusion in existing technologies, thus improving detection accuracy and precision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI UNIV OF SCI & TECH
- Filing Date
- 2026-04-14
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies for detecting epilepsy EEG signals suffer from problems such as reliance on human experience for feature extraction, insufficient multi-scale information fusion capabilities, and difficulty in adaptively capturing nonlinear and non-stationary dynamic features.
The multi-scale TCN-BiLSTM model is adopted to achieve automated and efficient extraction and classification of EEG signals through multi-scale feature extraction, bidirectional temporal modeling and channel attention mechanism.
It improves the precision and accuracy of epilepsy EEG signal detection, enhances the ability to extract the temporal features of epilepsy EEG signals, avoids interference from invalid information, and improves the detection accuracy and speed.
Smart Images

Figure CN122004904A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical-engineering integration, specifically a method for detecting epilepsy EEG signals based on multi-scale TCN-BiLSTM. Background Technology
[0002] Epilepsy is a common neurological disorder, and its diagnosis heavily relies on the accurate analysis of electroencephalogram (EEG) signals. Currently, various techniques exist for epilepsy signal detection: traditional methods such as time-domain analysis, frequency-domain analysis, and wavelet transform can characterize the basic features of EEG signals, but they have limitations such as reliance on human experience for feature extraction and insufficient multi-scale information fusion capabilities; machine learning-based methods, such as support vector machines and random forests, while improving the automation level of detection, struggle to adaptively capture the nonlinear and non-stationary dynamic features in epilepsy signals. Deep learning models can automatically extract features from raw data without manual intervention, reducing the time and cost of preprocessing. Temporal convolutional networks (TCNs) are convolutional neural networks specifically designed for processing long-term sequence data. Bidirectional long short-term memory (LSTM) networks, as a special type of recurrent neural network, effectively solve the problems of gradient vanishing and gradient exploding inherent in traditional RNN models. This paper presents a multi-scale TCN-BiLSTM-based method for epilepsy EEG signal detection. Through multi-scale feature extraction, bidirectional temporal modeling, and channel attention mechanisms, it achieves automated and efficient extraction of spatiotemporal features of EEG signals, improving detection accuracy. Summary of the Invention
[0003] The purpose of this invention is to provide a method for detecting epilepsy electroencephalogram (EEG) signals based on multi-scale TCN-BiLSTM. This method has the advantages of being fast and accurate.
[0004] The present invention achieves its objective using the following technical solution:
[0005] This invention relates to a method for detecting epileptic electroencephalogram (EEG) signals based on multi-scale TCN-BiLSTM, comprising the following steps:
[0006] (1) Data preparation: Collect EEG signals from epileptic patients during seizures, between seizures, and from healthy individuals in a ratio of 1:1:2 to ensure sample balance.
[0007] (2) Signal preprocessing: The EEG signal is filtered by a bandpass filter, the data is then segmented, and the Z-score of each channel signal is normalized.
[0008] (3) Sample set allocation: The processed EEG signals were divided into training set, validation set and test set using the hold-out method.
[0009] (4) Multi-scale feature extraction module: The preprocessed EEG signal is input into a temporal convolutional network with multiple different dilation factors to extract multi-scale features of the EEG signal.
[0010] (5) Feature fusion: The multi-scale features extracted from multiple TCNs are fused to obtain fused features containing rich time scale information.
[0011] (6) Bidirectional temporal modeling: The fused features are input into the BiLSTM network, and the BiLSTM performs temporal modeling on the fused features from both the forward and reverse directions.
[0012] (7) Channel attention mechanism: A channel attention mechanism is introduced after the output of BiLSTM. By learning the importance weights of different EEG signal channels, the features of the BiLSTM output are weighted.
[0013] (8) Classification and detection module: Composed of a fully connected layer and a Softmax function, it is used to classify and predict the features after processing by the channel attention mechanism. It outputs the detection results of epileptic EEG signals and determines whether the signal is during an epileptic seizure, between epileptic seizures, or in a normal state of a healthy person.
[0014] Preferably, in step (1), three different signals are used: the first is the signal during an epileptic seizure, the second is the signal during the interictal period of an epileptic seizure, and the third is the normal EEG signal of a healthy person. The ratio of these signals is 1:1:2.
[0015] Preferably, in step (2), a 0.5-45Hz bandpass filter is selected to filter the original EEG signal, and the EEG signal is mapped to a specific interval using the Z-score normalization method. Finally, the EEG signal is segmented according to the length of the preprocessed time window. The signal during the seizure period is segmented with a 50% overlap rate to increase the sample size, while the signal during the normal period is segmented with non-overlap to obtain multiple EEG signal segments.
[0016] Preferably, in step (3), the sample is divided into a training set of 70% and a test set of 30% using the hold-out method.
[0017] Preferably, in step (4), the preprocessed EEG signal is input into a multi-scale feature extraction module, which contains three TCNs with different expansion factors of 1, 2, and 4. The three TCNs extract features from the EEG signal to obtain features at different scales.
[0018] Preferably, in step (6), BiLSTM performs temporal modeling of features from both forward and reverse directions, making full use of past and future contextual information, which can better capture the temporal dynamic changes of EEG signals, improve the ability to extract temporal features of epileptic EEG signals, and thus improve detection accuracy.
[0019] As a preferred embodiment, in step (7), a channel attention mechanism is introduced, which can learn the importance weights of different EEG signal channels, perform weighted processing on features, highlight the features of important channels, suppress the features of unimportant channels, enhance the ability to extract effective features, avoid interference from invalid information, and further improve the accuracy of detection.
[0020] Preferably, in step (8), the features processed by the channel attention mechanism are input into the classification prediction module, the fully connected layer of the classification prediction module maps the features, and then the softmax function is used for classification to output the detection results of epileptic EEG signals.
[0021] Beneficial effects:
[0022] Compared with existing technologies, the advantages of this invention are as follows: Compared with single-scale feature extraction methods, multi-scale TCN feature extraction can more comprehensively describe the features of EEG signals, providing richer information for subsequent detection. The BiLSTM network performs temporal modeling of features from both forward and backward directions, improving the ability to extract temporal features of epileptic EEG signals, thereby enhancing detection accuracy. The introduction of a channel attention mechanism avoids interference from invalid information, further improving detection accuracy. The classification model composed of fully connected layers and a Softmax function improves both recognition accuracy and speed, making it highly suitable for research on epilepsy signal detection. Attached Figure Description
[0023] Figure 1 This is a flowchart of a method for detecting epilepsy EEG signals based on multi-scale TCN-BiLSTM;
[0024] Figure 2 This is a multi-scale TCN-BiLSTM structure diagram, which is a method for detecting epilepsy EEG signals based on multi-scale TCN-BiLSTM. Detailed Implementation
[0025] The present invention will be further explained and illustrated below through specific embodiments.
[0026] (1) Data preparation: Three different signals were used: the first was the signal during the seizure of epileptic patients, the second was the signal during the interictal period of epileptic patients, and the third was the normal EEG signal of healthy people, with a ratio of 1:1:2.
[0027] (2) Signal preprocessing: A bandpass filter was selected to filter the original EEG signal. The Z-score normalization method was used to map the EEG signal to a specific interval. Finally, the EEG signal was segmented according to the length of the preprocessing time window. The signal during the seizure period was segmented with a 50% overlap rate to increase the sample size, while the signal during the normal period was segmented with non-overlap to obtain multiple EEG signal segments.
[0028] (3) Sample set allocation: The sample data is divided into a training set of 70% and a test set of 30% using the hold-out method.
[0029] (4) Multi-scale feature extraction: The preprocessed EEG signal is input into the multi-scale feature extraction module, which contains three TCNs with different inflation factors of 1, 2 and 4. The three TCNs extract features from the EEG signal to obtain features at different scales.
[0030] (5) Feature Fusion: Multi-scale features extracted from multiple TCNs are fused using a feature concatenation method, that is, the features output by different TCNs are concatenated along the channel dimension. Assume the features output by the three TCNs are as follows: , , Their channel numbers are respectively , , The feature maps are all the same size.
[0031] The features after fusion The number of channels in the fused feature F can be calculated using the following formula:
[0032] (1)
[0033] The resulting fusion features contain rich time-scale information.
[0034] (6) Bidirectional Temporal Modeling: The fused features are input into the BiLSTM network. The BiLSTM consists of two layers, each with 128 neurons. The BiLSTM performs temporal modeling on the fused features in both forward and backward directions. The forward LSTM processes the sequence from the beginning to the end, while the backward LSTM processes the sequence from the end to the beginning. The BiLSTM network structure formed by connecting the two directions is as follows:
[0035] (2)
[0036] In forward processing, the output at the current moment depends not only on the current input and the current hidden state, but also on the hidden state at the previous moment; the reverse processing is similar. In this way, the contextual information of the past and future is fully utilized to further extract the temporal features of the EEG signal, so that the model can have a more accurate grasp of the temporal dynamic changes of the signal.
[0037] (7) Channel Attention Mechanism: A channel attention mechanism is introduced after the output of the BiLSTM. First, the features of the BiLSTM output are processed by global average pooling and global max pooling, using the formula...
[0038] (3)
[0039] in, Let the output features of the BiLSTM be of size C×H×W, and the result after global average pooling be... The size is C×1×1, calculated as follows, where c represents the channel index. This is the result after global max pooling. The size is also C×1×1, and the calculation formula is as follows:
[0040] (4)
[0041] Then and After concatenation, the data is input into a multilayer perceptron (MLP). The MLP contains two fully connected layers. The first fully connected layer has C / 16 neurons, and the second fully connected layer has C neurons. The MLP learns the importance weights of different channels, and then uses the sigmoid function to map the weight values to between 0 and 1. This weighting process is applied to the features output by the BiLSTM to highlight the features of important channels and suppress the features of unimportant channels, thereby enhancing the ability to extract effective features.
[0042] (8) Classification Prediction: The features processed by the channel attention mechanism are input into a fully connected layer containing 64 neurons to map the features. Then, the Softmax function is used for classification. The formula for the Softmax function is:
[0043] (5)
[0044] Where x is the input feature. The fully connected layer outputs the value of the corresponding category k, where k is the total number of categories (this method is a three-class classification, namely, epileptic seizure period, epileptic interictal period, and normal EEG signal of healthy person), and outputs the detection result of epileptic EEG signal, and determines whether the signal is epileptic seizure period, epileptic interictal period, or normal state of healthy person.
[0045] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0046] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for detecting epileptic electroencephalogram (EEG) signals based on multi-scale TCN-BiLSTM, characterized in that: Includes the following steps: (1) Data preparation: Collect EEG signals from epileptic patients during seizures, between seizures, and from healthy individuals in a ratio of 1:1:2 to ensure sample balance; (2) Signal preprocessing: The EEG signal is filtered by a bandpass filter, and then the data is segmented and Z-score normalized. (3) Sample set allocation: The processed EEG signals were divided into training set, validation set and test set using the hold-out method; (4) Multi-scale feature extraction module: The preprocessed EEG signal is input into a temporal convolutional network with multiple different dilation factors to extract multi-scale features of the EEG signal; (5) Feature fusion: The multi-scale features extracted from multiple TCNs are fused to obtain fused features containing rich time-scale information; (6) Bidirectional temporal modeling: The fused features are input into the BiLSTM network, and the BiLSTM performs temporal modeling on the fused features from both the forward and reverse directions; (7) Channel attention mechanism: A channel attention mechanism is introduced after the output of BiLSTM. By learning the importance weights of different EEG signal channels, the features of the BiLSTM output are weighted. (8) Classification and detection module: It consists of a fully connected layer and a Softmax function, which is used to classify and predict the features after they have been processed by the channel attention mechanism, output the detection results of the epileptic EEG signal, and determine whether the signal is in the epileptic seizure period, the epileptic interictal period, or the normal state of a healthy person.
2. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (1), three different signals are used: the first is the signal during the seizure of an epileptic patient, the second is the signal during the interictal period of an epileptic patient, and the third is the normal EEG signal of a healthy person, with a ratio of 1:1:
2.
3. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (2), a bandpass filter is selected to filter the original EEG signal, and the EEG signal is mapped to a specific interval using the Z-score normalization method. Finally, the EEG signal is segmented according to the length of the preprocessed time window. The ictal signal is segmented with a 50% overlap rate to increase the sample size, while the normal signal is segmented with non-overlapping segmentation to obtain multiple EEG signal segments.
4. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (3), the sample data is divided into a training set of 70% and a test set of 30% using the hold-out method.
5. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (4), the preprocessed EEG signal is input into the multi-scale feature extraction module, which contains three TCNs with different expansion factors of 1, 2 and 4. The three TCNs extract features from the EEG signal to obtain features at different scales.
6. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (5), the multi-scale features extracted by multiple TCNs are fused using a feature concatenation method, that is, the features output by different TCNs are concatenated along the channel dimension; assuming the features output by the three TCNs are respectively , , Their channel numbers are respectively , , The feature maps are all the same size. The features after fusion The number of channels in the fused feature F can be calculated using the following formula: (1) We obtain fused features that contain rich time-scale information.
7. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (6), the fused features are input into a BiLSTM network. The BiLSTM contains two layers, each with 128 neurons. The BiLSTM performs temporal modeling of the fused features from both forward and backward directions. The forward LSTM processes the sequence from the beginning to the end, while the backward LSTM processes the sequence from the end to the beginning. The BiLSTM network structure formed by connecting and combining the two directions is as follows: (2) This represents the hidden state vector of the forward LSTM at time step t. This represents the hidden state vector of the inverse LSTM at time step t. It is the hidden state vector of the forward LSTM at time t-1 step. It is the hidden state vector of the inverse LSTM at time step t-1. Represents a positive long short-term memory network. Represents an inverse long short-term memory network, where AttFeat represents the input features at time step t; In forward processing, the output at the current moment depends not only on the current input and the current hidden state, but also on the hidden state at the previous moment. The same applies to reverse processing. In this way, the contextual information of the past and future is fully utilized to further extract the temporal features of the EEG signal, enabling the model to have a more accurate grasp of the temporal dynamic changes of the signal.
8. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (7), a channel attention mechanism is introduced after the output of the BiLSTM. First, the features output by the BiLSTM are processed by global average pooling and global max pooling, using the formula: (3) in, Let the output feature of the BiLSTM be of size C×H×W, where C is the number of channels, H is the height, and W is the width. Within each channel, the average is calculated over all elements of the height H and width W dimensions. In this context, 'c' represents the channel index, 'i' represents the height index, and 'j' represents the width index. These three dimensions allow for the precise location of any element in the feature map. The result of global average pooling The result of global max pooling is of size C×1×1. The size is also C×1×1, and the calculation formula is as follows: (4) Then and After concatenation, the data is input into a multilayer perceptron (MLP). The MLP contains two fully connected layers. The first fully connected layer has C / 16 neurons, and the second fully connected layer has C neurons. The MLP learns the importance weights of different channels, and then uses the sigmoid function to map the weight values to between 0 and 1. This weighting process is applied to the features output by the BiLSTM to highlight the features of important channels and suppress the features of unimportant channels, thereby enhancing the ability to extract effective features.
9. The method for detecting epileptic EEG signals based on multi-scale TCN-BiLSTM according to claim 1, characterized in that: In step (8), the features processed by the channel attention mechanism are input into a fully connected layer containing 64 neurons to map the features. Then, the Softmax function is used for classification. The formula for the Softmax function is: (5) Where x is the input feature, The fully connected layer outputs the value of the corresponding category k, where k is the total number of categories (this method is a three-class classification, namely, epileptic seizure period, epileptic interictal period, and normal EEG signal of healthy person), and outputs the detection result of epileptic EEG signal, and determines whether the signal is epileptic seizure period, epileptic interictal period, or normal state of healthy person.