CN117257242B - Epilepsy classification method and system - Google Patents

Epilepsy classification method and system Download PDF

Info

Publication number
CN117257242B
CN117257242B CN202311557824.4A CN202311557824A CN117257242B CN 117257242 B CN117257242 B CN 117257242B CN 202311557824 A CN202311557824 A CN 202311557824A CN 117257242 B CN117257242 B CN 117257242B
Authority
CN
China
Prior art keywords
epileptic
attention
self
classification
layer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311557824.4A
Other languages
Chinese (zh)
Other versions
CN117257242A (en
Inventor
周晓华
刘晓欣
李昊轩
季涛云
林通
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Original Assignee
Peking University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University filed Critical Peking University
Priority to CN202311557824.4A priority Critical patent/CN117257242B/en
Publication of CN117257242A publication Critical patent/CN117257242A/en
Application granted granted Critical
Publication of CN117257242B publication Critical patent/CN117257242B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/72Signal processing specially adapted for physiological signals or for diagnostic purposes
    • A61B5/7235Details of waveform analysis
    • A61B5/7264Classification of physiological signals or data, e.g. using neural networks, statistical classifiers, expert systems or fuzzy systems
    • A61B5/7267Classification of physiological signals or data, e.g. using neural networks, statistical classifiers, expert systems or fuzzy systems involving training the classification device
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/24Detecting, measuring or recording bioelectric or biomagnetic signals of the body or parts thereof
    • A61B5/316Modalities, i.e. specific diagnostic methods
    • A61B5/369Electroencephalography [EEG]
    • A61B5/372Analysis of electroencephalograms

Landscapes

  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Physics & Mathematics (AREA)
  • Biophysics (AREA)
  • Surgery (AREA)
  • Veterinary Medicine (AREA)
  • Public Health (AREA)
  • Psychiatry (AREA)
  • General Health & Medical Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Molecular Biology (AREA)
  • Pathology (AREA)
  • Biomedical Technology (AREA)
  • Heart & Thoracic Surgery (AREA)
  • Medical Informatics (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Physics (AREA)
  • Fuzzy Systems (AREA)
  • Signal Processing (AREA)
  • Physiology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Psychology (AREA)
  • Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)

Abstract

The invention relates to an epilepsy classification method and system, belongs to the technical field of epilepsy classification, and solves the problem of low accuracy of individual difference classification neglected in the prior art. The method comprises the following steps: acquiring multichannel brain electrical signals and corresponding epileptic types of each patient in each epileptic seizure as a sample set; constructing an epileptic classification network model, and training the epileptic classification network based on a sample set to obtain a trained epileptic classification network model; the epileptic classification network model includes: a self-attention layer for constructing a corresponding graph structure according to the training samples; a graph neural network module for extracting corresponding depth features based on the training samples and the corresponding graph structures; a readout layer for performing epileptic classification prediction based on the depth features; and inputting the multichannel electroencephalogram signals to be identified into the epileptic classification network model to obtain the corresponding epileptic type. A more accurate classification of epilepsy is achieved.

Description

Epilepsy classification method and system
Technical Field
The invention relates to the technical field of epilepsy classification, in particular to a method and a system for classifying epilepsy.
Background
Seizures can be classified into various types according to guidelines issued by the international antiepileptic consortium (ILAE) 2017. The basic principle of epileptic treatment is to select an appropriate anti-epileptic drug according to the seizure type and classification of epileptic syndromes. For example, ethosuximide (ESM) and sodium Valproate (VPA) are mainly used to prevent absence attacks and clonic attacks, but not tonic clonic and partial attacks. More seriously, if a drug such as carbamazepine or oxcarbazepine is selected incorrectly because the seizure type cannot be judged correctly, the seizure is not relieved but the patient's condition is aggravated. Thus, the correct differentiation of seizure type is the most important step in diagnosis and treatment of epilepsy.
Seizure classification can be regarded as a multi-classification problem, and researchers have done a lot of work in the seizure classification field since the largest seizure classification public data set in the world, TUH EEG seizure corpus (TUSZ), was published. Machine learning methods such as K-NN, extreme gradient lifting (XGBoost), light gradient enhancement (LightGBM), support Vector Machine (SVM), random Forest (Random Forest) and the like have all been applied to TUSZ datasets. In addition to machine learning methods, deep learning methods such as Convolutional Neural Networks (CNNs) and long-term memory networks (LSTM) are also widely used in the study of seizure classification.
Although current studies have achieved higher accuracy and F1 scores, these studies have all been conducted around seizure events, ignoring the effect of individual differences on data, i.e., seizures in training and test data may be from the same patient. If individual differences are considered, the problem becomes more complex and the current study is less effective with the development of epileptic classification studies around cross-patient data, i.e. training data and test data from different patients.
Disclosure of Invention
In view of the above analysis, the embodiments of the present invention aim to provide a method and a system for classifying epilepsy, which are used for solving the problem that the accuracy of classifying individual differences is low in the prior art.
In one aspect, an embodiment of the present invention provides a method for classifying epilepsy, including the steps of:
acquiring multichannel brain electrical signals and corresponding epileptic types of each patient in each epileptic seizure as a sample set;
constructing an epileptic classification network model, and training the epileptic classification network based on a sample set to obtain a trained epileptic classification network model; the epileptic classification network model includes: a self-attention layer for constructing a corresponding graph structure according to the training samples; a graph neural network module for extracting corresponding depth features based on the training samples and the corresponding graph structures; a readout layer for performing epileptic classification prediction based on the depth features;
and inputting the multichannel electroencephalogram signals to be identified into the epileptic classification network model to obtain the corresponding epileptic type.
Based on a further improvement of the above method, the self-attention layer constructs a corresponding graph structure according to the training sample, including:
extracting attention characteristics in the time dimension of the multichannel electroencephalogram signals based on an attention mechanism;
calculating a self-attention value in a spatial dimension based on the attention features in the temporal dimension;
the graph structure is constructed from the self-attention values in the spatial dimension.
Based on a further improvement of the method, extracting the attention characteristic in the time dimension of the multichannel electroencephalogram signal based on an attention mechanism comprises:
extracting hidden characteristics h from the electroencephalogram signals of each channel through a gating circulation unit i
Based on the hidden feature according to the formulaCalculating the corresponding attention value of each channel +.>
According to the formulaCalculating the attention characteristic of each channel in the time dimension +.>
Where r, W and b are model parameters,represents the attention value, h, corresponding to the ith channel i Representation ofHidden features of the ith channel.
Based on a further improvement of the above method, the self-attention value a' in the spatial dimension is calculated based on the attention feature in the time dimension using the following formula:
wherein Q and K represent query and key, W, respectively Q And W is K And d represents the hidden dimension of Q and K, and X' is the attention characteristic of the multichannel electroencephalogram signal in the corresponding time dimension.
Based on a further improvement of the above method, constructing the graph structure from the self-attention values in the spatial dimension comprises:
the adjacency matrix is derived from the self-attention value in the spatial dimension using the following formula:
wherein,elements representing the ith row and jth column of the self-attention value matrix in the spatial dimension,/->Representing the largest k elements, A, of the ith row of elements of the self-attention value matrix in the spatial dimension ij Representing the elements of the j-th column of the i-th row in the adjacency matrix.
Based on the further improvement of the method, the graphic neural network module comprises a multi-layer diffusion convolution gating circulation unit; the structure of each layer of diffusion convolution gating circulation units is the same; the nodes of each layer of diffusion convolution gating circulating units are in one-to-one correspondence with the nodes of the graph structure; the input of each node in the first layer diffusion convolution gating circulation unit is an electroencephalogram signal of a corresponding channel in a sample; the output of each node in the diffusion convolution gating circulation unit of the previous layer is used as the input of the corresponding node of the next layer; and the output of the nodes in the last layer of diffusion convolution gating circulating unit is the depth characteristic output by the graph neural network model. Based on a further improvement of the method, each layer of diffusion convolution gating circulation unit calculates the output characteristics of the nodes through the following formula:
wherein X is (t) The input of the diffusion convolution gating circulation unit at the time t is represented by H (t) Representing the output of a diffusion convolution gating cycle unit at the time t, r (t) ,u (t) And C (t) Respectively representing a reset gate, an update gate and a candidate at a point in time t, +.g represents a diffusion convolution, Θ r ,Θ u And theta (theta) C Representing the weight of the gated loop unit, b r ,b u And b C Indicates the bias of the gated loop cells, +.indicates the Hadamard product, (-) indicates the Sigmoid function.
Based on a further improvement of the above method, the readout layer predicts the epileptic type in the following way:
compressing the features on each channel by adopting an attention mechanism to obtain compressed features on each channel;
carrying out nonlinear transformation on the compression characteristics of all channels to obtain global characteristics; and predicting by adopting combination pooling based on global features to obtain the predicted epileptic type.
Based on a further improvement of the method, the method for predicting the predicted epileptic type by adopting combination pooling based on global features comprises the following steps:
projecting the global features through the full connection layer to obtain class features;
predicting based on class characteristics of each channel by adopting the following formula to obtain a predicted epileptic type:
wherein,representing class characteristics of the ith channel, N representing the number of brain electrical channels, +.>Representing the predicted epileptic type.
In another aspect, an embodiment of the present invention provides an epileptic classification system, including the following modules:
the sample set construction module is used for acquiring multichannel brain electrical signals and corresponding epileptic types of each patient when epileptic seizures are generated as a sample set;
the model construction module is used for constructing an epileptic classification network model, and training the epileptic classification network based on a sample set to obtain a trained epileptic classification network model; the epileptic classification network model includes: a self-attention layer for constructing a corresponding graph structure according to the training samples; a graph neural network module for extracting corresponding depth features based on the training samples and the corresponding graph structures; a readout layer for performing epileptic classification prediction based on the depth features;
and the epileptic type prediction module is used for inputting the multichannel electroencephalogram signals to be identified into the epileptic classification network model to obtain the corresponding epileptic types.
Based on the time and space characteristics of the multi-element time sequence, the invention automatically captures the time and space correlation between the multi-channel electroencephalogram signals through the self-attention layer, thereby constructing a graph structure which is completely driven by data, and the structure is trained along with a neural network, and the influence of individual differences of original data on the graph structure is effectively reduced by the category labels under supervision and learning; the reading layer extracts channel compression characteristics through time attention, obtains a classification result of the whole graph by combining and pooling all channel characteristics, respectively considers time and space characteristics through time attention and combined pooling, can more effectively extract the whole graph characteristics, and realizes more accurate classification of unobserved electroencephalogram signals, thereby improving the accuracy of epileptic diagnosis, providing more comprehensive and accurate information for clinicians, and saving time and energy of doctors.
In the invention, the technical schemes can be mutually combined to realize more preferable combination schemes. Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
The drawings are only for purposes of illustrating particular embodiments and are not to be construed as limiting the invention, like reference numerals being used to designate like parts throughout the drawings;
FIG. 1 is a flow chart of an epilepsy classification method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram showing the effect of classifying epilepsy according to different models in the embodiment of the present invention;
FIG. 3 is a schematic view of recall rates of two models in an embodiment of the present invention;
FIG. 4 is a schematic diagram of accuracy of two models according to an embodiment of the present invention;
fig. 5 is a block diagram of an epilepsy classification system according to an embodiment of the invention.
Detailed Description
Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form a part hereof, and together with the description serve to explain the principles of the invention, and are not intended to limit the scope of the invention.
Electroencephalogram data is multivariate time series data, having both temporal and spatial characteristics. The existing CNN-based methods, such as SeizureNet and TIE-EEGNet, convert time domain data into frequency domain data through different methods such as Fourier transform (FFT) and wavelet transform, fully consider the time characteristics of the data, but neglect the space characteristics of the data. CNN can be excellent in image data because the spatial characteristics of the image data are obvious, while the spatial characteristics of the brain electrical data are implicit, the arrangement of brain regions is not in a fixed order, the connection signal intensity between brain regions cannot be directly measured, and varies with different individuals and different attack forms. The CNN-based method cannot efficiently extract features that can represent data spatial characteristics. LSTM-based methods, such as Bi-LSTM used in the MP-SeizNet model, can extract timing features directly from the data, but cannot extract spatial features. The method based on the graph neural network utilizes an RNN structure to extract time sequence characteristics and utilizes the graph structure to extract space characteristics, but the electroencephalogram data has no visual graph structure, and the prior method generally uses a distance measurement (Dist-DCRNN) or correlation calculation (Corr-DCRNN) based method to construct the graph structure in advance. This method therefore has the following two disadvantages: firstly, the performance depends on whether the construction of the graph structure accords with a real brain network structure, secondly, the graph construction and model training are carried out separately, and the model is not end-to-end.
Based on this, in one embodiment of the present invention, a method for classifying epilepsy is disclosed, as shown in fig. 1, comprising the steps of:
s1, acquiring multichannel brain electrical signals and corresponding epileptic types of each patient in each epileptic seizure as a sample set;
s2, constructing an epileptic classification network model, and training the epileptic classification network based on a sample set to obtain a trained epileptic classification network model; the epileptic classification network model includes: a self-attention layer for constructing a corresponding graph structure according to the training samples; a graph neural network module for extracting corresponding depth features based on the training samples and the corresponding graph structures; a readout layer for performing epileptic classification prediction based on the depth features;
s3, inputting the multichannel electroencephalogram signals to be identified into the epileptic classification network model to obtain the corresponding epileptic type.
According to the method, a corresponding graph structure is constructed based on a self-attention mechanism according to multichannel brain electrical signals of each patient in each epileptic seizure, depth characteristics are extracted through a graph neural network model based on the constructed graph structure, and epileptic classification prediction is carried out, so that the corresponding graph structure is constructed for the brain electrical signals of each epileptic seizure of each patient in a data driving mode, the constructed graph structure is not influenced by inter-individual brain network differences and brain network differences of the same individual in different seizure periods, and the true brain network structure is more met, so that classification is more accurate. And the construction of the graph structure and the graph neural network can be trained simultaneously, so that the model can work in an end-to-end manner. Different types of epileptic seizures can be better distinguished, and the epileptic seizure type can be more accurately identified, so that the accuracy of epileptic diagnosis is improved, more comprehensive and accurate information is provided for a clinician, and the time and energy of the doctor are saved.
When the method is implemented, after the multichannel electroencephalogram signals are acquired, resampling to the same frequency can be performed first if the sampling rates of the electroencephalogram signal fragments are different. Since seizures are related to certain specific frequency bands of brain electrical activity, a Fast Fourier Transform (FFT) may be used to pre-process the data, converting the resampled EEG signal from the time domain to the frequency domain. An electroencephalogram signal of a patient at the time of an epileptic seizure is taken as a sample and expressed asWherein N represents the number of brain electrical channels, < >>The time length of the electroencephalogram signal is represented, for example, in seconds, and M represents the number of data points (features) per unit time.
When using a graph neural network based approach, a graph structure is always required. In general, in modeling a multivariate time series, the graph can be constructed by a priori knowledge or domain experts. However, there is no predefined graphical structure in electroencephalogram modeling, and there are many differences between brain networks of different individuals. In order to build a customized graph structure for each electroencephalogram segment in a data-driven manner, an attention mechanism is employed to automatically learn the correlation between different electroencephalogram channels.
Specifically, the self-attention layer constructs a corresponding graph structure according to the training sample, including:
extracting attention characteristics in the time dimension of the multichannel electroencephalogram signals based on an attention mechanism;
calculating a self-attention value in a spatial dimension based on the attention features in the temporal dimension;
the graph structure is constructed from the self-attention values in the spatial dimension.
The self-attention layer of the present invention consists of two main parts, namely attention in the temporal dimension and attention in the spatial dimension.
Specifically, the method for extracting the attention characteristics of the multichannel electroencephalogram in the time dimension based on the attention mechanism comprises the following steps:
extracting hidden characteristics h from the electroencephalogram signals of each channel through a gating circulation unit i
Based on the hidden feature according to the formulaCalculating the corresponding attention value of each channel +.>
According to the formulaCalculating the attention characteristic of each channel in the time dimension +.>
Wherein,represents the attention value, h, corresponding to the ith channel i Representing hidden features of the ith channel, r, W and b are model parameters that can be learned by the self-attention layer. ReLu (·) is a nonlinear activation function and the Softmax (·) function is used to normalize the attention value.
In practice, for each training sampleElectroencephalogram signals of each channel are +.>Is input into a gate-controlled loop unit (GRU) to calculate a hidden feature +/corresponding to each unit time>,H out Representing feature points per unit time in the hidden feature. Calculating the corresponding attention value of each channel according to the hidden characteristic>,/>By the formula->Based on the attention value->Weighting is allocated to the characteristic of each unit time in the ith channel, and the weighted attention characteristic of the ith channel in the time dimension is +.>
After the attention characteristic of each channel in the time dimension is obtained, the attention characteristics of all channels in the time dimension are combined to obtain the attention characteristics of the multichannel electroencephalogram signals in the time dimensionA self-attention value a' in the spatial dimension is then calculated based on the attention features in the temporal dimension.
Specifically, the self-attention value a' in the spatial dimension is calculated based on the attention feature in the temporal dimension using the following formula:
wherein Q and K represent query and key, W, respectively Q And W is K And d represents the hidden dimension of Q and K, and X' is the attention characteristic of the multichannel electroencephalogram signal in the corresponding time dimension. Wherein,calculated->
And constructing a corresponding graph structure according to the self-attention value A' in the space dimension. One sample (EEG fragment) is represented as a graph g= { V, E, a }, where V represents the set of nodes (i.e. EEG electrodes/channels), E represents the set of edges, and a represents the adjacency matrix. The self-attention value a' in the spatial dimension calculated by the self-attention mechanism can be used as a graphIs a contiguous matrix of (a) a plurality of (b) a plurality of (c). Since A' is an asymmetric matrix, the diagram +.>Is a directed graph. To introduce sparsity, only the k edges with the largest value and the self-loop edge connected to itself are reserved among the edges connected to each node.
Specifically, the adjacency matrix is obtained according to the self-attention value in the space dimension by adopting the following formula:
wherein,elements representing the ith row and jth column of the self-attention value matrix in the spatial dimension,/->Representing the largest k elements, A, of the ith row of elements of the self-attention value matrix in the spatial dimension ij Representing the elements of the j-th column of the i-th row in the adjacency matrix. />I.e., the first k neighbor nodes of the ith node.
And obtaining an adjacent matrix A, and obtaining a graph structure corresponding to the sample. In contrast to existing studies using distance-based (Dist-DCRNN) or correlation-based (Corr-DCRNN) methods to construct graphs, the attention-based graph construction method proposed by the present invention is data-driven and is capable of handling spatial heterogeneity of data. Thus, it does not require a priori knowledge and tends to build different graph structures for different seizure types. The latter is important because different types of seizures originate from different brain regions. For example, focal seizures occur in a region on one side of the brain, while systemic seizures occur almost simultaneously in the entire region of the brain. Second, the attention mechanism based approach improves the processing power of the model for data temporal heterogeneity by the attention in the time dimension. This is very helpful for epileptic classification, as epileptic seizures are the dynamic process of electrical activity in the brain, and EEG signals vary greatly at different time stamps. Finally, all parameters in the proposed attention-based patterning approach are learnable, which enables simultaneous training of the graph construction and classifier (graph neural network module and readout layer). Thus, the self-attention layer enables our model to work in an end-to-end fashion. The invention separately considers the time and the space attention, the attention in the time dimension gathers information along the time dimension, and the attention in the space dimension extracts the correlation between the graph nodes (brain channels), thereby constructing a graph structure closer to the real brain network by utilizing the time and the space characteristics, having stronger interpretability and being more beneficial to the clinical application in the future.
After the graph structure corresponding to each sample is obtained, depth feature extraction can be performed through the graph neural network module. The graph neural network module comprises a plurality of layers of diffusion convolution gating circulating units (DCGRU), wherein the structures of the diffusion convolution gating circulating units in each layer are the same, the nodes of the diffusion convolution gating circulating units in each layer are in one-to-one correspondence with the nodes of the graph structure, the input of each node in the first layer of diffusion convolution gating circulating units is an electroencephalogram signal of a corresponding channel in a sample, and the output of each node in the former layer of diffusion convolution gating circulating units is used as the input of a corresponding node in the later layer; and the output of the nodes in the last layer of diffusion convolution gating circulating unit is the depth characteristic output by the graph neural network model.
Specifically, each layer of diffusion convolution gating circulation unit calculates node characteristics through the following formula:
wherein X is (t) The input of the diffusion convolution gating circulation unit at the time t is represented by H (t) Representing the output of the diffusion convolution gated loop unit at time t,respectively representing a reset gate, an update gate and a candidate at a point in time t, +.g represents a diffusion convolution, Θ r ,Θ u And theta (theta) C Representing the weight of the gated loop unit, b r ,b u And b C Representing the bias of the gated loop cell.,/>,M hid Representing each node outputThe dimension of the out feature, namely the number of feature points per unit time output by each node. As indicated by the symbol H, hadamard product. Sigma (·) represents the Sigmoid function.
Diffusion convolution can be calculated by the following formula:
the method comprises the steps of carrying out a first treatment on the surface of the Wherein f θ Representing a parameter having the parameter θ, i.e., θ j,1 And theta j,2 J represents the number of steps of diffusion, M' =m+m hid A is an adjacent matrix corresponding to the sample, D O An outbound diagonal matrix representing the structure of the sample map, D I An entry diagonal matrix representing the structure of the sample map.
For example for formulasFirst pass ∈G diffusion convolution filter pair
Performing roll filtering by the above formula (3) of diffusion convolution>Is>Performing diffusion convolution calculation, and performing diffusion convolution result and weight theta r Multiplying and then adding bias b r After addition, nonlinear transformation is performed by Sigmoid activation function σ (), and the output is limited to the range of (0, 1).
Note that H in each layer of diffusion convolution gated loop units DCGRU (t) Initialized to a matrix of all zero elements. By superposing the multi-layer diffusion convolution gating circulation units, the characteristics of more order neighbor nodes are aggregated, more complex characteristic representations are created, more complex data characteristics are described, and the epilepsy classification is more accurate according to the characteristics.
The graph neural network module is arranged in the following waythe output characteristic at the moment t is H (t) Then the depth feature corresponding to one sample is H,it is input to the readout layer for epileptic type prediction. Specifically, the readout layer predicts the epileptic type in the following way:
compressing the features on each channel by adopting a self-attention mechanism to obtain compressed features F on each channel i
And carrying out nonlinear transformation on the compression characteristics of all channels to obtain global characteristics, and predicting by adopting combination pooling based on the global characteristics to obtain the predicted epileptic type.
Specifically, the compression characteristic F is obtained using the following formula i
Wherein,, />and->Are all learnable model parameters, +.>Is the attention value, H i Representing depth features corresponding to the ith channel, H r Representing the dimension of the hidden feature of attention. And compressing the characteristics on each channel in the time dimension by adopting an attention mechanism to obtain the compressed characteristics on each channel.
The compressed features of each channel are combined together to obtain compressed features F of all channels,
after the compression characteristics of all channels are obtained, the following formulas are adopted to carry out nonlinear transformation on the compression characteristics of all channels so as to obtain global characteristics:
wherein f And f Is a multi-layer perceptron, σ (), sigmoid, hadamard product, and F, the compression characteristics of all channels. The former transformationThe function of which is equivalent to a soft attention weight layer, the latter transformationIs a nonlinear feature transformation, which makes the extracted global feature more efficient by combining the attention weights to perform a nonlinear change, ++>,M r Representing the dimension of the global feature.
After global features are obtained, the combination pooling is adopted to predict based on the global features, and the predicted epileptic type is obtained, which specifically comprises the following steps:
the global feature is projected through the full connection layer to obtain a class feature g',
class features on a per channel basisPredicting by adopting combination pooling to obtain a predicted epileptic type:
wherein f Is a multi-layer perceptron (MLP), σ (i.e.) denotes the Sigmoid function, as well as the Hadamard product,representing class characteristics of the ith channel. Projection of g to +.>Wherein C represents the number of epileptic categories. Finally, use is made of +.>And average pooling->Component pooling layer to obtain final prediction result +.>
The proposed readout layer is more suitable for multivariate time series than existing pooling methods. Output data at DCGRUHas three dimensions, namely the number of nodes/channels N, EEG sequence length in seconds +.>And feature quantity M per second hid . The use of one or two simple pooling methods with fully connected layers may result in a loss of representational capacity of the resulting compressed features. The readout layer proposed by the present invention compresses the characteristic representation of the map step by step in three steps. First, we use the attention in the time dimension to extract compression features that vary over time. Node feature M is then compressed using attention weights and nonlinear transforms and full connection layers hid Is a dimension of (c). Finally, global and local node features are extracted using mean pooling and maximum pooling, respectively. The reason for this is that in epileptic seizures, the whole network of the brain and critical brain areas play an important role at the same time, thus the whole of the nodeLocal features and local features are also important for the final prediction result.
Based on predicted epileptic typeAnd the actual epileptic type adopts multi-class cross entropy as a loss function, and adopts a gradient descent method to update parameters of the model, namely, update parameters in a self-attention layer, a graph neural network module and a readout layer, train the epileptic classification network model based on a sample set until the model converges, and obtain a trained epileptic classification network model. By training the building graph structure together with the classification prediction, the self-adaptive learning builds the graph structure, so that an end-to-end model is obtained, and when the model is tested, the classification accuracy of the model is not reduced even if the test data and the training data come from different patients.
Based on the time and space characteristics of the multi-element time sequence, the invention automatically captures the time and space correlation between the multi-channel electroencephalogram signals through the self-attention layer, thereby constructing a graph structure which is completely driven by data, and the structure is trained along with a neural network, and the influence of individual differences of original data on the graph structure is effectively reduced by the category labels under supervision and learning; the reading layer extracts channel compression characteristics through time attention, obtains a classification result of the whole graph by combining and pooling all channel characteristics, respectively considers time and space characteristics through time attention and combined pooling, can more effectively extract the whole graph characteristics, and realizes more accurate classification of unobserved electroencephalogram signals, thereby improving the accuracy of epileptic diagnosis, providing more comprehensive and accurate information for clinicians, and saving time and energy of doctors.
To illustrate the effect of the epileptic classification method of the present invention, a seizure type classification test was performed using TUSZ, and the dataset consisted of 3050 seizure events for 632 patients. The dataset is labeled with 8 seizure types, each of which varies in number from 3 to 1836. We selected 19 EEG channels in the standard 10-20 system, namely FP1, FP2, F3, F4, C3, C4, P3, P4, O1, O2, F7, F8, T3, T4, T5, T6, FZ, CZ and PZ, as most scalp EEG data was sampled with these 19 electrodes. Table 1 summarizes the statistics of the TUSZ dataset.
TABLE 1 TUSZ dataset summary
As shown in table 1, the distribution of patient and seizure events among different seizure types is unbalanced. Since there are only three out of the myoclonus attacks, we cull them from the data and combine focal non-specific attacks, simple partial attacks and complex partial attacks into focal attacks, tonic attacks and tonic clonus attacks into tonic attacks, the four types of attacks that are ultimately used for classification are focal attacks (CF), global non-specific attacks (GN), absence Attacks (AB) and tonic attacks (CT). In the experiment we split the data into training, validation and test sets, with no overlapping crossing of patients between the data sets, the distribution of which is shown in table 2.
TABLE 2 distribution of datasets used in experiments
For the task of epileptic classification we use only the EEG signals from epileptic events, intercepting a 12 or 60 second piece of EEG signal from each seizure event. Because the EEG signals are sampled at different frequencies in the TUSZ dataset, it is first necessary to resample the truncated EEG signal segments to the same frequency of 200Hz. Since seizures are known to be related to certain specific frequency bands of brain electrical activity, we use a Fast Fourier Transform (FFT) to pre-process the data, converting the resampled EEG signal from the time domain to the frequency domain.
The epileptic classification network model (STAGNN) of the present invention uses multi-class cross entropy as a loss function in the training process. Training of all models was done on a single NVIDIA 3090 GPU using Adam optimizers in pyrerch. Randomly initializing model parametersAnd five run evaluations of the model were performed using different random seeds. Selecting the best performing hyper-parameters on the validation set from the following settings: (a) The number of layers of DCGRU in the range {2,3,4,5}, and (b) the number of hidden units in the range {32, 64, 128}, i.e., M hid . We set the initial learning rate of the model to 3e-4 and the exit rate to 0.5. In all experiments, model training was stopped in advance when the validation loss did not decrease for 30 consecutive iterations, otherwise training iterations were stopped 60 times. Table 3 shows a model classification performance comparison of different models on the TUSZ dataset, where the mean and standard deviation are 5 random experimental results.
TABLE 3 comparison of Classification Properties of different models on TUSZ dataset
Our model STAGNN was compared to seven neural network models, namely DENSECNN, LSTM, CNNLSTM, TIE-EEGNet, graph S4mer, dist-DCRNN and Corr-DCRNN, on TUSZ data. For models LSTM, DCRNN and STAGNN, we finally selected 5 LSTM/DCGRU layers and 64 hidden units to train the 12 second EEG segment and 5 LSTM/DCGRU layers and 32 hidden units to train the 60 second EEG segment. The composition method based on correlation and the composition method based on attention respectively reserve the first 3 neighbors of each node so as to ensure the sparsity of the graph. The four methods of CNN-LSTM, dense-CNN, TIE-EEGNet and GraphS4mer all adopt model structures in original text, wherein because TIE-EEGNet uses sine and cosine codes, we use the preprocessing method described in the paper, and the GraphS4mer uses the S4 model to extract time sequence characteristics, and FFT is not needed to be converted into a frequency domain, so that the preprocessing method described in the paper is also used, and the rest methods all use the preprocessing method in the invention. As can be seen from Table 3, STAGNN is the best performing model on 12 and 60 second EEG segments, and F1 scores of 0.775 and 0.755 are obtained respectively, so that the best F1 results of seven neural network models are improved by 11.8% and 12.2%, and recall rate and accuracy rate are improved by 7.5% -8.5%, respectively.
Fig. 2 shows confusion matrices for STAGNN and seven neural network models on 12 second seizure classification data. STAGNN achieved 95% accuracy on rare AB episodes, 2 points above the optimal baseline (DIST-DCRNN and graph 4 mer). In addition, STAGNN has a classification accuracy of 82% for CT episodes, 21 points above the optimal baseline (CORR-DCRNN) and 41 points above DIST-DCRNN.
Table 4 shows the performance of the model in the different mapping and pooling modes, where the EEG length was 12 seconds and the mean and standard deviation were 5 randomized experimental results. When the model uses only maximum pooling in the readout layer, the self-attention layer proposed by the present invention can achieve optimal model performance compared to the correlation and distance based patterning approach. When the model is fixed using the readout layer of the present invention, and the attention in the temporal and spatial dimensions in the self-attention layer is replaced by the average pooling and Pearson correlation coefficients, respectively, the model performance is significantly reduced, which indicates that both the attention in the self-attention layer of the present invention are critical to the model performance.
Table 4 influence of the self-attention module on the model
Table 5 shows the effect of the pooling method on the model effect, i.e. the effect of the readout layer on the model, under different patterns, where the EEG length was 12 seconds and the mean and standard deviation were 5 random experimental results. When a correlation or distance based patterning approach is used, the proposed readout layer performs better than maximum pooling. When the attention layer is used for patterning, the elements in the readout layer are replaced or removed respectively, and the model effect is obviously reduced.
TABLE 5 influence of readout layer on model
Furthermore, we also compared the recall and precision of STAGNN and correlation-based DCRNN models (CORR-DCRNN) at different values of k (in equation 1). Fig. 3 and 4 show recall and precision of two models in the k value range of 1-6. From fig. 3 and fig. 4, it can be seen that sparsity of the graph helps to improve classification performance of the graph model. Furthermore, the performance of STAGNN is superior to DCRNN at all different k values, indicating the superiority of the proposed model.
An embodiment of the present invention provides an epileptic classification system, as shown in fig. 5, including the following modules:
the sample set construction module is used for acquiring multichannel brain electrical signals and corresponding epileptic types of each patient when epileptic seizures are generated as a sample set;
the model construction module is used for constructing an epileptic classification network model, and training the epileptic classification network based on a sample set to obtain a trained epileptic classification network model; the epileptic classification network model includes: a self-attention layer for constructing a corresponding graph structure according to the training samples; a graph neural network module for extracting corresponding depth features based on the training samples and the corresponding graph structures; a readout layer for performing epileptic classification prediction based on the depth features;
and the epileptic type prediction module is used for inputting the multichannel electroencephalogram signals to be identified into the epileptic classification network model to obtain the corresponding epileptic types.
The method embodiment and the system embodiment are based on the same principle, and the related parts can be mutually referred to and can achieve the same technical effect. The specific implementation process refers to the foregoing embodiment, and will not be described herein.
Those skilled in the art will appreciate that all or part of the flow of the methods of the embodiments described above may be accomplished by way of a computer program to instruct associated hardware, where the program may be stored on a computer readable storage medium. Wherein the computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory, etc.
The present invention is not limited to the above-mentioned embodiments, and any changes or substitutions that can be easily understood by those skilled in the art within the technical scope of the present invention are intended to be included in the scope of the present invention.

Claims (7)

1. A method of classifying epilepsy, comprising the steps of:
acquiring multichannel brain electrical signals and corresponding epileptic types of each patient in each epileptic seizure as a sample set;
constructing an epileptic classification network model, and training the epileptic classification network based on a sample set to obtain a trained epileptic classification network model; the epileptic classification network model includes: a self-attention layer for constructing a corresponding graph structure according to the training samples; a graph neural network module for extracting corresponding depth features based on the training samples and the corresponding graph structures; a readout layer for performing epileptic classification prediction based on the depth features;
inputting the multichannel electroencephalogram signals to be identified into the epileptic classification network model to obtain corresponding epileptic types;
the self-attention layer constructs a corresponding graph structure according to the training sample, and the self-attention layer comprises the following components:
extracting attention characteristics in the time dimension of the multichannel electroencephalogram signals based on an attention mechanism;
calculating a self-attention value in a spatial dimension based on the attention features in the temporal dimension;
constructing the graph structure according to the self-attention value in the space dimension;
the self-attention value a' in the spatial dimension is calculated based on the attention feature in the temporal dimension using the following formula:
wherein Q and K represent query and key, W, respectively Q And W is K The method comprises the steps of representing a network parameter which can be learned, d representing the hidden dimension of Q and K, and X' representing the attention characteristic of a multichannel electroencephalogram signal in a corresponding time dimension;
constructing the graph structure from the self-attention values in the spatial dimension, comprising:
the adjacency matrix is derived from the self-attention value in the spatial dimension using the following formula:
wherein,elements representing the ith row and jth column of the self-attention value matrix in the spatial dimension,/->Representing the largest k elements, +_of the ith row element of the self-attention value matrix in the spatial dimension>Representing the elements of the j-th column of the i-th row in the adjacency matrix.
2. The method of classifying epilepsy according to claim 1, wherein extracting attention features in a time dimension of a multichannel electroencephalogram based on an attention mechanism comprises:
extracting hidden characteristics h from the electroencephalogram signals of each channel through a gating circulation unit i
Based on the hidden feature according to the formulaCalculating the corresponding attention value of each channel +.>
According to the formulaCalculating the attention characteristic of each channel in the time dimension +.>
Where r, W and b are model parameters,represents the attention value, h, corresponding to the ith channel i Representing the hidden characteristics of the i-th channel.
3. The method of claim 1, wherein the graph neural network module comprises a multi-layer diffusion convolution gated loop unit; the structure of each layer of diffusion convolution gating circulation units is the same; the nodes of each layer of diffusion convolution gating circulating units are in one-to-one correspondence with the nodes of the graph structure; the input of each node in the first layer diffusion convolution gating circulation unit is an electroencephalogram signal of a corresponding channel in a sample; the output of each node in the diffusion convolution gating circulation unit of the previous layer is used as the input of the corresponding node of the next layer; and the output of the nodes in the last layer of diffusion convolution gating circulating unit is the depth characteristic output by the graph neural network model.
4. A method of classifying epilepsy according to claim 3 wherein each layer of diffusion convolution gated loop unit calculates the output characteristics of the node by the formula:
wherein X is (t) The input of the diffusion convolution gating circulation unit at the time t is represented by H (t) Representing a diffusion convolution gating loopUnit atOutput of time, r (t) ,u (t) And C (t) Respectively expressed in the time point->Is a reset gate, an update gate and a candidate, +.g represents a diffusion convolution, # r ,Θ u And theta (theta) C Representing the weight of the gated loop unit, b r ,b u And b C Indicates the bias of the gated loop cells, +.indicates the Hadamard product, (-) indicates the Sigmoid function.
5. The epilepsy classification method according to claim 1, wherein the readout layer predicts the type of epilepsy by:
compressing the features on each channel by adopting an attention mechanism to obtain compressed features on each channel;
carrying out nonlinear transformation on the compression characteristics of all channels to obtain global characteristics; and predicting by adopting combination pooling based on global features to obtain the predicted epileptic type.
6. The method of classifying epilepsy according to claim 5, wherein predicting the predicted epileptic type using combinatorial pooling based on global features comprises:
projecting the global features through the full connection layer to obtain class features;
predicting based on class characteristics of each channel by adopting the following formula to obtain a predicted epileptic type:
wherein,represents class characteristics of the ith channel, N represents electroencephalogram communicationNumber of tracks->Representing the predicted epileptic type.
7. An epileptic classification system, comprising the following modules:
the sample set construction module is used for acquiring multichannel brain electrical signals and corresponding epileptic types of each patient when epileptic seizures are generated as a sample set;
the model construction module is used for constructing an epileptic classification network model, and training the epileptic classification network based on a sample set to obtain a trained epileptic classification network model; the epileptic classification network model includes: a self-attention layer for constructing a corresponding graph structure according to the training samples; a graph neural network module for extracting corresponding depth features based on the training samples and the corresponding graph structures; a readout layer for performing epileptic classification prediction based on the depth features;
the epileptic type prediction module is used for inputting the multichannel electroencephalogram signals to be identified into the epileptic classification network model to obtain the corresponding epileptic type;
the self-attention layer constructs a corresponding graph structure according to the training sample, and the self-attention layer comprises the following components:
extracting attention characteristics in the time dimension of the multichannel electroencephalogram signals based on an attention mechanism;
calculating a self-attention value in a spatial dimension based on the attention features in the temporal dimension;
constructing the graph structure according to the self-attention value in the space dimension;
the self-attention value a' in the spatial dimension is calculated based on the attention feature in the temporal dimension using the following formula:
wherein Q and K represent query and key, W, respectively Q And W is K The method comprises the steps of representing a network parameter which can be learned, d representing the hidden dimension of Q and K, and X' representing the attention characteristic of a multichannel electroencephalogram signal in a corresponding time dimension;
constructing the graph structure from the self-attention values in the spatial dimension, comprising:
the adjacency matrix is derived from the self-attention value in the spatial dimension using the following formula:
wherein,elements representing the ith row and jth column of the self-attention value matrix in the spatial dimension,/->Representing the largest k elements, +_of the ith row element of the self-attention value matrix in the spatial dimension>Representing the elements of the j-th column of the i-th row in the adjacency matrix.
CN202311557824.4A 2023-11-22 2023-11-22 Epilepsy classification method and system Active CN117257242B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311557824.4A CN117257242B (en) 2023-11-22 2023-11-22 Epilepsy classification method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311557824.4A CN117257242B (en) 2023-11-22 2023-11-22 Epilepsy classification method and system

Publications (2)

Publication Number Publication Date
CN117257242A CN117257242A (en) 2023-12-22
CN117257242B true CN117257242B (en) 2024-02-02

Family

ID=89218190

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311557824.4A Active CN117257242B (en) 2023-11-22 2023-11-22 Epilepsy classification method and system

Country Status (1)

Country Link
CN (1) CN117257242B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117860201B (en) * 2024-01-10 2024-08-09 湖北大学 Feature classification method and system based on deep learning analysis model

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021226778A1 (en) * 2020-05-11 2021-11-18 浙江大学 Epileptic electroencephalogram recognition system based on hierarchical graph convolutional neural network, terminal, and storage medium
CN113786204A (en) * 2021-09-03 2021-12-14 北京航空航天大学 Epilepsia intracranial electroencephalogram early warning method based on deep convolution attention network
CN114366124A (en) * 2022-01-25 2022-04-19 北京航空航天大学 Epilepsia electroencephalogram identification method based on semi-supervised deep convolution channel attention single classification network
CN115359909A (en) * 2022-10-19 2022-11-18 之江实验室 Epileptic seizure detection system based on attention mechanism
CN115590529A (en) * 2022-10-28 2023-01-13 山东师范大学(Cn) Epilepsia electroencephalogram signal monitoring method and system based on space-time attention mechanism

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11219405B2 (en) * 2018-05-01 2022-01-11 International Business Machines Corporation Epilepsy seizure detection and prediction using techniques such as deep learning methods

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021226778A1 (en) * 2020-05-11 2021-11-18 浙江大学 Epileptic electroencephalogram recognition system based on hierarchical graph convolutional neural network, terminal, and storage medium
CN113786204A (en) * 2021-09-03 2021-12-14 北京航空航天大学 Epilepsia intracranial electroencephalogram early warning method based on deep convolution attention network
CN114366124A (en) * 2022-01-25 2022-04-19 北京航空航天大学 Epilepsia electroencephalogram identification method based on semi-supervised deep convolution channel attention single classification network
CN115359909A (en) * 2022-10-19 2022-11-18 之江实验室 Epileptic seizure detection system based on attention mechanism
CN115590529A (en) * 2022-10-28 2023-01-13 山东师范大学(Cn) Epilepsia electroencephalogram signal monitoring method and system based on space-time attention mechanism

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
A Class-Imbalance Aware and Explainable Spatio-Temporal Graph Attention Network for Neonatal Seizure Detection;Khadijeh Raeisi等;International Journal of Neural Systems;第33卷(第9期);全文 *
Dynamical graph neural network with attentionmechanism for epilepsy detection using single channel EEG;Yang Li等;Medical & Biological Engineering & Computing;全文 *
基于图注意力深度神经网络的癫痫脑电尖波识别;崔昊天等;生物学杂志;第37卷(第1期);全文 *

Also Published As

Publication number Publication date
CN117257242A (en) 2023-12-22

Similar Documents

Publication Publication Date Title
CN110598793B (en) Brain function network feature classification method
CN117257242B (en) Epilepsy classification method and system
CN113693563B (en) Brain function network classification method based on hypergraph attention network
CN111128380A (en) Method and system for constructing chronic disease health management model for simulating doctor diagnosis and accurate intervention strategy
Chen et al. Convolutional neural network for classification of solar radio spectrum
Xu et al. A graph spatial-temporal model for predicting population density of key areas
Liu et al. Channel pruning guided by spatial and channel attention for DNNs in intelligent edge computing
CN115919330A (en) EEG Emotional State Classification Method Based on Multi-level SE Attention and Graph Convolution
CN113842151B (en) Cross-test EEG cognitive state detection method based on efficient multi-source capsule network
CN113052099A (en) SSVEP classification method based on convolutional neural network
CN115064207B (en) Protein subcellular localization space proteomics deep learning prediction method
CN116049655A (en) Epileptic multi-category classification method and system based on deep learning
CN116369945A (en) Electroencephalogram cognitive recognition method based on 4D pulse neural network
Sakthivel et al. Optimal Deep Learning‐Based Vocal Fold Disorder Detection and Classification Model on High‐Speed Video Endoscopy
CN115512164A (en) Substance analysis method based on combination of spectral analysis and video classification algorithm
CN115470863A (en) Domain generalized electroencephalogram signal classification method based on double supervision
CN114492560A (en) Electroencephalogram emotion classification method based on transfer learning
KR102340387B1 (en) Method of learning brain connectivity and system threrfor
CN114757273A (en) Electroencephalogram signal classification method based on collaborative contrast regularization average teacher model
CN110448273B (en) Low-power-consumption epilepsy prediction circuit based on support vector machine
Pandagre Detection of arrhythmia disease in ecg signal using optimal features
CN112489012A (en) Neural network architecture method for CT image recognition
Munoz-Martinez et al. InsideNet: A tool for characterizing convolutional neural networks
Zhang et al. Recognizing the level of organizational commitment based on deep learning methods and EEG
Dani et al. Survey on the use of CNN and Deep Learning in Image Classification

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant