Epileptic EEG signal monitoring method and system based on spatiotemporal attention mechanism
Through a method based on the spatiotemporal attention mechanism, the spatial and temporal characteristics of epilepsy EEG signals are automatically extracted using the graph attention network and transformer network, solving the problem of time-consuming and subjective detection in the existing technology, and achieving a higher Inspection accuracy and efficiency.
Patent Information
- Application Number
- CN202211337068.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2042-10-28
AI Technical Summary
The prior art has the problem of time-consuming and highly subjective in the detection of epilepsy EEG signal, and machine learning-based methods require manual selection of the best features, which affects the classification accuracy.
Using a method based on the space-time attention mechanism, spatial feature aggregation is performed through the graph attention network, combined with the transformer network to extract the time features, and directly classify the multi-channel original signal input network, solving the problems of gradient vanishing and information loss, and automatically selecting the best feature.
It improves the accuracy of epilepsy detection, reduces manual intervention, and improves detection efficiency and accuracy.
Smart Images

Figure CN115590529B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of electroencephalogram (EEG) signal processing, and in particular relates to an epileptic EEG signal monitoring method and system based on a spatiotemporal attention mechanism. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Epilepsy is a serious chronic neurological disease, usually caused by abnormal hypersynchronous discharges of a large number of nerve cells in the brain. Its main manifestations include cognitive impairment, tongue biting, foaming at the mouth, and sometimes even persistent unconscious convulsions. Epilepsy can damage the normal physiological functions of the brain and affect people's normal life. Most patients will also suffer from other unforeseen side effects, such as memory loss, depression and other psychological disorders. If not diagnosed and treated in time, it will greatly affect the patient's normal life, and in severe cases it may even cause death.
[0004] Epilepsy detection can be performed by analyzing brain signals generated by neurons in the brain. Neurons are interconnected in a complex way, communicate with human organs and generate signals. These brain signals are usually monitored using electroencephalograms and electrocardiograms. These signals are complex, noisy, nonlinear, non-stationary, and generate a large amount of data. Therefore, detecting epileptic seizures and discovering relevant knowledge about the brain is a challenging task.
[0005] In current clinical treatment, doctors usually evaluate the patient's brain signals over a certain period of time to determine the location of the brain and manifestations of the disease. When an epileptic seizure occurs, a specific EEG waveform will be generated in the EEG, which is different from normal EEG. However, this traditional detection and diagnosis method often requires professional physicians to judge long-term EEGs by eye based on experience. This process is time-consuming, subjective, and contains a lot of noise. In addition, involuntary convulsions in the human body are an important manifestation of epileptic seizures, but there are many reasons for convulsions, such as intravenous injections in the human body, external shocks, interference from electronic equipment, turning over during sleep, etc., so it is very easy to make misjudgments by only analyzing the EEG with the naked eye.
[0006] With the rise of machine learning, using machine learning classifiers to classify EEG data and then detect epileptic seizures has become a hot trend. In the prior art, different researchers have developed some methods for monitoring epilepsy EEG signals based on machine learning, but the machine learning-based methods require manual selection of the best features, which is very time-consuming. At the same time, there is a great deal of subjectivity in the selection of the best features, which seriously affects the accuracy of machine learning classification. Summary of the invention
[0007] In order to overcome the shortcomings of the above-mentioned prior art, the present invention provides an epileptic EEG signal monitoring method and system based on the spatiotemporal attention mechanism, which directly inputs the original signal graph structure of multiple channels into the network without the need for manually designed features for classification, aggregates spatial features through the graph attention network, and then uses the transformer network to extract time information, and finally classifies them. This solves the problems of gradient vanishing and gradient exploding during long sequence training, and at the same time solves the problem of information loss during two-dimensional EEG processing, selects the most critical information from the epileptic EEG signal, and then selects the optimal features, so as to achieve the purpose of improving the accuracy of epilepsy detection.
[0008] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:
[0009] The first aspect of the present invention provides a method for monitoring epileptic EEG signals based on a spatiotemporal attention mechanism.
[0010] The epilepsy EEG signal monitoring method based on spatiotemporal attention mechanism includes the following steps:
[0011] Acquire multi-channel EEG signals and pre-process the multi-channel EEG signals;
[0012] Construct a graph attention network and a transformer network, use the output of the graph attention network as the input of the transformer network, and construct a fusion network;
[0013] Based on the preprocessed multi-channel EEG signals, a training set is constructed, and the fusion network is trained using the training set to obtain a trained fusion network;
[0014] The multi-channel EEG signals are input into the trained fusion network, and the spatial features are first extracted through the graph attention network. Then the EEG signals with aggregated spatial features are input into the transformer network to extract the temporal features and obtain the classification results.
[0015] The second aspect of the present invention provides an epileptic EEG signal monitoring system based on a spatiotemporal attention mechanism.
[0016] Epilepsy EEG signal monitoring system based on spatiotemporal attention mechanism, including:
[0017] The signal acquisition and preprocessing module is configured to: acquire multi-channel EEG signals and preprocess the multi-channel EEG signals;
[0018] The fusion network building module is configured to: build a graph attention network and a transformer network, use the output of the graph attention network as the input of the transformer network, and build a fusion network;
[0019] The fusion network training module is configured to: construct a training set based on the preprocessed multi-channel EEG signal, and train the fusion network using the training set to obtain a trained fusion network;
[0020] The classification result acquisition module is configured as follows: inputting the multi-channel EEG signal into the trained fusion network, first extracting the spatial features through the graph attention network, then inputting the EEG signal with aggregated spatial features into the transformer network to extract the temporal features, and obtaining the classification result.
[0021] The third aspect of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in the epilepsy EEG signal monitoring method based on the spatiotemporal attention mechanism as described in the first aspect of the present invention.
[0022] The fourth aspect of the present invention provides an electronic device, including a memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the method for monitoring epilepsy EEG signals based on the spatiotemporal attention mechanism as described in the first aspect of the present invention are implemented.
[0023] One or more of the above technical solutions have the following beneficial effects:
[0024] The present invention uses a deep learning network with an attention mechanism to detect epilepsy. There is no need to manually design features for classification. Instead, the original signal graph structure of multiple channels is directly input into the network, spatial features are aggregated through the graph attention network, and then the time information is extracted using the transformer network for final classification. Establishing this fusion network solves the problems of gradient vanishing and gradient explosion during long sequence training, and solves the problem of information loss during two-dimensional EEG processing. The multi-head attention mechanism of the model is used to select the most critical information from the epileptic EEG signal, and then select the optimal features to achieve the purpose of improving the accuracy of epilepsy detection.
[0025] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0027] Figure 1 This is a flow chart of the method of the first embodiment.
[0028] Figure 2 This is a schematic diagram of the first embodiment of epileptic EEG signal preprocessing and EEG signal classification using a fusion network.
[0029] Figure 3 This is a schematic diagram of the attention network processing EEG signals in the first embodiment.
[0030] Figure 4 This is a schematic diagram of the EEG signal of an epileptic seizure in the first embodiment.
[0031] Figure 5 It is a system structure diagram of the second embodiment. DETAILED DESCRIPTION
[0032] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0033] It should be noted that the terms used herein are for describing specific embodiments only and are not intended to be limiting of exemplary embodiments according to the present invention.
[0034] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0035] Embodiment 1
[0036] This embodiment discloses a method for monitoring epileptic EEG signals based on a spatiotemporal attention mechanism.
[0037] like Figure 1 As shown, the epilepsy EEG signal monitoring method based on the spatiotemporal attention mechanism includes the following steps:
[0038] Acquire multi-channel EEG signals and pre-process the multi-channel EEG signals;
[0039] Construct a graph attention network and a transformer network, use the output of the graph attention network as the input of the transformer network, and construct a fusion network;
[0040] Based on the preprocessed multi-channel EEG signals, a training set is constructed, and the fusion network is trained using the training set to obtain a trained fusion network;
[0041] The multi-channel EEG signals are input into the trained fusion network, and the spatial features are first extracted through the graph attention network. Then the EEG signals with aggregated spatial features are input into the transformer network to extract the temporal features and obtain the classification results.
[0042] Furthermore, multi-channel EEG signals are obtained, including:
[0043] 16 EEG electrodes are used to collect EEG signals and obtain EEG signals of 16 channels to be detected.
[0044] Furthermore, the multi-channel EEG signal is preprocessed, specifically including: performing noise reduction and filtering on the multi-channel EEG signal, and dividing the EEG signal of each channel after noise reduction into several time windows according to a set time length to obtain the preprocessed multi-channel EEG signal.
[0045] Furthermore, based on the preprocessed multi-channel EEG signals, a training set is constructed, which specifically includes:
[0046] The pre-processed multi-channel EEG signals are labeled with epileptic seizure intervals and epileptic seizure periods;
[0047] The preprocessed multi-channel EEG signals, epileptic seizure interval annotations and epileptic seizure period annotations constitute the training set.
[0048] Furthermore, the fusion network is trained using the training set, including:
[0049] Divide the acquired multi-channel EEG signals in proportion to construct training sets, validation sets, and test sets;
[0050] The multi-channel EEG signals preprocessed in the training set are calculated using Pearson correlation to obtain a correlation matrix, and a graph structure is constructed at the same time. The correlation matrix and the graph structure are combined to form a feature matrix of the EEG signal.
[0051] The feature matrix, epileptic seizure interval annotations and epileptic seizure period annotations are input into the graph attention network, and the fusion network is trained using the feature matrix;
[0052] The fusion network is trained. When the loss function of the fusion network reaches the minimum value or the number of iterations meets the set requirements, the training is stopped to obtain the trained fusion network, which is verified with the validation set and the epileptic EEG signal is tested with the test set.
[0053] In this embodiment, both the training set and the test set contain EEG signals with known epilepsy or non-epileptic diagnosis results.
[0054] During the training process, the epileptic EEG signals are preprocessed, and then the preprocessed EEG signal fragments are put into the fusion network to extract the time-space related features, and the loss function is used to further improve the accuracy of the experiment; and finally epilepsy detection is performed in the fully connected layer. This invention provides a new idea for computer-aided diagnosis of epilepsy detection.
[0055] Furthermore, during the training process, a focal loss function is used to balance the weights of positive and negative samples.
[0056] Furthermore, the fusion network includes a first GAT layer, a first Dropout layer, a regularization layer, a second GAT layer, a second Dropout layer, an activation function layer, a Transformer Encoder layer and a fully connected layer which are connected in sequence.
[0057] In this embodiment, the first GAT layer and the second GAT layer are used to aggregate channel spatial relationships and extract key information; the first Dropout layer and the second Dropout layer are used to randomly discard some neurons to prevent model overfitting; the regularization layer is used to stabilize network training; the activation function layer is used to help the network learn complex patterns in data; the Transformer Encoder layer is used to extract time information; and the fully connected layer is used to perform epilepsy binary classification detection at the end of the model.
[0058] Furthermore, the multi-channel EEG signals are input into the trained fusion network for binary classification detection, and the detection results of epileptic seizure period or epileptic inter-seizure period are output.
[0059] like Figure 2 As shown, it contains four boxes. The first box represents the process of acquiring multi-channel EEG signals, performing noise reduction and filtering on the multi-channel EEG signals, and dividing the EEG signals of each channel after noise reduction into several time windows according to the set time length;
[0060] The second box has a correlation matrix on the left and a graph structure on the right. The correlation matrix and graph structure form the feature matrix.
[0061] The third box is the graph attention network, which inputs the feature matrix obtained in the second box into the graph attention network to extract spatial features and output the EEG signal with aggregated spatial features to the fourth box;
[0062] The fourth box is the transformer network and the binary classification process. The output of the graph attention network is processed and input into the transformer network, and then input into the softmax fully connected layer for binary classification, and finally outputs the classification result.
[0063] like Figure 3 As shown in Figure 1, it is a schematic diagram of how the graph attention network processes EEG signals. Figure 3 The first box on the left is the feature matrix containing the correlation matrix and graph structure. The feature matrix is input into the graph attention network for processing, and finally the EEG signal with aggregated spatial features is output.
[0064] Among them, the graph structure contains channel information, signal information and correlation information. The specific process of constructing the graph structure is:
[0065] The EEG channels are modeled as nodes of the graph, and the features on the nodes are the features of the EEG signals on the channels. The Pearson correlation between channels is calculated to obtain the correlation matrix, and a threshold is set. If the correlation between channels is less than the threshold, the corresponding value in the correlation matrix is set to 0, and if it is greater than the threshold, the correlation value is retained. Finally, the edges of the graph are connected according to the correlation values in the matrix that are not 0, so that the graph structure is obtained.
[0066] The working principle of converged network includes:
[0067] The graph attention network obtains the weights between channels through a feedforward neural network based on the relationship between channels, thereby aggregating the information of other channels and updating itself, fully considering the mutual influence between different channels in space and time; using a two-layer graph attention layer, the feature expression of the node passes through one graph attention layer and then another layer to learn more expressive features.
[0068] The output of the graph attention network is input into the transformer network for position encoding and linear mapping. The segmented 2D signal is sent to the encoder to extract spatial features. Finally, the output value is sent to the fully connected layer FC for epilepsy binary classification detection. The detection result is binary classification, that is, epileptic seizure period or epileptic seizure interval. The transformer network model breaks through the limitation that the RNN model cannot be calculated in parallel. Compared with CNN, the number of operations required for the transformer network model to calculate the association between two positions does not increase with distance. Self-attention can produce a more interpretable model, and the attention distribution can be checked from the model. Each attention head can learn to perform different tasks.
[0069] In this embodiment, a graph attention network is used to extract spatial features of the input epilepsy data. The specific operation rules of the graph attention network are:
[0070] e ij =a(Wk i ,Wk j ) (1)
[0071]
[0072]
[0073]
[0074] The above formulas (1)-(4) are the calculation formulas of the graph attention network.
[0075] Among them, W represents the trainable weight matrix, e represents the correlation coefficient between two nodes, k represents the feature vector of the node, a represents the linear mapping, α represents the attention coefficient, V represents the set of neighbor nodes, k′ represents the feature vector of the output node, σ represents the sigmoid activation function, q represents one of the heads in the multi-head attention mechanism, Q represents the set of heads in the multi-head attention mechanism, and i, j, r represent the subscripts of any nodes.
[0076] At the same time, a transformer network is used to extract temporal features from the input epilepsy data. The specific operation rules of the transformer network are:
[0077]
[0078] H l ′=MSA(LN(H l-1 ))+H l-1 ,l=1,2,...,L (6)
[0079] H l =MLP(LN(H l ′))+H l ′,l=1,2,...,L (7)
[0080] Formulas (5)-(7) are the calculation formulas for the transformer network. Where H represents the final input of the transformer, k′ class Represents the selected class token, E pos represents standard 1D position encoding, E represents position encoding, μ represents the size of the slice, and l represents the number of encoders. LN represents regularization, MSA represents multi-head attention mechanism, MLP represents multi-layer perceptron, and H l ′ represents the output of the multi-head attention mechanism of the l-th encoder, H l Represents the final output of the lth encoder.
[0081] The initial input of the fusion network is x, where x represents the feature matrix. After the graph attention network and the transformer network extract the spatiotemporal features, the softmax function is finally used to complete the epilepsy binary classification detection, which forms the model architecture in this embodiment.
[0082] In this embodiment, the data set used is shown in Table 1. First, the original EEG is obtained through hardware equipment and the 10-20 international EEG lead system environment, and then the original EEG data is read into a data format that can be recognized by the computer using MNE-python, and the attribute matrix x of the brain wave is read out, where each row represents the characteristic information of a channel and the column represents the number of channels. The data is then divided into training data and test data according to the ratio, and the characteristic vector of the signal segment is obtained.
[0083] Input x into the fusion network, first pass through the graph attention network to extract spatial features, then input the signal with aggregated spatial features into the transformer network to extract temporal features, and finally complete the classification by the softmax function.
[0084] Table 1: Boston Hospital Childhood Epilepsy Dataset
[0085] serial number gender age Frequency HZ Number of leads Total recording time (hours) Number of attacks Total duration of seizure (minutes: seconds) chb01 female 11 256 23 40.55 7 7:10 chb02 male 11 256 23 25.3 3 2:50 chb03 female 14 256 23 28 7 5:40 chb04 male 22 256 23 155.9 4 9:00 chb05 female 7 256 23 39 5 2:00 chb06 female 1.5 256 23 66.7 9 5:10 chb07 female 14.5 256 23 68.1 3 15:10 chb08 male 3.5 256 23 20 5 4:00 chb09 female 10 256 23 67.8 4 6:50 chb10 male 3 256 23 50 7 13:20 chb11 female 12 256 23 34.8 3 8:10 chb12 female 2 256 23 23 39 25:15 chb13 female 3 256 23 33 12 2:30 chb14 female 9 256 23 26 8 27:20 chb15 male 16 256 31 40 20 1:20 chb16 female 7 256 28 19 10 4:40 chb17 female 12 256 28 21 3 4:50 chb18 female 18 256 22 36 6 3:40 chb19 female 19 256 28 30 3 3:30 chb20 female 6 256 28 29 8 3:10 chb21 female 13 256 28 33 4 3:10 chb22 female 9 256 28 31 3 3:10 chb23 female 6 256 23 28 7 6:40 chb24 unknown unknown 256 23 Unknown 16 8:47
[0086] The international 10-20 system is now routinely used for scalp electrode EEG. The 10-20 system includes 19 recording electrodes and 2 reference electrodes. First, two lines are determined on the scalp surface. One is the front-to-back line from the nasion to the external occipital tuberosity, which is 100%, and the other is the left-right line between the two preauricular concavities, which is 100%. The intersection of the two lines on the top of the head is the position of the Cz electrode. FPz (frontal pole midline) is 10% back from the nasion. Every 20% back from FPz is the position of an electrode, which is Fz (frontal midline), Cz (central midline), Pz (top midline) and Oz (occipital midline). The distance between Oz and the external occipital tuberosity is 10%. The T3 (left middle temporal) electrode is 10% away from the left preauricular concavity on the line connecting the two preauricular concavities. After that, an electrode is placed every 20% to the right, which is C3 (left central), Cz, C4 (right central) and T4 (right middle temporal). The distance between T4 and the right preauricular concavity is 10%. The line from FPz through T3 to Oz is the left temporal line, 10% to the left from FPz is FP1 (left frontal pole), and an electrode is placed every 20% from FP1, which are F7 (left anterior temporal), T3 (left middle temporal), T5 (left posterior temporal) and O1 (left occipital), among which T3 is the intersection of this line and the line connecting the two preauricular concavities, and O1 is 10% away from Oz. The right temporal line corresponds to this, and from front to back, it is FP2 (right temporal pole), F8 (right anterior temporal), T4 (right middle temporal), T6 (right posterior temporal), and O2 (right occipital). A line was made from FP1 to O1 and from FP2 to O2, which were the left and right parasagittal lines. From FP1 and FP2, every 20% backward was an electrode site. The left side was F3 (left frontal), C3 (left central), P3 (left parietal) and O1 (left occipital), and the right side was F4 (right frontal), C4 (right central), P4 (right parietal) and O2 (right occipital). In the 10-20 system, FPz and Oz were not included in the 19 recording sites.
[0087] like Figure 4 As shown, an example graph of an electroencephalogram during an epileptic seizure measured by an epilepsy detection device is shown.
[0088] In this embodiment, an epilepsy detection experiment was performed on the CHB-MIT data set (International 10-20 system). The data set was collected by Boston Children's Hospital, and consists of 5 males (3-22 years old) and 17 females (1.5-19 years old). The EEG signal is sampled at 256Hz, and the total duration of each EEG recording is about one hour. The data set collected a total of 958 hours of signals, of which 198 hours were epileptic seizure time. When selecting channels for the EEG: 16 dual-electrode channels are selected. The 16 channels here are the common parts selected from different electrodes in different locations when the EEG data is acquired, which is conducive to the unified operation of the program.
[0089] In this embodiment, the performance of the proposed model is evaluated using EEG records obtained from each subject in the CHB-MIT dataset, and the EEG records are collected using the international 10-20 EEG electrode system. The denoised long-term 16-channel EEG signal is divided into 256 points per frame, where the size of the input data is N*256*16, where N represents a total of N frames of data samples; 256 represents the single-channel data size of each frame is 256 points; 16 represents a total of 16 channels.
[0090] A sliding window of 1 second was selected to analyze the EEG recordings of 16 channels. These settings were obtained through experience and trials to ensure good power for achieving results. During the training process, the samples were randomly divided into 8:2 based on the sample library, of which 80% were training samples and the remaining 20% were test samples. The sample values were the feature vectors of the resulting signal fragments.
[0091] Through the method described in this embodiment, the results of epileptic EEG signal detection and recognition are obtained. The results obtained in this embodiment are compared with the detection results of the traditional method, as shown in Table 2.
[0092] Table 2
[0093]
[0094] It can be seen from Table 2 that the detection and recognition accuracy, sensitivity and specificity of epileptic EEG signals described in this embodiment are comparable to other advanced methods.
[0095] Embodiment 2
[0096] This embodiment discloses an epileptic EEG signal monitoring system based on a spatiotemporal attention mechanism.
[0097] like Figure 5 As shown, the epilepsy EEG signal monitoring system based on the spatiotemporal attention mechanism includes:
[0098] The signal acquisition and preprocessing module is configured to: acquire multi-channel EEG signals and preprocess the multi-channel EEG signals;
[0099] The fusion network building module is configured to: build a graph attention network and a transformer network, use the output of the graph attention network as the input of the transformer network, and build a fusion network;
[0100] The fusion network training module is configured to: construct a training set based on the preprocessed multi-channel EEG signal, and train the fusion network using the training set to obtain a trained fusion network;
[0101] The classification result acquisition module is configured as follows: inputting the multi-channel EEG signal into the trained fusion network, first extracting the spatial features through the graph attention network, then inputting the EEG signal with aggregated spatial features into the transformer network to extract the temporal features, and obtaining the classification result.
[0102] Embodiment 3
[0103] The purpose of this embodiment is to provide a computer-readable storage medium.
[0104] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the epilepsy EEG signal monitoring method based on the spatiotemporal attention mechanism as described in Example 1 of the present disclosure.
[0105] Embodiment 4
[0106] The purpose of this embodiment is to provide an electronic device.
[0107] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps in the method for monitoring epilepsy EEG signals based on the spatiotemporal attention mechanism as described in Example 1 of the present disclosure are implemented.
[0108] The steps involved in the apparatuses of the above embodiments 2, 3 and 4 correspond to the method embodiment 1, and the specific implementation methods can refer to the relevant description part of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.
[0109] Those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computer device, or alternatively, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.
[0110] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A method for monitoring epileptic EEG signals based on spatiotemporal attention mechanism, characterized in that: The following steps are involved: Acquire multi-channel EEG signals and pre-process the multi-channel EEG signals; Construct a graph attention network and a transformer network, use the output of the graph attention network as the input of the transformer network, and construct a fusion network; Based on the preprocessed multi-channel EEG signals, a training set is constructed, and the fusion network is trained using the training set to obtain a trained fusion network; The multi-channel EEG signals are input into the trained fusion network, and the spatial features are first extracted through the graph attention network. Then the EEG signals with aggregated spatial features are input into the transformer network to extract the temporal features and obtain the classification results.
2. The epilepsy EEG signal monitoring method based on spatiotemporal attention mechanism according to claim 1, characterized in that: The multi-channel EEG signal is preprocessed, specifically including: performing noise reduction and filtering on the multi-channel EEG signal, and dividing the EEG signal of each channel after noise reduction into several time windows according to a set time length to obtain the preprocessed multi-channel EEG signal.
3. The epilepsy EEG signal monitoring method based on spatiotemporal attention mechanism according to claim 1, characterized in that: Based on the preprocessed multi-channel EEG signals, a training set is constructed, including: The pre-processed multi-channel EEG signals are labeled with epileptic seizure intervals and epileptic seizure periods; The preprocessed multi-channel EEG signals, epileptic seizure interval annotations and epileptic seizure period annotations constitute the training set.
4. The epilepsy EEG signal monitoring method based on spatiotemporal attention mechanism according to claim 1, characterized in that: Use the training set to train the fusion network, including: The preprocessed multi-channel EEG signals are calculated using Pearson correlation to obtain a correlation matrix, and a graph structure is constructed at the same time, and the correlation matrix and the graph structure are combined to form a feature matrix of the EEG signals; The feature matrix, epileptic seizure interval annotations and epileptic seizure period annotations are input into the graph attention network, and the fusion network is trained using the feature matrix; When the loss function of the fusion network reaches the minimum value, or the number of iterations meets the set requirements, the training is stopped to obtain the trained fusion network.
5. The epilepsy EEG signal monitoring method based on spatiotemporal attention mechanism according to claim 4, characterized in that: During training, a focal loss function is used to balance the weights of positive and negative samples.
6. The epilepsy EEG signal monitoring method based on spatiotemporal attention mechanism according to claim 1, characterized in that: The fusion network includes a first GAT layer, a first Dropout layer, a regularization layer, a second GAT layer, a second Dropout layer, an activation function layer, a Transformer Encoder layer and a fully connected layer which are connected in sequence.
7. The epilepsy EEG signal monitoring method based on spatiotemporal attention mechanism according to claim 1, characterized in that: The multi-channel EEG signals are input into the trained fusion network for binary classification detection, and the detection results of epileptic seizure period or epileptic inter-seizure period are output.
8. Epilepsy EEG signal monitoring system based on spatiotemporal attention mechanism, characterized by: include: The signal acquisition and preprocessing module is configured to: acquire multi-channel EEG signals and preprocess the multi-channel EEG signals; The fusion network building module is configured to: build a graph attention network and a transformer network, use the output of the graph attention network as the input of the transformer network, and build a fusion network; The fusion network training module is configured to: construct a training set based on the preprocessed multi-channel EEG signal, and train the fusion network using the training set to obtain a trained fusion network; The classification result acquisition module is configured as follows: inputting the multi-channel EEG signal into the trained fusion network, first extracting the spatial features through the graph attention network, then inputting the EEG signal with aggregated spatial features into the transformer network to extract the temporal features, and obtaining the classification result.
9. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps in the epilepsy EEG signal monitoring method based on the spatiotemporal attention mechanism as described in any one of claims 1 to 7 are implemented.
10. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the epilepsy EEG signal monitoring method based on the spatiotemporal attention mechanism as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Modeling method, fatigue detection method and computer readable storage medium
CN114680903A
Signal classification method and device based on fMRI high-dimensional time sequence
CN114748053A