Epileptic seizure detection and positioning system and method combining time convolution and Transform network
By combining the time convolution network and the Transformer network to process the EEG time-frequency characteristics, the problems of low epilepsy detection accuracy and positioning accuracy in the prior art are solved, and high-accurate epilepsy detection and brain region positioning are achieved.
Patent Information
- Application Number
- CN202510165760.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-02-14
AI Technical Summary
Existing epilepsy detection algorithms perform poorly on large data sets, lack the ability to capture complex time dependencies in EEG signals, and are poorly interpretable and have low localization accuracy.
Combining the time-convolution network (TCN) and the Transformer network, EEG time-frequency characteristics are processed to realize the detection and localization of epilepsy. Local features are extracted through TCN, Transformer learns long-range dependencies, uses the attention weight of the EEG channel to achieve brain area positioning, and performs dynamic visualization.
It improves the accuracy and robustness of epilepsy detection, realizes accurate positioning and dynamic visualization of epilepsy brain areas, and reduces the false detection rate.
Smart Images

Figure CN120203503A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of epileptic electroencephalogram signal detection, and particularly to a system and method for epileptic seizure detection and localization combining temporal convolution and Transformer network. Background Art
[0002] The statements in this section merely provide background technical information related to the present invention and do not necessarily constitute prior art.
[0003] Epilepsy is a common neurological disorder characterized by recurrent and sudden epileptic seizures caused by abnormal neuronal discharges. Electroencephalogram (EEG) is an important tool for diagnosing neurological disorders and monitoring brain activities, and plays a key role in the detection and localization of epileptic seizures. Traditional epilepsy diagnosis relies on experienced neurologists to manually review long-term EEG records, which may lead to low efficiency and diagnostic bias. Therefore, developing algorithms for epileptic seizure detection and localization can reduce the workload of neurologists and assist in the treatment and preoperative evaluation of clinical epilepsy.
[0004] The development of automatic epileptic seizure detection systems has spanned several decades and achieved significant progress and applications. Selecting an optimal classifier to train feature vectors is a key step in the development of machine learning-based automatic epileptic seizure detection systems. Common machine learning classifiers for epileptic seizure detection include random forest, support vector machine (SVM), decision tree, and k-nearest neighbor, etc. Although machine learning-based classifiers have the advantage of low complexity, these classifiers usually perform poorly on large datasets and lack the ability to capture the complex temporal dependencies inherent in EEG signals. The emergence of deep learning has inspired extensive research on epileptic seizure detection, and models such as convolutional neural network (CNN) and long short-term memory network (LSTM) have shown better performance.
[0005] In clinical practice, EEG waveforms related to seizures usually originate from a few channels in the seizure onset zone and then gradually spread to the entire brain or specific regions. Clinicians need to carefully analyze multi-channel EEG records of epilepsy patients to determine the type and mechanism of seizures. However, most existing automatic seizure detection algorithms, especially those based on deep learning, have poor interpretability, usually only provide binary detection results, and do not have localization information about the seizure brain regions. Only a few algorithms provide localization information by combining channel selection techniques. For example, the prior art discloses an automatic channel selection algorithm that uses a supervised learning random forest classifier to accurately distinguish seizure, interictal, and early interictal EEG signals, achieving high-precision seizure monitoring and channel selection. The prior art combines common spatial pattern (CSP) features with a support vector machine (SVM) for seizure detection and uses the weights in the CSP matrix to determine the abnormal EEG channels for each patient. Although these methods provide channel selection, they fail to provide a dynamic visualization tool for lesion brain region localization and higher localization accuracy, and there is still room for improvement in seizure detection performance. Summary of the Invention
[0006] To solve the above problems, the present invention proposes a seizure detection and localization system and method combining temporal convolution and Transformer networks, which combines a temporal convolutional network (TCN) and a Transformer to process EEG time-frequency features to achieve seizure detection; it can give full play to the ability of the TCN in local feature extraction and the advantage of the Transformer in learning long-range dependencies, helps to identify multi-scale EEG features related to epilepsy, locates the seizure brain regions through the attention weights of EEG channels, and realizes dynamic visualization of the localization.
[0007] In some embodiments, the following technical solutions are adopted:
[0008] A seizure detection and localization system combining temporal convolution and Transformer networks, comprising:
[0009] A data acquisition module configured to obtain multi-channel EEG signals to be measured through an electrode, a multi-channel EEG amplifier, and an A / D converter connected in sequence, and divide the multi-channel EEG signals into multiple multi-channel EEG signal segments according to time;
[0010] A data processing module configured to, for each multi-channel EEG signal segment, extract the time-frequency features of the multi-channel EEG signal segment through S transform and perform dimensionality reduction processing;
[0011] The seizure detection module is configured to input the multi-channel EEG signal segments after dimensionality reduction processing into the trained TCN-Transformer model to obtain the seizure detection result. Among them, the TCN-Transformer model first extracts features from the input multi-channel EEG signal segments along the time dimension through the TCN network, and then calculates the output of the TCN network through the Transformer encoder to obtain the feature vector corresponding to each channel. The feature vector is sent to the fully connected layer, and after Softmax, the seizure probability score corresponding to the multi-channel EEG signal segment is obtained. After smoothing filtering, if the score is greater than the set threshold, the EEG segment is judged as a seizure segment, otherwise it is a non-seizure segment, and finally the seizure detection result is obtained.
[0012] The seizure localization module is configured to, when a seizure is detected, calculate the weight of each channel based on the seizure probability score, generate the final activation vector of each channel based on the weight, and realize the localization and visualization of the seizure based on the activation vector.
[0013] As a further solution, the time-frequency features of the multi-channel EEG signal segments are extracted by the S transform, specifically:
[0014]
[0015] Among them, x(t) is the original multi-channel EEG signal segment, and S x (τ,f) is the S transform spectrum of x(t), τ is the time offset, and f is the frequency.
[0016] As a further solution, the specific process of dimensionality reduction processing is:
[0017] For the time-frequency feature matrix obtained by the S transform, a specific frequency range is selected in the frequency dimension, and the selected frequency range is divided into p sub-bands; in the time dimension, it is divided into q sub-time periods; thus, the time-frequency feature matrix obtained by the S transform is decomposed into p*q sub-matrices.
[0018] The values in each sub-matrix are squared and summed to perform feature fusion and realize data dimensionality reduction; finally, an n-dimensional feature vector is obtained; n is the number of channels.
[0019] As a further solution, the weight of each channel is calculated based on the seizure probability score, specifically:
[0020] If the output of the Transformer encoder is denoted as Y k,t , k is the EEG channel, t is the time step, S cDenote the probability score of the EEG segment after the Transformer encoder passes through the fully connected layer and softmax. Then, calculate the corresponding channel weight α by computing the reverse gradient and performing global average pooling over the time steps. k :
[0021]
[0022] Where T is the total number of time steps.
[0023] As a further solution, generate the final activation vector for channel k based on the weights, specifically:
[0024]
[0025] As a further solution, localize and visualize epileptic seizures based on the activation vector, specifically: Each channel corresponds to a different location in the brain region. Map the activation vector of each channel into the brain topographic map to display the distribution of EEG signals in the spatial dimension, show the activation of different brain regions, and achieve the localization and visualization of epileptic seizures.
[0026] In some other embodiments, the following technical solution is adopted:
[0027] An epileptic seizure detection and localization method combining temporal convolution and Transformer network, including:
[0028] Obtain the multi-channel EEG signals to be measured through sequentially connected electrodes, a multi-channel EEG amplifier, and an A / D converter, and divide the multi-channel EEG signals into multiple multi-channel EEG signal segments according to time;
[0029] For each multi-channel EEG signal segment, extract the time-frequency features of the multi-channel EEG signal segment through the S transform and perform dimensionality reduction processing;
[0030] Input the multi-channel EEG signal segment after dimensionality reduction processing into the trained TCN-Transformer model to obtain the epileptic seizure detection result; wherein, the TCN-Transformer model first extracts features from the input multi-channel EEG signal segment along the time dimension through the TCN network, and then calculates the output of the TCN network through the Transformer encoder to obtain the feature vector corresponding to each channel; send the feature vector into the fully connected layer, and after Softmax, obtain the epileptic seizure probability score corresponding to the multi-channel EEG signal segment. After smoothing filtering, if the score is greater than the set threshold, the EEG segment is judged as an epileptic seizure segment, otherwise it is a non-seizure segment, and finally the epileptic seizure detection result is obtained;
[0031] When a seizure is detected, weights for each channel are calculated based on the seizure probability score, and the final activation vector for each channel is generated based on the weights. Seizure localization and visualization are achieved based on the activation vector.
[0032] In some other embodiments, the following technical solutions are adopted:
[0033] A terminal device includes a processor and a memory. The processor is used to implement instructions; the memory is used to store multiple instructions, and the instructions are adapted to be loaded and executed by the processor to perform the above-mentioned seizure detection and localization method combining temporal convolution and Transformer network.
[0034] In some other embodiments, the following technical solutions are adopted:
[0035] A computer-readable storage medium stores multiple instructions, and the instructions are adapted to be loaded and executed by the processor of a terminal device to perform the above-mentioned seizure detection and localization method combining temporal convolution and Transformer network.
[0036] Compared with the prior art, the beneficial effects of the present invention are:
[0037] (1) The present invention combines the TCN-Transformer model with EEG time-frequency feature fusion. This feature fusion strategy effectively captures time-frequency features while retaining channel information. By leveraging the local feature extraction ability of TCN and the long-range dependence mining ability of Transformer, this method can more comprehensively capture multi-scale features from multi-channel EEG data, thereby improving the accuracy and robustness of seizure detection.
[0038] (2) The Transformer model of the present invention can calculate the activation (weight) vector of EEG channels during a seizure. Mapping the activation vector to the brain topology map can display the distribution of EEG activities in the spatial dimension, achieving accurate localization and dynamic visualization of epileptic foci.
[0039] (3) When performing seizure detection, the present invention smooths the detection results of multiple EEG signal segments, which can reduce the false detection rate (FDR) caused by artifacts and noise.
[0040] Other features and advantages of the additional aspects of the present invention will be partially given in the following description, partially become apparent from the following description, or be understood through the practice of this aspect. Description of the Drawings
[0041] Figure 1 It is a schematic diagram of the seizure detection process based on temporal convolution attention in an embodiment of the present invention;
[0042] Figure 2 The EEG signals and their S-transform amplitude spectrograms during epileptic seizures and non-seizures in the embodiments of the present invention;
[0043] Figure 3 Schematic diagram of the compression process of the time-frequency map obtained from a single-channel EEG signal by S-transform in the embodiments of the present invention;
[0044] Figure 4(a) is a schematic diagram of the architecture of the Temporal Convolutional Network (TCN) in the embodiments of the present invention;
[0045] Figure 4(b) is a structural diagram of each layer in the Temporal Convolutional Network in the embodiments of the present invention;
[0046] Figure 5 Schematic diagram of the Transformer encoder and multi-head self-attention module structures in the embodiments of the present invention;
[0047] Figure 6 Schematic diagram of the post-processing process in the embodiments of the present invention;
[0048] Figure 7 Epileptic seizure brain region activation maps of 7 patients in the embodiments of the present invention;
[0049] Figure 8(a) - Figure 8(c) Epileptic seizure brain region activation maps and original EEG signal waveforms of the method in this embodiment respectively. Detailed implementation manners
[0050] It should be noted that the following detailed descriptions are all illustrative and are intended to provide further explanations for the present application. Unless otherwise specified, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those of ordinary skill in the technical field to which the present application belongs.
[0051] It should be noted that the terms used herein are only for describing specific implementation manners and are not intended to limit the exemplary implementation manners according to the present application. As used herein, unless the context clearly indicates otherwise, the singular forms are also intended to include the plural forms. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0052] Embodiment 1
[0053] In one or more embodiments, an epileptic seizure detection and localization system combining temporal convolution and Transformer network is disclosed, combining Figure 1 , specifically including:
[0054] (1) A data acquisition module, configured to acquire multi-channel electroencephalogram (EEG) signals to be measured through an EEG signal acquisition device, and divide the multi-channel EEG signals into multiple multi-channel EEG signal segments according to time.
[0055] In this embodiment, the EEG signal acquisition device may include an electrode, a multi-channel EEG amplifier, and an A / D converter connected in sequence; multiple electrodes are distributed on the scalp surface to capture the electrical signals of different regions of the brain, forming multi-channel EEG signals, thereby providing rich spatio-temporal information.
[0056] The complete multi-channel EEG signals can be divided into multiple multi-channel EEG signal segments according to time. For example, the complete multi-channel EEG signals are intercepted into multiple multi-channel EEG signal segments at a set time interval.
[0057] (2) A data processing module, configured to extract the time-frequency features of each multi-channel EEG signal segment through the S transform and perform dimensionality reduction processing for each multi-channel EEG signal segment.
[0058] In this embodiment, each EEG signal segment is processed separately.
[0059] The S transform can perform multi-resolution analysis and has relatively low computational complexity, and is suitable for processing non-stationary signals such as EEG signals.
[0060] The S transform spectrum S x (τ, f) of the time-domain signal x(t) is defined as follows:
[0061] S x (τ, f) = e -i2πfτ W x (τ, f) (1)
[0062]
[0063] where W x (τ, f) represents the wavelet transform of x(t), ω(t - τ, f) is the wavelet function, τ is the time shift, f is the frequency, and ω(t - τ, f) is defined as:
[0064]
[0065] Finally, the S transform is expressed as:
[0066]
[0067] In this embodiment, each 4-second multi-channel EEG signal segment is denoted by x(t). The S transform is applied to each 4-second 18-channel EEG signal segment to convert it from the time domain to the time-frequency domain. The resulting time-frequency matrix has dimensions of 18×128×1024, where 18 represents the number of EEG channels, 128 corresponds to the frequency range from 1 to 128 Hz, and 1024 represents the time steps for each segment. Figure 2 shows the differences between randomly selected one-channel EEG segments of patient chb01 during seizure and non-seizure states; Figure 2 In (a) and (b) of [reference], the EEG segments during seizure and non-seizure are shown respectively, while Figure 2 in (c) and (d) of [reference] show the corresponding S transform magnitude spectra.
[0068] In the time-frequency power spectrum, the Y-axis represents the frequency range from 0 to 128 Hz, and the color intensity corresponds to the power associated with the corresponding time-frequency distribution. It can be seen that the time-frequency distribution obtained by the S transform reveals significant differences in the frequency content between the seizure period and the non-seizure period. During seizure events, compared with the low-frequency distribution in non-seizure EEG signals, the energy increases significantly over a wider frequency range, especially between 1 - 50 Hz. This highlights the ability of the S transform in capturing fine-grained time-frequency patterns that are not obvious in the original EEG signals.
[0069] Figure 3 shows the time-frequency spectrum fusion process of a single-channel EEG signal. The time-frequency distribution map of the EEG signal obtained by the S transform has the horizontal axis representing time (0 - 4 seconds) and the vertical axis representing frequency (0 - 128 Hz). To reduce artifacts such as electromyogram interference, electrooculogram interference, and environmental noise, the frequency components from 1 to 50 Hz are selected from the original EEG signal. Subsequently, the selected frequency band is divided into six sub-bands: delta wave (1 - 4 Hz), theta wave (4 - 8 Hz), alpha wave (8 - 12 Hz), beta wave (12 - 30 Hz), gamma1 wave (30 - 40 Hz), and gamma2 wave (40 - 50 Hz). On the time axis, each 4-second EEG segment is divided into two sub-segments, each sub-segment lasting 2 seconds. As a result, the time-frequency matrix obtained by the S transform is decomposed into 12 sub-matrices, and the values in each sub-matrix are subjected to feature fusion and dimensionality reduction through sum of squares, resulting in a one-dimensional feature vector for this single channel; the EEG signals of n channels are subjected to time-frequency spectrum fusion, and finally an n-dimensional feature vector is obtained.
[0070] Through this fusion process, in this embodiment, the dimension of each multi-channel EEG signal is reduced from 18×128×1024 to 18×12, greatly reducing the computational complexity of the model while retaining important information related to channels and frequencies, which helps to localize the activated brain regions during seizure.
[0071] (3) The seizure detection module is configured to input the dimensionality-reduced multi-channel EEG signal segments into the trained TCN-Transformer model to obtain the seizure detection result. Specifically, the TCN-Transformer model first extracts features from the input multi-channel EEG signal segments along the time dimension through the TCN network, and then calculates the output of the TCN network through the multi-head attention block (MHA) and the feed-forward network (FFN) of the Transformer encoder to obtain the feature vector corresponding to each channel. The feature vector is fed into the fully connected layer, and after Softmax, the seizure probability score of the corresponding multi-channel EEG signal segment is obtained. After smoothing filtering, if the score is greater than the set threshold, the EEG segment is determined to be a seizure segment; otherwise, it is a non-seizure segment, and finally the seizure detection result is obtained.
[0072] In this embodiment, the TCN-Transformer model is used to capture the local and global dependencies of EEG signals related to seizures, which helps to capture multi-channel EEG features.
[0073] This model can retain EEG channel information and dynamically visualize the active channels, and localize the seizure brain regions through the attention weights of the EEG channels, making the detection result have good interpretability.
[0074] Specifically, as shown in Figure 4(a), the temporal convolutional network (TCN) in this embodiment adopts a four-layer structure, including an input layer, two hidden layers, and an output layer. The filter size is k = 3, and the dilation factor is d = 1, 2, 4. Each layer structure consists of three modules: causal convolution, dilated convolution, and residual connection, as shown in Figure 4(b). The input of the model is first fed into the causal convolution and the dilated convolution, and then passes through the normalization layer WeightNorm, ReLU, Dropout in sequence, and finally passes through the residual connection to obtain the output.
[0075] Among them, the causal convolution is used to prevent future information leakage and ensure that the output at time t only depends on the elements at time t and before. Different from the traditional convolutional network, the causal convolution is a unidirectional structure and can only access past data. In addition, the dilated convolution aims to better process long-time sequence data through a larger receptive field. The dilation rate is controlled by the hyperparameter d. The formula for the dilated convolution is as follows:
[0076]
[0077] Among them, d is the dilation factor, M is the filter size, and (t - d * i) represents the position of the historical sequence.
[0078] As can be seen from the above analysis, dilated convolution can flexibly expand the receptive field by choosing a larger filter size M and a dilation factor d that grows exponentially with the network depth.
[0079] Since EEG signals are typical time series data, TCN can extract features over multiple time steps, thereby enhancing the feature extraction of EEG in the time dimension. The preprocessed EEG signals are input into a four-layer TCN module for feature extraction along the time dimension. In this model, TCN maintains the consistency of the input and output matrix dimensions, ensuring the preservation of the correlation between channels while extracting features.
[0080] In this embodiment, the EEG data from each channel is regarded as a token in the sequence, and this process is called channel embedding; given that epilepsy detection is essentially a classification task, this embodiment employs a multi-layer stacked Transformer encoder module. Specifically, the output of TCN serves as the input feature for the Transformer encoder. The Transformer encoder consists of two main modules: the multi-head self-attention mechanism (MHA) and the feed-forward network (FFN), both of which adopt residual connections. FFN consists of two linear transformations connected by a ReLU activation function in the middle, facilitating the transformation of complex features.
[0081] The self-attention mechanism can be described as a mapping from a query Q to a set of key-value pairs (K, V). The dimensions of Q and K are d k , while the dimension of V is d v .
[0082] The output of the sequence S after the self-attention mechanism can be calculated by the following formula:
[0083] [Q, K, V] = S[W Q , W K , W V (6)
[0084]
[0085] where and are linear transformation matrices; in the multi-head self-attention (MSA) mechanism, multiple self-attention operations run in parallel and the output is obtained after concatenation:
[0086] MHA(S) = concat(head1(S), …, head h (S))W O (8)
[0087] where In this embodiment, d k = d v=d model / h, using multi-head attention with h=8.
[0088] Figure 5 The structure of the Transformer encoder and the multi-head self-attention (MHA) module are shown. The Transformer encoder in this study consists of L = 2 layers, each containing h = 8 attention heads. The process of the Transformer encoder can be expressed by the following formula:
[0089] y i =MHA(S i-1 ) (9)
[0090] S i =LN(S i-1 +y i )+FFN(LN(y i )) (10)
[0091] Where i = 1, ..., L and L = 2. LN is layer normalization, which normalizes the features of each sample so that the mean is 0 and the variance is 1. i-1 +y i ) is to perform layer normalization on the features after residual connection. FFN is a feed-forward neural network, which is usually two layers of linear transformation plus an activation function.
[0092] Finally, the maximum pooling is performed along the first dimension of S to obtain the input of the fully connected module FC. The two FC layers contain 216 and 2 neurons respectively. Finally, the data passing through the FC layer is output through the softmax layer to output the probability of epileptic seizure and non-seizure events, that is, the epileptic seizure probability score.
[0093] The EEG signal of each channel corresponds to the activity of a specific spatial position in the brain, which means that the spatial correlation between channels essentially embodies the position information. In addition, the present embodiment uses S transform to extract the time-frequency representation of the original EEG signal, so that position information encoding is not required to capture the time series, and therefore, position encoding is not required.
[0094] After obtaining the epileptic seizure probability score of each multi-channel EEG signal segment, the process of smoothing and filtering the detection probability score is also included; it mainly includes the following two steps:
[0095] (3-1) In order to eliminate isolated false positives, a moving average filter (MAF) is first applied to smooth the probability scores of each multi-channel EEG signal segment.
[0096] (3-2) Thresholding is performed. The part where the probability score exceeds the set threshold is assigned a value of 1, indicating that the corresponding multi-channel EEG signal segment is recognized as a seizure. The probability scores that do not exceed the threshold are assigned a value of 0, indicating that the corresponding multi-channel EEG signal segment is recognized as non-seizure.
[0097] (3-3) A 40-second window is slid (each time sliding 10 EEG segments) to further process the detection results of the model. If there are 5 or more segments classified as seizures within the window, all multi-channel EEG signal segments within that time period are marked as seizures.
[0098] Figure 6 An example of the post-processing process is shown, where Figure 6 (a) in shows the detection results of the TCN-Transformer model of this embodiment for one hour of EEG signals, Figure 6 (b) in is the output after moving average filtering and smoothing; Figure 6 (c) in is the binary value result after thresholding; Figure 6 (d) in is the final result after marking with a sliding window.
[0099] (4) Seizure localization module, configured to, when a seizure is detected, calculate the weight of each channel based on the seizure probability score, generate the final activation vector of each channel based on the weight, and implement the localization and visualization of the seizure based on the activation vector.
[0100] The interpretability of neural networks is crucial in medical applications. Fine-grained information, such as the activated brain regions and EEG waveform frequencies, helps in the clinical diagnosis of epilepsy. The aforementioned EEG signal feature extraction process preserves the channel and frequency information, enabling the TCN-Transformer model to assign different attentions to different channels and frequencies, thus realizing the localization of the epileptic focus.
[0101] This embodiment realizes the visualization of the localization of the epileptic focus through a multi-channel activation map method.
[0102] If the output of the Transformer encoder is Y k,t , k is the EEG channel, t is the time step, and S c represents the probability score of the EEG segment after the Transformer encoder passes through the fully connected layer and softmax, then the corresponding channel weight α is calculated by calculating the reverse gradient and performing global average pooling over the time steps k :
[0103]
[0104] where T is the total number of time steps.
[0105] Then, the channel weight α k and the output of the Transformer encoder Y k,t are weighted and summed, and the ReLU function is applied for normalization to retain the part with positive contribution to seizure, and finally the activation vector of channel k is obtained as:
[0106]
[0107] L(k) represents the activation vector of channel k, which is an n-dimensional array, and n is the number of EEG channels.
[0108] In this embodiment, through the mapping of L(k), L(k) is mapped into the brain topographic map. Through the topographic map, the activation degree of different brain regions by seizures and the roles played by different brain regions during seizures can be obtained, so as to realize the localization and visualization of seizures. Through this embodiment, the brain regions participating in epileptic activities can be visualized, and the dynamic evolution process of seizures can be intuitively observed, helping to understand the evolution mechanism of seizures.
[0109] Next, the system of this embodiment is experimentally verified.
[0110] A total of 30 epilepsy patients' long-term scalp EEG data are used in this embodiment for experiments. The signal acquisition process follows the international 10-20 system for electrode placement and naming, and the start and end times of each seizure event are marked by medical professionals. The experiments are programmed using Python 3.6 and PyTorch 1.10.2 on a computer equipped with a 3.60GHz AMD Ryzen 5 2400G CPU and 16GB RAM.
[0111] Two metrics are used for evaluation: sensitivity and false discovery rate (FDR). Sensitivity is defined as the ratio of the number of correctly detected seizure events to the total number of seizure events of each patient used for verification. FDR is measured by the average number of false positives per hour. Among 172 seizure events, the model achieved an average sensitivity of 99.75%, and only 1 seizure event was not detected. The average false discovery rate (FDR) was 0.21 times per hour, and the FDR of 9 cases was 0 times per hour.
[0112] By using the multi-channel EEG activation map method of the present invention, the sensitivity of calculating the activation values of the output feature maps can be used to more intuitively analyze the channels related to the onset of seizures. Figure 7Shows the brain region activation maps of 7 patients during seizure events. Figure 8 is the multi-channel EEG activation map and the original EEG signal waveform detected by the method of this embodiment, where Figure 8(a) shows the first seizure event of the 10th patient, and the seizure start time is 6313 seconds. The two seizure events in Figures 8(b) and (c) both come from the 6th patient and start at 1723 seconds and 6210 seconds respectively. Table 1 gives the seizure localization results of the seven patients. The second column of Table 1 lists the lesion brain regions of the patients, and these regions are determined by medical experts based on long-term EEG, MRI, and clinical records. The third column of Table 1 lists 1 or 2 most significant seizure lesion brain regions detected by the method of this embodiment for each seizure event of each patient; it can be seen that compared with the reference regions in the second column, the method of this embodiment can effectively identify the seizure lesion brain regions.
[0113] Table 1 Seizure localization results of seven patients
[0114]
[0115]
[0116] Note: T = temporal lobe, F = frontal lobe, O = occipital lobe, P = parietal lobe, C = central
[0117] Example Two
[0118] In one or more embodiments, a seizure detection and localization method combining temporal convolution and Transformer network is disclosed, including:
[0119] Obtain multi-channel EEG signals to be measured through sequentially connected electrodes, a multi-channel EEG amplifier, and an A / D converter, and divide the multi-channel EEG signals into multiple multi-channel EEG signal segments according to time;
[0120] For each multi-channel EEG signal segment, extract the time-frequency features of the multi-channel EEG signal segment through S transform and perform dimensionality reduction processing;
[0121] Input the multi-channel EEG signal segments after dimensionality reduction processing into the trained TCN-Transformer model to obtain the epilepsy seizure detection result; wherein, the TCN-Transformer model first extracts features from the input multi-channel EEG signal segments along the time dimension through the TCN network, and then calculates the output of the TCN network through the Transformer encoder to obtain the feature vector corresponding to each channel; send the feature vector into the fully connected layer, and after Softmax, obtain the epilepsy seizure probability score corresponding to the multi-channel EEG signal segments. After smoothing filtering, if the score is greater than the set threshold, the EEG segment is judged as an epilepsy seizure segment, otherwise it is a non-seizure segment, and finally the epilepsy seizure detection result is obtained;
[0122] When an epilepsy seizure is detected, calculate the weight of each channel based on the epilepsy seizure probability score, generate the final activation vector of each channel based on the weight, and realize the localization and visualization of the epilepsy seizure based on the activation vector.
[0123] The implementation manners of each step in the above method are exactly the same as those in Embodiment 1.
[0124] Embodiment 3
[0125] In one or more embodiments, a terminal device is disclosed, which includes a processor and a memory. The processor is used to implement instructions; the memory is used to store multiple instructions, and the instructions are suitable for being loaded and executed by the processor to perform the epilepsy seizure detection and localization method combining temporal convolution and Transformer network in Embodiment 2.
[0126] Embodiment 4
[0127] In one or more embodiments, a computer-readable storage medium is disclosed, in which multiple instructions are stored, and the instructions are suitable for being loaded and executed by the processor of the terminal device to perform the epilepsy seizure detection and localization method combining temporal convolution and Transformer network in Embodiment 2.
[0128] Although the specific implementation manners of the present invention are described above in conjunction with the accompanying drawings, it is not a limitation to the protection scope of the present invention. Those skilled in the art should understand that based on the technical solutions of the present invention, various modifications or deformations that can be made by those skilled in the art without creative labor are still within the protection scope of the present invention.
Claims
1. An epileptic seizure detection and localization system combining temporal convolution and Transformer network, characterized in that: include: A data acquisition module is configured to acquire a multi-channel EEG signal to be measured through electrodes, a multi-channel EEG amplifier and an A / D converter connected in sequence, and divide the multi-channel EEG signal into a plurality of multi-channel EEG signal segments according to time; The data processing module is configured to extract the time-frequency features of each multi-channel EEG signal segment through S-transformation and perform dimensionality reduction processing; The epileptic seizure detection module is configured to input the multi-channel EEG signal fragments that have been processed by dimensionality reduction into the trained TCN-Transformer model to obtain the epileptic seizure detection result; wherein the TCN-Transformer model first extracts features from the input multi-channel EEG signal fragments along the time dimension through the TCN network, and then calculates the output of the TCN network through the Transformer encoder to obtain the feature vector corresponding to each channel; the feature vector is sent to the fully connected layer, and after Softmax, the epileptic seizure probability score of the corresponding multi-channel EEG signal fragment is obtained. After smoothing filtering, if the score is greater than the set threshold, the EEG fragment is judged as an epileptic seizure segment, otherwise it is a non-seizure segment, and finally the epileptic seizure detection result is obtained; The epilepsy localization module is configured to calculate the weight of each channel based on the epilepsy probability score when an epileptic seizure is detected, generate a final activation vector for each channel based on the weight, and localize and visualize the epileptic seizure based on the activation vector.
2. The epileptic seizure detection and location system combining temporal convolution and Transformer network as claimed in claim 1, characterized in that: The time-frequency characteristics of multi-channel EEG signal fragments are extracted by S transform, specifically: Among them, x(t) is the original multi-channel EEG signal segment, S x (τ,f) is the S-transform spectrum of x(t), τ is the time offset, and f is the frequency.
3. The epilepsy seizure detection and location system combining temporal convolution and Transformer network as claimed in claim 1, characterized in that: The specific process of dimensionality reduction is as follows: The time-frequency feature matrix obtained by S transformation is decomposed into p*q sub-matrices by selecting a specific frequency range in the frequency dimension and dividing the selected frequency range into p sub-frequency bands and q sub-time periods in the time dimension. The values in each submatrix are squared and summed to perform feature fusion to achieve data dimensionality reduction; ultimately an n-dimensional feature vector is obtained; n is the number of EEG channels.
4. The epileptic seizure detection and location system combining temporal convolution and Transformer network as claimed in claim 1, characterized in that: The weight of each channel is calculated based on the epileptic seizure probability score, specifically: If the Transformer encoder output is denoted by Y k,t , k is the EEG channel, t is the time step, S c represents the probability score of the EEG segment after the Transformer encoder passes through the fully connected layer and softmax, and the corresponding channel weight α is calculated by calculating the reverse gradient and performing global average pooling on the time step k : Where T is the total number of time steps.
5. The epilepsy seizure detection and location system combining temporal convolution and Transformer network as claimed in claim 4, characterized in that: The final activation vector of channel k is generated based on the weights, specifically:
6. The epileptic seizure detection and location system combining temporal convolution and Transformer network as claimed in claim 5, characterized in that: The localization and visualization of epileptic seizures are achieved based on the activation vector, specifically: Each channel corresponds to a different position in the brain area, and the activation vector of each channel is mapped to the brain topology map to show the distribution of EEG signals in the spatial dimension, display the activation status of different brain areas, and achieve the location and visualization of epileptic seizures.
7. A method for epileptic seizure detection and localization combining temporal convolution and Transformer network, characterized in that: include: Acquire a multi-channel EEG signal to be measured by sequentially connecting electrodes, a multi-channel EEG amplifier and an A / D converter, and divide the multi-channel EEG signal into a plurality of multi-channel EEG signal segments according to time; For each multi-channel EEG signal segment, the time-frequency features of the multi-channel EEG signal segment are extracted by S-transformation, and dimensionality reduction is performed; The multi-channel EEG signal fragments subjected to dimensionality reduction processing are input into the trained TCN-Transformer model to obtain epileptic seizure detection results; wherein, the TCN-Transformer model first extracts features from the input multi-channel EEG signal fragments along the time dimension through the TCN network, and then calculates the output of the TCN network through the Transformer encoder to obtain the feature vector corresponding to each channel; the feature vector is sent to the fully connected layer, and after Softmax, the epileptic seizure probability score of the corresponding multi-channel EEG signal fragment is obtained. After smoothing filtering, if the score is greater than the set threshold, the EEG fragment is judged as an epileptic seizure segment, otherwise it is a non-seizure segment, and finally the epileptic seizure detection result is obtained; When an epileptic seizure is detected, the weight of each channel is calculated based on the epileptic seizure probability score, the final activation vector of each channel is generated based on the weight, and the location and visualization of the epileptic seizure are achieved based on the activation vector.
8. A terminal device, comprising a processor and a memory, wherein the processor is used to implement instructions; and the memory is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing the epileptic seizure detection and localization method combining temporal convolution and Transformer network as described in claim 7.
9. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instructions are suitable for being loaded by a processor of a terminal device and executing the epileptic seizure detection and localization method combining temporal convolution and Transformer network as described in claim 7.
Citation Information
Patent Citations
Epileptic seizure prediction method through electroencephalogram signal on the basis of multi-scale convolution and self-attention network
CN113907706A
Epileptic seizure prediction system based on CNN and self-attention mechanism
CN115381407A
Physiological information acquisition and analysis system and method for biological feedback
CN117653133A
Lightweight brain electrical emotion recognition method and system based on convolutional neural network
CN119048795A
Real-time epileptic seizure detecting and monitoring system for video electroencephalogram examination of epilepsy
WO2023098303A1
Cited By
Weakly supervised inter-seizure epilepsy sample discharge detection method based on space prior
CN121570190A
