An optimization method for epilepsy signal processing
Through the parallel branch structure of the frequency domain feature processing module FFHM and the spatiotemporal feature processing module TSFHM, combined with the hybrid self-attention module MSAM, the problems of incomplete feature extraction and high computational resource consumption in epilepsy signal processing are solved, and the efficiency of epilepsy signal recognition is improved. accuracy and model reliability.
Patent Information
- Application Number
- CN202410813843.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-06-24
AI Technical Summary
Existing technologies in epilepsy signal processing have problems such as incomplete feature extraction, low recognition accuracy, and high consumption of computing resources. In particular, deep learning models are highly complex and difficult to apply in actual scenarios.
The frequency domain feature processing module FFHM and the spatiotemporal feature processing module TSFHM are proposed to extract temporal and spatial features of different scales through parallel branches and perform feature fusion. Combined with the hybrid self-attention module MSAM, the comprehensive extraction of feature information and deep information mining are achieved. .
It improves the accuracy of epilepsy signal recognition, reduces the amount of calculation, and enhances the reliability and practical application potential of the model.
Smart Images

Figure CN118378070B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of signal processing, and in particular relates to an optimization method for epilepsy signal processing. Background Art
[0002] Epilepsy is a chronic neurological disease characterized by abnormal hypersynchronous discharges of neuronal groups in the brain, which causes patients to experience sudden, short-term and recurrent epileptic symptoms, posing a serious threat to their lives and health. Electroencephalogram (EEG) has become a key tool for monitoring epilepsy in clinical practice due to its non-stationary random signal characteristics, such as nonlinearity, multi-scale and spatial distribution, and its ease of acquisition and rich physiological and pathological information. However, due to the influence of individual experience and subjective factors of doctors, the accuracy and repeatability of EEG test results are not ideal.
[0003] In the field of automatic epilepsy detection, although traditional machine learning methods have made considerable progress, they still face complex feature engineering challenges and obvious limitations. Feature extraction and classifier design often rely on manual operations and tedious parameter adjustments, which is not only time-consuming and labor-intensive, but also difficult to ensure the stability and reliability of the results. Deep learning technology can deeply explore the long-term, non-stationary, and multi-channel characteristics of epilepsy signals, automatically extract more representative deep features, and achieve seamless integration of feature extraction and classifiers. This makes epilepsy detection based on deep learning show great development potential in terms of accuracy, efficiency, and automation.
[0004] Epilepsy recognition and detection technology using deep learning also has some limitations. On the one hand, it only recognizes information in a single domain and ignores other domains, resulting in incomplete extracted feature information and low recognition accuracy. On the other hand, the model performance complexity is too high, consuming a lot of computing and storage resources, and it is difficult to apply to actual scenarios. Summary of the invention
[0005] The present invention provides an optimization method for epilepsy signal processing. A frequency domain feature processing module FFHM is proposed, which can extract frequency domain features of electroencephalogram signals and can adaptively obtain effective information in the frequency domain according to different weights. A spatiotemporal feature processing module TSFHM is proposed, which consists of two parallel branches. Each branch extracts time and space features of different scales, and then performs feature fusion. Compared with a single time or space convolution, the extracted information is comprehensive, the amount of calculation increased by branch parallelism is small, and each branch has a corresponding convolution layer to extract spatiotemporal information, which can compensate for the information loss caused by FFHM. At the same time, a hybrid self-attention module MSAM is proposed, which can achieve an appropriate balance between the channel and spatial information of self-attention and mine deep information after feature fusion.
[0006] In order to achieve the above object, the present invention provides the following technical solution: an optimization method for epilepsy signal processing, comprising the following steps:
[0007] S1, obtaining the original EEG signal data sampled at a fixed frequency, dividing it into EEG signal data segments, marking the data segments of the epileptic pre-seizure period and the non-seizure period, and performing preprocessing operations on the input data;
[0008] S2. A frequency domain feature extraction method is proposed, and a frequency domain feature processing module FFHM is constructed, which includes a point-by-point convolution layer;
[0009] S3, construct a shallow feature processing block SFHB, including a temporal convolution layer, a separable spatial convolution layer, a point-by-point convolution layer, and an average pooling layer;
[0010] S4, construct a deep feature processing block DFHB, including a temporal convolution layer, a standard spatial convolution layer, and an average pooling layer;
[0011] S5. A method for extracting temporal and spatial features using dual branches is proposed to construct a temporal and spatial feature processing module TSFHM, which includes a shallow feature processing block SFHB and a deep feature processing block DFHB.
[0012] S6. A spatiotemporal feature fusion method based on attention is proposed to construct a hybrid self-attention module MSAM, which includes multiple convolutional layers, pooling layers, ReLU activation functions, element-by-element multiplication, and element-by-element addition.
[0013] S7, construct an epilepsy signal recognition model, which consists of input, frequency domain feature processing module, spatiotemporal feature processing module TSFHM, hybrid self-attention module MSAM, classifier and output;
[0014] S8. Train the epilepsy signal recognition model and process it in real time. Use the epilepsy data set to train the epilepsy signal processing model. After the training is completed, input the marked data of the epilepsy pre-attack period and non-attack period into the constructed model to detect whether epilepsy has occurred and output it.
[0015] Furthermore, in step S2, for the frequency domain feature processing module FFHM, the original sample can be expressed as , ,in, Representative feature map The number of channels, Represents the number of samples. The sliding window technique is used to extract feature data from the original data. Assume that the original data is divided into multiple sliding windows of length W, and each window overlaps a part. The obtained sliding window sequence The representation is as follows: , ,in, represents the ath data point in the bth sliding window, represents the length of the sliding window, Represents the total number of sliding windows. For each sliding window, its eigenvalue is calculated to obtain the eigenvector of each window. , and use these feature vectors as the input of the frequency domain feature processing module FFHM. , ,in, represents the feature calculation function, Represents the feature vector calculated by the b-th sliding window, and uses point-by-point convolution to fuse the frequency band information to obtain the fused feature map. The eigenvalues of the positions, ,in, , Represents the feature weight corresponding to the b-th sliding window.
[0016] Furthermore, in step S3, for the shallow feature processing block SFHB, the input is , ,in, Representative feature map The number of channels, Represents the number of samples, and obtains the output of the shallow feature processing block SFHB. ,i\in [1,2,...,M] ,in, is a temporal convolutional layer with the i-th temporal convolution kernel, is a separable spatial convolution layer with the i-th spatial convolution kernel, is point-wise convolution, is the average pooling operation, It is the feature learned by the shallow feature processing block.
[0017] Furthermore, in step S4, for the deep feature processing block DFHB, the input is , get the output of the deep feature processing block DFHB, ,in, Same as the input of the shallow feature processing block, is a temporal convolutional layer with the i-th temporal convolution kernel, is a standard spatial convolutional layer with the ith spatial convolution kernel, is the average pooling operation, It is the feature learned by the deep feature processing block.
[0018] Furthermore, in step S5, for the spatiotemporal feature processing module TSFHM, the input data passes through the shallow feature processing block SFHB and the deep feature processing block DFHB in parallel to obtain the output feature and , the features extracted by SFHB and DFHB are concatenated to obtain the output of the spatiotemporal feature processing module TSFHM, ,in, Indicates a connection operation. It is the feature after connection.
[0019] Furthermore, in step S6, for the hybrid self-attention module MSAM, the input feature map , ,in, Representative feature map The number of channels, and Representative feature map The height and width of After three parallel 1x1 convolutional layers, we get , , , , , ,in, Represents a 1x1 convolutional layer. , , Perform H-dimensional and W-dimensional pooling operations to obtain , , and , , ,calculate and ,in, is the number of channels, represents the Softmax function, , , is the spatial attention map, is the temporal attention map, and , and get the output of the hybrid self-attention module MSAM ,in, , represents a 1x1 convolutional layer, represents the ReLU activation function, ⊙ represents element-by-element multiplication, Stands for element-wise addition.
[0020] Furthermore, in step S7, for the epilepsy signal recognition model, after the data is input into the model, it passes through the frequency domain feature processing module FFHM, the spatiotemporal feature processing module TSFHM, and the hybrid self-attention module MSAM in sequence to obtain the intermediate output, and the nonlinear relationship between different feature maps is learned using the fully connected layer. Then, the intermediate output passes through the classifier composed of the fully connected layer and the softmax function to obtain the final output result.
[0021] Compared with the prior art, the present invention has the following technical effects:
[0022] The present invention provides an optimization method for epilepsy signal processing, which can extract feature information from the frequency domain, time domain, and space domain, overcoming the limitation of insufficient recognition accuracy caused by feature extraction limited to a specific domain. The spatiotemporal feature processing module TSFHM uses two parallel branches to extract features, avoiding the problems of excessive model calculation and long calculation time. The introduction of the attention mechanism can effectively fuse the extracted features and improve the recognition accuracy.
[0023] The proposed frequency domain feature processing module FFHM can extract the frequency domain features of EEG signals and can adaptively obtain effective information in the frequency domain according to different weights. A spatiotemporal feature processing module TSFHM is proposed, which consists of two parallel branches. Each branch extracts temporal and spatial features of different scales, and then performs feature fusion. Compared with a single temporal or spatial convolution, the extracted information is comprehensive, the amount of computation increased by branch parallelism is small, and each branch has a corresponding convolutional layer to extract spatiotemporal information, which can compensate for the information loss caused by FFHM. At the same time, a hybrid self-attention module MSAM is proposed, which can achieve an appropriate balance between the channel and spatial information of self-attention and mine the deep information after feature fusion. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flow chart of the method for identifying epilepsy signals provided by the present invention.
[0025] Figure 2 It is a structural diagram of the frequency domain feature processing module FFHM provided by the present invention.
[0026] Figure 3 This is a structural diagram of the shallow feature processing block SFHB provided by the present invention.
[0027] Figure 4 This is a structural diagram of the deep feature processing block DFHB provided by the present invention.
[0028] Figure 5 It is a structural diagram of the spatiotemporal feature processing module TSFHM provided by the present invention.
[0029] Figure 6This is a structural diagram of the hybrid self-attention module MSAM provided by the present invention.
[0030] Figure 7 It is a comparison chart of the accuracy of the model on the training set and the accuracy of the model on the validation set. DETAILED DESCRIPTION
[0031] The present invention provides an optimization method for epilepsy signal processing. A frequency domain feature processing module FFHM is proposed, which can extract the frequency domain features of electroencephalogram signals and fully mine the potential information in the data. A spatiotemporal feature processing module TSFHM is proposed, which consists of two parallel branches. Each branch extracts time and space features of different scales, and then performs feature fusion to extract more detailed information. Compared with a single time or space convolution, the increased computational complexity is very small, and the information loss caused by FFHM can be compensated. At the same time, a hybrid self-attention module MSAM is proposed, which can achieve an appropriate balance between the channel and spatial information of self-attention, and further mine the implicit information after feature fusion.
[0032] See also Figure 1 As shown, an optimization method for epilepsy signal processing in an embodiment of the present application is:
[0033] S1. Obtaining raw EEG signal data sampled at a fixed frequency, dividing it into EEG signal data segments, marking the data segments of the pre-seizure period and the non-seizure period, and performing preprocessing operations on the input data to remove the noise introduced when collecting the data;
[0034] S2. A frequency domain feature extraction method is proposed to construct a frequency domain feature processing module FFHM, which includes 1 point-by-point convolution layer with a convolution kernel size of 1x1;
[0035] S3. Construct a shallow feature processing block SFHB, including 1 temporal convolution layer, 1 separable spatial convolution layer, 1 point-by-point convolution layer, and 1 average pooling layer. The temporal convolution layer contains 8 convolution kernels of size 1x125, the separable spatial convolution layer contains 8 convolution kernels of size 20x1, and the point-by-point convolution layer contains 8 convolution kernels of size 1x1. The average pooling layer is used for dimensionality reduction.
[0036] S4. Construct a deep feature processing block DFHB, including 1 temporal convolution layer, 1 standard spatial convolution layer, and 1 average pooling layer. The temporal convolution layer contains 8 convolution kernels of size 1x30, and the standard spatial convolution layer includes 64 convolution layers of size 20x1. The average pooling layer is used for dimensionality reduction.
[0037] S5. A method for extracting temporal and spatial features using dual branches is proposed to construct a temporal and spatial feature processing module TSFHM, which includes a shallow feature processing block SFHB and a deep feature processing block, and the two are parallel;
[0038] S6. A spatiotemporal feature fusion method based on attention is proposed to construct a hybrid self-attention module MSAM, which includes 3 1x1 convolutional layers, 1 temporal pooling operation, 1 spatial pooling operation, 2 ReLU activation functions, 2 element-wise multiplication operations, and 3 element-wise addition operations;
[0039] S7, constructing an epileptic signal recognition model, which is composed of input epileptic signal data, a frequency domain feature processing module FFHM, a spatiotemporal feature processing module TSFHM, a hybrid self-attention module MSAM, a classifier and an output recognition result;
[0040] S8. Train the epilepsy signal recognition model and process it in real time. Use the epilepsy data set to train the epilepsy signal processing model. After the training is completed, input the marked data of the epilepsy pre-attack period and non-attack period into the constructed model to detect whether epilepsy has occurred and output it.
[0041] Furthermore, in step S2, for the frequency domain feature processing module FFHM, its structure is as follows: Figure 2 As shown, the original sample can be expressed as , ,in, Representative feature map The number of channels, Represents the number of samples. The sliding window technique is used to extract feature data from the original data. Assume that the original data is divided into multiple sliding windows of length W, and each window overlaps a part. The obtained sliding window sequence The representation is as follows: , ,in, represents the ath data point in the bth sliding window, represents the length of the sliding window, Represents the total number of sliding windows. For each sliding window, its eigenvalue is calculated to obtain the eigenvector of each window. , and use these feature vectors as the input of the frequency domain feature processing module FFHM. , ,in, represents the feature calculation function, Represents the feature vector calculated by the b-th sliding window, and uses point-by-point convolution to fuse the frequency band information to obtain the fused feature map. The eigenvalues of the positions, ,in, , Represents the feature weight corresponding to the b-th sliding window.
[0042] Furthermore, in step S3, for the shallow feature processing block SFHB, its structure is as follows Figure 3 As shown, the input is , ,in, Representative feature map The number of channels, Represents the number of samples, and obtains the output of the shallow feature processing block SFHB. ,i\in [1,2,...,M] ,in, is a temporal convolutional layer with the i-th temporal convolution kernel, is a separable spatial convolution layer with the i-th spatial convolution kernel, is point-wise convolution, is the average pooling operation, It is the feature learned by the shallow feature processing block.
[0043] Furthermore, in step S4, for the deep feature processing block DFHB, its structure is as follows Figure 4 As shown, the input is , get the output of the deep feature processing block DFHB, ,in, Same as the input of the shallow feature processing block, is a temporal convolutional layer with the i-th temporal convolution kernel, is a standard spatial convolutional layer with the ith spatial convolution kernel, is the average pooling operation, It is the feature learned by the deep feature processing block.
[0044] Furthermore, in step S5, for the spatiotemporal feature processing module TSFHM, its structure is as follows: Figure 5 As shown, the input data passes through the shallow feature processing block SFHB and the deep feature processing block DFHB in parallel to obtain the output feature and , the features extracted by SFHB and DFHB are concatenated to obtain the output of the spatiotemporal feature processing module TSFHM, ,in, Indicates a connection operation. It is the feature after connection.
[0045] Furthermore, in step S6, for the hybrid self-attention module MSAM, its structure is as follows Figure 6 As shown, the input feature map , ,in, Representative feature map The number of channels, and Representative feature map The height and width of After three parallel 1x1 convolutional layers, we get , , , , , ,in, Represents a 1x1 convolutional layer. , , Perform H-dimensional and W-dimensional pooling operations to obtain , , and , , ,calculate and ,in, is the number of channels, represents the Softmax function, , , is the spatial attention map, is the temporal attention map, , and get the output of the hybrid self-attention module MSAM ,in, , represents a 1x1 convolutional layer, represents the ReLU activation function, ⊙ represents element-by-element multiplication, Stands for element-wise addition.
[0046] Furthermore, in step S7, for the epilepsy signal recognition model, after the data is input into the model, it passes through the frequency domain feature processing module FFHM, the spatiotemporal feature processing module TSFHM, and the hybrid self-attention module MSAM in sequence to obtain an intermediate output, and the nonlinear relationship between different feature maps is learned using a fully connected layer. Then, the intermediate output passes through a classifier composed of a fully connected layer and a softmax function to obtain a final output result. The final result is divided into two types: epilepsy pre-seizure period and non-seizure period, among which the non-seizure period belongs to a normal EEG signal.
[0047] In order to verify the effect of the model, the epilepsy data set was divided into a training set and a validation set, and the model was trained and validated. Figure 7This is a comparison chart of the accuracy of the model on the training set and the accuracy of the model on the validation set.
[0048] As the number of iterations increases, the accuracy of the model on the training data gradually increases, indicating that the performance of the model on the training data is constantly improving.
[0049] Verification accuracy is an important indicator for evaluating the generalization ability of a model. During the training process, the verification accuracy gradually increases with the number of iterations and then remains stable, indicating that the model performs well on unseen data and has good generalization ability. This result provides strong evidence for the reliability of the model in epilepsy detection.
[0050] The above are only preferred embodiments of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the protection scope of the present invention.
Claims
1. An optimization method for epileptic signal processing, It is characterized in that The following steps are involved: S1, obtaining the original EEG signal data sampled at a fixed frequency, dividing it into EEG signal data segments, marking the data segments of the epileptic pre-seizure period and the non-seizure period, and performing preprocessing operations on the input data; S2. A frequency domain feature extraction method is proposed, and a frequency domain feature processing module FFHM is constructed, which includes a point-by-point convolution layer; S3, construct a shallow feature processing block SFHB, including a temporal convolution layer, a separable spatial convolution layer, a point-by-point convolution layer, and an average pooling layer; S4, construct a deep feature processing block DFHB, including a temporal convolution layer, a standard spatial convolution layer, and an average pooling layer; S5. A method for extracting temporal and spatial features using dual branches is proposed to construct a temporal and spatial feature processing module TSFHM, which includes a shallow feature processing block SFHB and a deep feature processing block DFHB. S6. A spatiotemporal feature fusion method based on attention is proposed to construct a hybrid self-attention module MSAM, which includes multiple convolutional layers, pooling layers, ReLU activation functions, element-by-element multiplication, and element-by-element addition. For the hybrid self-attention module MSAM, the input feature map X Min , X Min ∈R C×H×W , where C represents the feature map X Min The number of channels, H and W represent the feature map X Min The height and width, X Min After three parallel 1x1 convolutional layers, we get Q, K, and V respectively, Q = Conv 1×1 (X Min ), K = Conv 1×1 (X Min ), V = Conv 1×1 (X Min ), where Conv 1×1 Represents a 1x1 convolutional layer for Q, K, V∈R C×H×W Perform H-dimensional and W-dimensional pooling operations to obtain Q Sp , K Sp 、V Sp ∈R C×1×W and Q Te , K Te 、V Te ∈R C×H×1 ,calculate and in, is the number of channels, softmax represents the Softmax function, A Sp ∈R C×1×W , A Te ∈R C×H×1 , A Sp is the spatial attention map, A Te is the time attention map, calculate X Out =(X Min +X Min ⊙ReLU(Conv 1×1 (A Sp ))+(X Min +X Min ⊙ReLU(Conv 1×1 (A Te ))) and get the output X of the hybrid self-attention module MSAM Out , where X Out ∈R C×H×W , Conv 1×1 represents a 1×1 convolutional layer, ReLU represents the ReLU activation function, ⊙ represents element-by-element multiplication, and + represents element-by-element addition; S7, construct an epilepsy signal recognition model, which consists of an input, a frequency domain feature processing module FFHM, a spatiotemporal feature processing module TSFHM, a hybrid self-attention module MSAM, a classifier and an output; S8. Train the epilepsy signal recognition model and process it in real time. Use the epilepsy data set to train the epilepsy signal processing model. After the training is completed, input the marked data of the epilepsy pre-attack period and non-attack period into the constructed model to detect whether epilepsy has occurred and output it.
2. The optimization method for epilepsy signal processing according to claim 1, It is characterized in that In the step S2, for the frequency domain feature processing module FFHM, the input is the feature data X extracted from the original data using the sliding window technology M , X M (b) represents the feature vector calculated by the b-th sliding window. The frequency band information is fused using point-by-point convolution to obtain the feature value of the fused feature map at the (x, y) position. Among them, X FF (x,y)∈R C ×T , w(b) represents the feature weight corresponding to the b-th sliding window, C represents the number of channels of the feature map, T represents the number of samples, and N represents the total number of sliding windows.
3. The optimization method for epilepsy signal processing according to claim 1, It is characterized in that In the S3 step, for the shallow feature processing block SFHB, the input is X bin , X bin ∈R C×T , where C represents the feature map X bin The number of channels, T represents the number of samples, and the output of the shallow feature processing block SFHB is obtained. Among them, TConv i Sep_SConv is the temporal convolution layer with the i-th temporal convolution kernel, i is a separable spatial convolution layer with the i-th spatial convolution kernel, PWConv is a point-by-point convolution, and AveragePool is an average pooling operation. It is the feature learned by the shallow feature processing block.
4. The optimization method for epilepsy signal processing according to claim 1, It is characterized in that In step S4, for the deep feature processing block DFHB, the input is X bin , get the output of the deep feature processing block DFHB, Among them, X bin Same as the input of the shallow feature processing block, TConv i is a temporal convolutional layer with the i-th temporal convolution kernel, Std_SConv i is a standard spatial convolution layer with the i-th spatial convolution kernel, AveragePool is an average pooling operation, It is the feature learned by the deep feature processing block.
5. The optimization method for epilepsy signal processing according to claim 1, It is characterized in that In the step S5, for the spatiotemporal feature processing module TSFHM, the input data passes through the shallow feature processing block SFHB and the deep feature processing block DFHB in parallel to obtain the output feature and The features extracted by SFHB and DFHB are concatenated to obtain the output of the spatiotemporal feature processing module TSFHM. Among them, Concat represents the connection operation, X Concat It is the feature after connection.
6. The optimization method for epilepsy signal processing according to claim 1, It is characterized in that In the step S7, for the epilepsy signal recognition model, after the data is input into the model, it passes through the frequency domain feature processing module FFHM, the spatiotemporal feature processing module TSFHM, and the mixed self-attention module MSAM in sequence to obtain the intermediate output, and then passes through the classifier composed of a fully connected layer and a softmax function to obtain the final output result.
Citation Information
Patent Citations
Multi-task epilepsy electroencephalogram automatic detection and prediction system
CN116304575A
Epilepsy detection method and system based on cross-link nested subnet and mixed dependency algorithm
CN117982102A
