EEG signal spike detection method and system based on KAN feature fusion

Through the EEG signal spike detection method based on KAN feature fusion, the KAN network with multiple basis functions and the dual attention mechanism are utilized to solve the problems of low efficiency and poor accuracy of EEG signal detection in the existing technology, and achieve efficient spike detection.

CN120408385BActive Publication Date: 2025-09-23ARTIFICIAL INTELLIGENCE RES INST OF HEFEI COMPREHENSIVE NAT SCI CENT (ANHUI ARTIFICIAL INTELLIGENCE LAB)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510917986.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-09-23
Estimated Expiration
2045-07-03

AI Technical Summary

Technical Problem

What existing technologies cannot effectively solve is the complexity and individual differences of existing EEG signals. The resulting technical challenge is how to improve the accuracy and efficiency of existing technologies in detecting existing EEG signals, especially when the amount of data is large, which is time-consuming and labor-intensive and involves subjective differences.

Method used

An EEG signal spike detection method based on KAN feature fusion is adopted. Parallel feature extraction and splicing are performed through KAN networks with multiple basis functions. Combined with gated dynamic selection and dual attention mechanism, adaptive feature fusion and spike detection in noisy environment are achieved.

Benefits of technology

It significantly improves the accuracy of spike wave detection, reduces the reliance on artificial feature design, and improves the detection efficiency and accuracy of EEG signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120408385B_ABST
    Figure CN120408385B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for detecting spikes in EEG signals based on KAN feature fusion, comprising preprocessing EEG data to obtain a training set and a test set; performing parallel feature extraction to obtain multiple KAN parallel features, which are then concatenated and reduced in dimension to obtain hybrid features; performing gated dynamic selection on the obtained hybrid features to obtain fused features for comprehensive multi-scale analysis of the EEG signal; focusing on key time period features based on a dual attention mechanism to obtain weighted fusion features; inputting the obtained weighted fusion features into a classifier, training a prediction model based on a cross-entropy loss function; evaluating the model performance, and outputting the classification results. The present invention achieves epileptic seizure risk prediction by extracting heterogeneous EEG features, subjecting them to gated dynamic fusion and dual attention temporal compression, and then inputting them into a classifier. This significantly improves feature expression capabilities, enhances the ability to focus on key time periods, and optimizes classification performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent analysis and processing of EEG signals, and in particular to an EEG signal spike detection method and system based on KAN feature fusion. Background Art

[0002] Epilepsy is a common neurological disorder characterized by symptoms such as convulsions and loss of consciousness caused by abnormal discharges of brain neurons. Currently, the diagnosis and treatment of epilepsy primarily rely on electroencephalogram (EEG) examinations. By recording electrophysiological signals from the scalp surface, EEG allows clinicians to observe the electrical activity of brain neurons, particularly epileptic discharges (IEDs) that occur between seizures. Spikes, in particular, are important physiological hallmarks of epilepsy. Spike detection is a key step in noninvasively localizing epileptogenic foci, but current clinical practice still faces significant challenges, primarily due to low efficiency and high subjectivity in manual annotation. This is particularly true when EEG data is large and collected over long periods of time (hours to days). Doctors are required to observe and annotate spikes frame by frame, which is not only time-consuming and labor-intensive, but also leads to significant subjective variability in the annotation results.

[0003] To address this issue, current research primarily relies on traditional machine learning and deep learning-based approaches. Traditional machine learning methods typically require manual feature design, dimensionality reduction, and representation of EEG signals, combined with classifiers for spike detection. While these methods offer strong interpretability, making it easier for physicians to understand the algorithmic decisions, they rely on manual feature engineering and struggle to adapt to the complexity and individual variability of EEG signals. They exhibit poor detection accuracy for artifacts, atypical spikes, and poor generalization performance. In recent years, deep learning-based approaches have employed convolutional neural networks (CNNs), recurrent neural networks (RNNs), or hybrid architectures to achieve end-to-end training for spike detection, enabling automated feature learning and reducing reliance on manual feature design. While deep learning methods demonstrate significant potential for capturing complex features, improving their ability to comprehensively capture the complex characteristics of EEG signals remains an urgent challenge. Summary of the Invention

[0004] The purpose of the present invention is to overcome the shortcomings of the existing technology. To achieve the above purpose, an EEG signal spike detection method and system based on KAN feature fusion is adopted to solve the problems raised in the above background technology.

[0005] The technical solution provided in the first aspect is: an EEG signal spike detection method based on KAN feature fusion, comprising the following steps:

[0006] S1. Preprocess and segment the EEG data sampled from the interictal period of epileptic patients to obtain the training set and test set of segmented EEG.

[0007] S2. After performing parallel feature extraction based on the KAN network of multiple basis functions according to the obtained training set, multiple KAN parallel features are obtained and then spliced ​​and dimensionally reduced to obtain hybrid features;

[0008] S3, performing gated dynamic selection on the obtained mixed features to obtain the fusion features of the comprehensive multi-scale analysis of the EEG signal;

[0009] S4. Based on the dual attention mechanism, multi-head self-attention is used to capture long-term dependencies and learnable attention to compress the temporal dimension to focus on key time period features, thereby obtaining weighted fusion features.

[0010] S5. Input the obtained weighted fusion features into the classifier and train the prediction model based on the cross entropy loss function;

[0011] S6. Finally, use the test set to evaluate the model performance and output the classification results.

[0012] As a further solution of the present invention: the specific steps in S1 include:

[0013] S11, collect the EEG data of epilepsy patients between attacks Bandpass filtering and Notch processing;

[0014] S12, performing heartbeat artifact removal processing on the data after bandpass filtering by using an ICA decomposition and artifact removal algorithm;

[0015] S13, the obtained pre-processed data is time sliced ​​according to the doctor's annotation, and the batch size is set to , get the input data ,in Indicates the slice time length, corresponding to the time dimension, Indicates the number of channels.

[0016] As a further solution of the present invention: the specific steps in S2 include:

[0017] S21, based on the KAN network layer of seven orthogonal basis functions, parallel feature extraction calculations are performed on the obtained training set to obtain seven parallel features with different data. The seven orthogonal basis functions include Basis functions, Basis functions, Basis functions, Basis functions, Basis functions, basis functions, and Basis functions;

[0018] S22. Concatenate and reduce the dimensions of the seven parallel features obtained to obtain hybrid features.

[0019] As a further solution of the present invention: the specific steps in S21 include:

[0020] The original signal is projected into a specific feature space, and the nonlinear fitting ability of the learnable activation function is used to extract the time-frequency or spatial features. The formula is:

[0021]

[0022] Among them, the subscript Indicates the The seed function is used as the KAN network with the underlying fitting function of the learnable activation function. The value of 、 、 、 、 、 、 ; represents the preprocessed signal; It represents the preliminary representation obtained after each KAN network, is the data dimension, represents the batch size, represents the time step, Represents the feature dimension extracted by the KAN network.

[0023] As a further solution of the present invention: The basis function locally smoothes the EEG signal through piecewise low-order polynomials, and the formula is:

[0024]

[0025] in, represents the default activation function, Represents the basic weight, and the two are multiplied to get the basic output; represents the output of the B-spline function, represents the spline function coefficients, represents the fitting bias term, Indicates passing Features extracted by the KAN network;

[0026] described The basis function captures the global periodic characteristics of the signal through frequency domain energy analysis. The formula is:

[0027]

[0028] in, Indicates The highest expansion order in the basis function, Indicates the current level, and represents the corresponding sine and cosine term coefficients; Indicates passing Features extracted by the KAN network;

[0029] described The basis function eliminates the trend term through high-order polynomial fitting while retaining the relative waveform characteristics of the spike wave. The formula is:

[0030]

[0031]

[0032]

[0033] in, represents the highest order of the polynomial, Indicates the current order of the polynomial, represents the coefficients corresponding to the polynomial, Indicates the Chebyshev polynomials of order, is the bias term; for is input go through Compression to the effective representation interval of Chebyshev polynomials the result; Indicates passing Features extracted by the KAN network;

[0034] described The basis function accurately captures the transient rising edge of the spike wave through the high-order derivative sensitivity characteristics. The formula is:

[0035]

[0036] in, Indicates the maximum number of expansions, Indicates the current level, express The coefficient of the second term, Represents input of power; Indicates passing Features extracted by the KAN network;

[0037] described The basis function optimizes the multi-lead signal through orthogonal weight distribution for joint analysis. The formula is:

[0038]

[0039] in, represents the highest degree of the polynomial, Indicates the degree of the currently accumulated polynomial, Indicates the The recursive formula of the Jacobi polynomial of order can be derived by sequentially deducing the first two terms. Indicates the The coefficients of the polynomial of order, and It is a key hyperparameter of the Jacobi polynomial, which controls the adaptability of the model to different input distributions by adjusting the shape and orthogonality weight of the basis function; Indicates passing Features extracted by the KAN network;

[0040] described The basis function is highly matched with the spike shape of the spike wave through the combination of high-order derivatives and Gaussian functions. The formula is:

[0041]

[0042]

[0043]

[0044]

[0045] in, represents the highest degree of the polynomial, Indicates the degree of the currently accumulated polynomial, Indicates the The recursive formula of the Hermite polynomial of order can also be derived by sequentially deducing the first two terms. Indicates the The coefficients of the polynomial of order; represents the normalization factor; Indicates passing Features extracted by the KAN network;

[0046] described The basis function balances the local details and global trends of the signal through multi-scale time-frequency analysis. The formula is:

[0047]

[0048]

[0049] in, Represents the main process of wavelet transform, Represents the input feature dimension, which is the input The number of channels in the last dimension , Indicates the The wavelet weights corresponding to the input features are Represents the wavelet function acting on the input features; and Indicates the The learnable scale and translation parameters corresponding to each feature adjust the shape of the wavelet function; Indicates passing Features extracted by the KAN network.

[0050] As a further solution of the present invention: the specific steps in S22 include:

[0051] The seven parallel features are concatenated and dimensionally reduced to obtain hybrid features. The formula is:

[0052]

[0053]

[0054]

[0055]

[0056] in, Indicates passing The features extracted by the KAN network, Indicates passing The features extracted by the KAN network, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Represents the feature dimension after KAN, It means splicing in the time dimension, and the spliced ​​features are then reduced in dimension by one-dimensional convolution to obtain mixed features. Represents the mixed feature dimension after dimensionality reduction.

[0057] As a further solution of the present invention: the specific steps in S3 include:

[0058] S31. The obtained hybrid features are used to calculate the dynamic fusion weights of the seven KAN network features through the multi-head self-attention mechanism to obtain the KAN network self-attention weights at each time step;

[0059] Mixing features Dynamic weight calculation based on the self-attention mechanism is as follows:

[0060]

[0061]

[0062]

[0063]

[0064] in, Represents the seven KAN network dynamic weights obtained by self-attention calculation of data; is an activation function, Mixed features The three different embedding vectors generated by the mapping are, are the corresponding three different mapping matrices, is the feature dimension in the attention mechanism;

[0065] S32. Use self-attention weights to mix features by time step Perform weighted fusion to obtain fusion features , the formula is:

[0066]

[0067]

[0068] in, Indicates the The seed function is used as the KAN network with the underlying fitting function of the learnable activation function. The value of 、 、 、 、 、 、 ; represents the time step, Represents data at time step Next Dynamic weights of a KAN network; Indicates that the data passes through After the KAN network is generated, Next dimensional features; Represents the weighted fusion features of the seven KAN networks at time step t. Indicates a splicing operation in the time dimension.

[0069] As a further solution of the present invention: the specific steps in S4 include:

[0070] S41, the obtained fusion features Use the multi-head self-attention mechanism to capture long-term dependencies. The formula is:

[0071]

[0072]

[0073]

[0074]

[0075]

[0076]

[0077] Among them, the subscript Represents the first An attention head, represents the total amount of multi-head attention; is an activation function, Fusion features The three different embedding vectors generated by the mapping are, are the corresponding three different mapping matrices; (∙) Represents a splicing operation; is a learnable linear transformation coefficient matrix; Residual connection and normalization; Initial weight fusion features to be normalized and residual connections; is the initial weight fusion feature;

[0078] S42, the obtained preliminary weight fusion features Through the learnable attention mechanism, the time dimension is fixed and compressed, the key time period is dynamically focused, and the final weighted fusion feature is finally obtained. , the formula is:

[0079]

[0080]

[0081]

[0082]

[0083] in, is an activation function, is the initial weight fusion feature The two different embedding vectors generated by the mapping, are the corresponding two different mapping matrices, To learn the query vector, we set the fixed dimension to To achieve the purpose of compressing the time dimension, back-propagation learning optimization can be used.

[0084] As a further solution of the present invention: the specific steps in S5 include:

[0085] The final output weight fusion feature is sent to the classifier to obtain the predicted probability of the model's final output;

[0086] Then, based on the predicted probability, the binary cross entropy loss function of the model is back-propagated to update the model parameters and train the model. The formula is:

[0087]

[0088]

[0089] Among them, the subscript Represents the input model EEG data; Represents the prediction result output by the model, represents an activation function, represents a linear layer; represents the true label of the EEG data, represents the total number of EEG data samples, Represents the mean of the loss function of all samples in this model.

[0090] The second aspect provides a technical solution: a detection system using the EEG signal spike detection method based on KAN feature fusion as described in any one of the above, comprising:

[0091] The data preprocessing module is used to preprocess and segment the EEG data sampled from epileptic patients during interictal periods to obtain training and test sets of segmented EEGs;

[0092] The multi-KAN parallel feature extraction module is used to perform parallel feature extraction based on the KAN network of multiple basis functions according to the obtained training set, and then splice and reduce the dimension of the obtained multi-KAN parallel features to obtain hybrid features;

[0093] The gated dynamic selection module is used to perform gated dynamic selection on the obtained mixed features to obtain the fusion features of the comprehensive multi-scale analysis of the EEG signal;

[0094] The dual attention temporal compression module is used to capture long-term dependencies using multi-head self-attention and learnable attention to compress temporal dimensions to focus on key time period features and obtain weighted fusion features based on the dual attention mechanism.

[0095] The classification prediction module is used to input the obtained weighted fusion features into the classifier and train the prediction model based on the cross entropy loss function;

[0096] The test evaluation module is used to evaluate the model performance using the test set and output the classification results.

[0097] Compared with the prior art, the present invention has the following technical effects:

[0098] This technical solution leverages the KAN network's ability to learn activation function properties. Using seven different basis functions, the KAN network covers the time-frequency, noise-resistance, and transient characteristics of EEG signals. Furthermore, the self-attention mechanism dynamically generates a gated weight matrix, enabling adaptive feature fusion in noisy environments. Compared to existing temporal spike detection models, this significantly improves the model's accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0099] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings:

[0100] Figure 1 This is a schematic diagram of the steps of the spike wave detection method according to the embodiment disclosed in this application;

[0101] Figure 2 This is an example of EEG slice data of the embodiment disclosed in this application;

[0102] Figure 3 This application discloses an embodiment of Schematic diagram of the basic model of the dimensional KAN network;

[0103] Figure 4 This is a diagram of a multi-KAN parallel feature extraction network model according to an embodiment disclosed in this application;

[0104] Figure 5 This is a diagram of a self-attention gated enhanced feature fusion model according to an embodiment disclosed in this application;

[0105] Figure 6 This is a diagram of a multi-head attention long-term dependency capture and learnable attention feature dimensionality reduction model for the embodiments disclosed in this application. DETAILED DESCRIPTION

[0106] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0107] Please refer to Figure 1 In an embodiment of the present invention, a technical solution provided in the first aspect is: an EEG signal spike detection method based on KAN feature fusion, comprising the following steps:

[0108] S1. Preprocessing and data segmentation of EEG data sampled from epileptic patients during interictal periods to obtain training and test sets of segmented EEG data. The specific steps include:

[0109] In this embodiment, the preprocessing includes bandpass filtering, ECG artifact removal, resampling, and normalization, specifically:

[0110] S11, collect the EEG data of epilepsy patients between attacks Bandpass filtering and Notch processing;

[0111] S12, performing heartbeat artifact removal processing on the data after bandpass filtering by using an ICA decomposition and artifact removal algorithm;

[0112] Among them, based on the reference electrocardiogram (ECG) and electrooculogram (EOG) channels, the data after bandpass filtering is decomposed and the artifact vector removal algorithm is used to remove heartbeat artifacts and eye movement artifacts;

[0113] The data after artifact removal were normalized by Z-score on a channel-by-channel basis to obtain the preprocessed EEG data.

[0114] S13, the obtained pre-processed data is time sliced ​​according to the doctor's annotation, and the batch size is set to , get the input data ,in Indicates the slice time length, corresponding to the time dimension, Indicates the number of channels.

[0115] like Figure 2 As shown, the figure shows an example of EEG slice data;

[0116] In this embodiment, the pre-processed EEG data is sliced ​​200ms before and after the doctor's marked points, and the batch size is set is 32, and each marked point will get a Dimensional data , after batching, the final input data is obtained , where 32 corresponds to the batch size , 400 corresponds to the time step , 19 corresponds to the number of lead channels , subscript Indicates the current EEG data sequence number.

[0117] Divide the sliced ​​data and randomly select The data of 22980 data slices were selected as the test set, and the remaining data were used as the training set. ) data as the test set , and the rest of the data is used as training set data ;

[0118] S2. After performing parallel feature extraction based on the KAN network of multiple basis functions according to the obtained training set, multiple KAN parallel features are obtained, and then spliced ​​and dimensionally reduced to obtain hybrid features. The specific steps include:

[0119] S21, based on the KAN network layer of seven orthogonal basis functions, parallel feature extraction calculations are performed on the obtained training set to obtain seven parallel features with different data. The seven orthogonal basis functions include Basis functions, Basis functions, Basis functions, Basis functions, Basis functions, basis functions, and Basis function; the specific steps include:

[0120] The original signal is projected into a specific feature space, and the nonlinear fitting ability of the learnable activation function is used to extract the time-frequency or spatial features. The formula is:

[0121]

[0122] Among them, the subscript Indicates the The seed function is the KAN network with the underlying fitting function of the learnable activation function, and the value of k is 、 、 、 、 、 、 ; represents the preprocessed signal; It represents the preliminary representation obtained after each KAN network, is the data dimension, represents the batch size, represents the time step, Represents the feature dimension extracted by the KAN network.

[0123] In this embodiment, each KAN network adopts a three-layer network architecture, with the network dimensions being , here The number of lead channels representing EEG signals , Represents the feature dimension after KAN, and performs feature extraction on the channel information at the same time step, such as Figure 3 As shown, the figure shows a A network diagram with a hidden layer dimension of 3. Specifically:

[0124]

[0125] Among them, the original data After feature extraction, we get , the time dimension does not change, and the feature dimension of the same time step is adjusted to the feature dimension through the network The basis function learning and fitting process in each layer of KAN will not be described here.

[0126] In this embodiment, Figure 4 As shown, the diagram shows a multi-KAN parallel feature extraction network model diagram; according to the original data , , so the KAN network dimension is , the features output by each KAN network are .

[0127] Regarding the seven orthogonal basis functions, specifically:

[0128] described The basis function locally smoothes the EEG signal through piecewise low-order polynomials, and the formula is:

[0129]

[0130] in, represents the default activation function, Represents the basic weight, and the two are multiplied to get the basic output; represents the output of the B-spline function, represents the spline function coefficients, represents the fitting bias term, Indicates passing Features extracted by the KAN network;

[0131] described The basis function captures the global periodic characteristics of the signal through frequency domain energy analysis. The formula is:

[0132]

[0133] in, Indicates The highest expansion order in the basis function, Indicates the current level, and represents the corresponding sine and cosine term coefficients; Indicates passing Features extracted by the KAN network;

[0134] described The basis function eliminates the trend term through high-order polynomial fitting while retaining the relative waveform characteristics of the spike wave. The formula is:

[0135]

[0136]

[0137]

[0138] in, represents the highest order of the polynomial, Indicates the current order of the polynomial, represents the coefficients corresponding to the polynomial, Indicates the Chebyshev polynomials of order, is the bias term; for is input go through Compression to the effective representation interval of Chebyshev polynomials the result; Indicates passing Features extracted by the KAN network;

[0139] described The basis function accurately captures the transient rising edge of the spike wave through the high-order derivative sensitivity characteristics. The formula is:

[0140]

[0141] in, Indicates the maximum number of expansions, Indicates the current level, express The coefficient of the second term, Represents input of power; Indicates passing Features extracted by the KAN network;

[0142] described The basis function optimizes the multi-lead signal through orthogonal weight distribution for joint analysis. The formula is:

[0143]

[0144] in, represents the highest degree of the polynomial, Indicates the degree of the currently accumulated polynomial, Indicates the The recursive formula of the Jacobi polynomial of order can be derived by sequentially deducing the first two terms. Indicates the The coefficients of the polynomial of order, and It is a key hyperparameter of the Jacobi polynomial, which controls the adaptability of the model to different input distributions by adjusting the shape and orthogonality weight of the basis function; Indicates passing Features extracted by the KAN network;

[0145] described The basis function is highly matched with the spike shape of the spike wave through the combination of high-order derivatives and Gaussian functions. The formula is:

[0146]

[0147]

[0148]

[0149]

[0150] in, represents the highest degree of the polynomial, Indicates the degree of the currently accumulated polynomial, Indicates the The recursive formula of the Hermite polynomial of order can also be derived by sequentially deducing the first two terms. Indicates the The coefficients of the polynomial of order; represents the normalization factor; Indicates passing Features extracted by the KAN network;

[0151] described The basis function balances the local details and global trends of the signal through multi-scale time-frequency analysis. The formula is:

[0152]

[0153]

[0154] in, Represents the main process of wavelet transform, Represents the input feature dimension, which is the input The number of channels in the last dimension , Indicates the The wavelet weights corresponding to the input features are Represents the wavelet function acting on the input features; and Indicates the The learnable scale and translation parameters corresponding to each feature adjust the shape of the wavelet function; Indicates passing Features extracted by the KAN network.

[0155] In this embodiment, five wavelet functions are used. A brief description is given below. Indicates general input, no dimension description is given:

[0156] The Mexican Hat wavelet is the second derivative of the Gaussian function (negative normalization), which is shaped like a Mexican hat.

[0157]

[0158] Wavelet (also known as Wavelet is a complex-valued wavelet widely used in time-frequency analysis. Its core idea is to modulate the complex exponential signal with a Gaussian window function to achieve accurate analysis of the local frequency characteristics of the signal.

[0159]

[0160] in, is the center frequency, here the default value is used .

[0161] Gaussian reciprocal wavelet ( ) is the first derivative of the Gaussian function.

[0162]

[0163] in, Is the scale parameter, which controls the width of the wavelet. The default value is used here. .

[0164] Wavelet is a wavelet that is compactly supported and infinitely smooth in the frequency domain.

[0165]

[0166]

[0167]

[0168] in, and It is an auxiliary function to implement the wavelet in the code. The branches correspond to the low frequency band in the frequency domain, and the wavelet has no energy outside this interval; The branches correspond to the transition regions in the frequency domain, and another auxiliary function Achieve smooth transition.

[0169] Helper Functions The construction of needs to meet two conditions: smoothness, and All derivatives are 0 at , ensuring high-order continuity in the transition interval; normalization, .

[0170] Wavelet (also known as Wavelet) is an ideal bandpass filter.

[0171]

[0172]

[0173] in, Indication Standard Wavelet function, here we use the Hamming window processing ,pass Window smooth cutoff function, limiting its effective range, reducing edge effects, avoiding numerical problems caused by infinite oscillations, and enhancing numerical stability.

[0174] S22. Concatenate and reduce the dimensions of the seven parallel features to obtain hybrid features. The specific steps include:

[0175] The seven parallel features extracted from the KAN network layer based on the seven basis functions are concatenated and reduced in dimension. The formula is:

[0176]

[0177]

[0178]

[0179]

[0180] in, Indicates passing The features extracted by the KAN network, Indicates passing The features extracted by the KAN network, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Represents the feature dimension after KAN, It means splicing in the time dimension, and the spliced ​​features are then reduced in dimension by one-dimensional convolution to obtain mixed features. Represents the mixed feature dimension after dimensionality reduction.

[0181] Specifically, the above After splicing the feature dimensions, we get the initial mixed features. ; The preliminary mixed features are Then continue to send it to one-dimensional convolution for feature compression and maintain time resolution constant, Represents the mixed feature dimension after dimensionality reduction, where , and finally get the compressed mixed features , which is specifically .

[0182] S3. Perform gated dynamic selection on the obtained mixed features to obtain the fusion features of the comprehensive multi-scale analysis of the EEG signal. The specific steps include:

[0183] like Figure 5 As shown, the figure shows the self-attention gate enhanced feature fusion model;

[0184] S31. The obtained hybrid features are used to calculate the dynamic fusion weights of the seven KAN network features through the multi-head self-attention mechanism to obtain the KAN network self-attention weights at each time step;

[0185] The fusion features Dynamic weight calculation based on the self-attention mechanism is as follows:

[0186]

[0187]

[0188]

[0189]

[0190] in, Represents the seven KAN network dynamic weights obtained by self-attention calculation of data; is an activation function, Mixed features The three different embedding vectors generated by the mapping are, are the corresponding three different mapping matrices, is the feature dimension in the attention mechanism;

[0191] In this embodiment, the three embedding vectors are , the corresponding three different mapping matrices are , here ; EEG mixed features After the above self-attention mechanism, a weight coefficient matrix based on time steps will be obtained , specifically .

[0192] S32. Use self-attention weights to mix features by time step Perform weighted fusion to obtain fusion features , the formula is:

[0193]

[0194]

[0195] in, Indicates the The seed function is used as the KAN network with the underlying fitting function of the learnable activation function. The value of 、 、 、 、 、 、 ; represents the time step, Represents data at time step Next Dynamic weights of a KAN network; Indicates that the data passes through After the KAN network is generated, Next dimensional features; Represents the weighted fusion features of the seven KAN networks at time step t. Indicates a splicing operation in the time dimension.

[0196] In this embodiment, the feature yes The 64-dimensional features of the moment, The corresponding weight coefficient is obtained by adding up the features at the same time after multiplication. Fusion characteristics of the moment ; Finally, splicing in the time dimension will obtain the fusion feature with unchanged time resolution , specifically .

[0197] S4. Based on the dual attention mechanism, multi-head self-attention is used to capture long-term dependencies and learnable attention is used to compress the temporal dimension to focus on key time period features, thereby obtaining weighted fusion features. The specific steps include:

[0198] like Figure 6 As shown, the diagram shows a multi-head attention long-term dependency capture and learnable attention feature dimensionality reduction model;

[0199] S41, the obtained fusion features Use the multi-head self-attention mechanism to capture long-term dependencies. The formula is:

[0200]

[0201]

[0202]

[0203]

[0204]

[0205]

[0206] Among them, the subscript Represents the first An attention head, represents the total amount of multi-head attention; is an activation function, is the weighted fusion feature The three different embedding vectors generated by the mapping are, are the corresponding three different mapping matrices; (∙) Represents a splicing operation; is a learnable linear transformation coefficient matrix; Residual connection and normalization; Initial weight fusion features to be normalized and residual connections; is the initial weight fusion feature;

[0207] In this embodiment, the fusion feature After the four-head self-attention mechanism, long-term dependencies are captured ( , the three embedding vectors are , the corresponding three different mapping matrices are , the output of each attention head is , the multi-head output after splicing is , and then through the learnable weight matrix Calculate the projection back to the original dimension to obtain the initial weight fusion features to be normalized and residual connected ; Finally, the initial fusion features are introduced through the residual connection And normalize to get the initial weight fusion feature , to prevent over-smoothing of deep features.

[0208] S42, the obtained preliminary weight fusion features Through the learnable attention mechanism, the time dimension is fixed and compressed, the key time period is dynamically focused, and the final weighted fusion feature is finally obtained. , the formula is:

[0209]

[0210]

[0211]

[0212]

[0213] in, is an activation function, is the initial weight fusion feature The two different embedding vectors generated by the mapping, are the corresponding two different mapping matrices, To learn the query vector, we set the fixed dimension to To achieve the purpose of compressing the time dimension, back-propagation learning optimization can be used.

[0214] In this embodiment, the initial weight fusion feature obtained in step S41 The basic process of multi-KAN feature fusion has been completed without changing the temporal resolution. Finally, the feature dimensionality reduction of the temporal dimension needs to be performed through the learnable attention module. , preliminary weight fusion features The two embedding vectors of , the corresponding two mapping matrices are , is the feature dimension in the attention mechanism. The final weighted fusion feature obtained by the learnable attention mechanism is , the time length is reduced to .

[0215] In summary, a raw EEG slice data After steps S2, S3 and S4, we can learn a Dimensional weight fusion features .

[0216] S5. Fusion of weighted features Input the classifier and train the prediction model based on the cross entropy loss function. The specific steps include:

[0217] The final output weight fusion feature is sent to the classifier to obtain the predicted probability of the model's final output;

[0218] Then, based on the predicted probability, the binary cross entropy loss function of the model is back-propagated to update the model parameters and train the model. The formula is:

[0219]

[0220]

[0221] Among them, the subscript Represents the input model EEG data; Represents the prediction result output by the model, represents an activation function, represents a linear layer; represents the true label of the EEG data, represents the total number of EEG data samples, Represents the mean of the loss function of all samples in this model.

[0222] Once the training is completed, the entire prediction model is obtained. and the entire model parameters .

[0223] S6. Finally, use the test set Evaluate model performance and output classification results. The specific steps are:

[0224]

[0225] in, For the test set data In the model The prediction results on .

[0226] The second aspect provides a technical solution: a detection system using the EEG signal spike detection method based on KAN feature fusion as described in any one of the above, comprising:

[0227] The data preprocessing module is used to preprocess and segment the EEG data sampled from epileptic patients during interictal periods to obtain training and test sets of segmented EEGs;

[0228] The multi-KAN parallel feature extraction module is used to perform parallel feature extraction based on the KAN network of multiple basis functions according to the obtained training set, and then splice and reduce the dimension of the obtained multi-KAN parallel features to obtain hybrid features;

[0229] The gated dynamic selection module is used to perform gated dynamic selection on the obtained mixed features to obtain the fusion features of the comprehensive multi-scale analysis of the EEG signal;

[0230] The dual attention temporal compression module is used to capture long-term dependencies using multi-head self-attention and learnable attention to compress temporal dimensions to focus on key time period features and obtain weighted fusion features based on the dual attention mechanism.

[0231] The classification prediction module is used to input the obtained weighted fusion features into the classifier and train the prediction model based on the cross entropy loss function;

[0232] The test evaluation module is used to evaluate the model performance using the test set and output the classification results.

[0233] Although the embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and variations may be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents, and all should be included within the scope of protection of the present invention.

Claims

1. A method for detecting spikes in EEG signals based on KAN feature fusion, characterized in that: The following steps are involved: S1. Preprocess and segment the EEG data sampled from the interictal period of epileptic patients to obtain the training set and test set of segmented EEG. S2. After performing parallel feature extraction based on the KAN network of multiple basis functions according to the obtained training set, multiple KAN parallel features are obtained and then spliced ​​and dimensionally reduced to obtain hybrid features; S3, performing gated dynamic selection on the obtained mixed features to obtain the fusion features of the comprehensive multi-scale analysis of the EEG signal; S4. Based on the dual attention mechanism, multi-head self-attention is first used to capture long-term dependencies, and then the learnable attention is used to compress the temporal dimension to focus on key time features, thereby obtaining weighted fusion features. S5. Input the obtained weighted fusion features into the classifier and train the prediction model based on the cross entropy loss function; S6. Finally, use the test set to evaluate the model performance and output the classification results.

2. The EEG signal spike detection method based on KAN feature fusion according to claim 1, characterized in that: The specific steps in S1 include: S11, collect the EEG data of epilepsy patients between attacks Bandpass filtering and Notch processing; S12, performing heartbeat artifact removal processing on the data after bandpass filtering by using an ICA decomposition and artifact removal algorithm; S13, the obtained pre-processed data is time sliced ​​according to the doctor's annotation, and the batch size is set to , get the input data ,in Indicates the slice time step, corresponding to the time dimension, Indicates the number of channels.

3. The EEG signal spike detection method based on KAN feature fusion according to claim 1, characterized in that: The specific steps in S2 include: S21, based on the KAN network layer of seven orthogonal basis functions, parallel feature extraction calculations are performed on the obtained training set to obtain seven parallel features with different data. The seven orthogonal basis functions include Basis functions, Basis functions, Basis functions, Basis functions, Basis functions, basis functions, and Basis functions; S22. Concatenate and reduce the dimensions of the seven parallel features obtained to obtain hybrid features.

4. The EEG signal spike detection method based on KAN feature fusion according to claim 3, characterized in that: The specific steps in S21 include: The original signal is projected into a specific feature space, and the nonlinear fitting ability of the learnable activation function is used to extract the time-frequency or spatial features. The formula is: Among them, the subscript Indicates the The seed function is used as the KAN network with the underlying fitting function of the learnable activation function. The value of 、 、 、 、 、 、 ; represents the preprocessed signal; It represents the preliminary representation obtained after each KAN network, is the data dimension, represents the batch size, represents the time step, Represents the feature dimension extracted by the KAN network.

5. The EEG signal spike detection method based on KAN feature fusion according to claim 3, characterized in that: described The basis function locally smoothes the EEG signal through piecewise low-order polynomials, and the formula is: in, represents the default activation function, Represents the basic weight, and the two are multiplied to get the basic output; represents the output of the B-spline function, represents the spline function coefficients, represents the fitting bias term, Indicates passing Features extracted by the KAN network; described The basis function captures the global periodic characteristics of the signal through frequency domain energy analysis. The formula is: in, Indicates The highest expansion order in the basis function, Indicates the current level, and represents the corresponding sine and cosine term coefficients; Indicates passing Features extracted by the KAN network; described The basis function eliminates the trend term through high-order polynomial fitting while retaining the relative waveform characteristics of the spike wave. The formula is: in, represents the highest order of the polynomial, Indicates the current order of the polynomial, represents the coefficients corresponding to the polynomial, Indicates the Chebyshev polynomials of order, is the bias term; for is input go through Compression to the effective representation interval of Chebyshev polynomials the result; Indicates passing Features extracted by the KAN network; described The basis function accurately captures the transient rising edge of the spike wave through the high-order derivative sensitivity characteristics. The formula is: in, Indicates the maximum number of expansions, Indicates the current level, express The coefficient of the second term, Represents input of power; Indicates passing Features extracted by the KAN network; described The basis function optimizes the multi-lead signal through orthogonal weight distribution for joint analysis. The formula is: in, represents the highest degree of the polynomial, Indicates the degree of the currently accumulated polynomial, Indicates the The recursive formula of the Jacobi polynomial of order can be derived by sequentially deducing the first two terms. Indicates the The coefficients of the polynomial of order, and It is a key hyperparameter of the Jacobi polynomial, which controls the adaptability of the model to different input distributions by adjusting the shape and orthogonality weight of the basis function; Indicates passing Features extracted by the KAN network; described The basis function is highly matched with the spike shape of the spike wave through the combination of high-order derivatives and Gaussian functions. The formula is: in, represents the highest degree of the polynomial, Indicates the degree of the currently accumulated polynomial, Indicates the The recursive formula of the Hermite polynomial of order can also be derived by sequentially deducing the first two terms. Indicates the The coefficients of the polynomial of order; represents the normalization factor; Indicates passing Features extracted by the KAN network; described The basis function balances the local details and global trends of the signal through multi-scale time-frequency analysis. The formula is: in, Represents the main process of wavelet transform, Represents the input feature dimension, which is the input The number of channels in the last dimension , Indicates the The wavelet weights corresponding to the input features are Represents the wavelet function acting on the input features; and Indicates the The learnable scale and translation parameters corresponding to each feature adjust the shape of the wavelet function; Indicates passing Features extracted by the KAN network.

6. The EEG signal spike detection method based on KAN feature fusion according to claim 5, characterized in that: The specific steps in S22 include: The seven parallel features are concatenated and dimensionally reduced to obtain hybrid features. The formula is: in, Indicates passing The features extracted by the KAN network, Indicates passing The features extracted by the KAN network, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Indicates passing The features extracted by the KAN network of the basis function, Represents the feature dimension after KAN, It means splicing in the time dimension, and the spliced ​​features are then reduced in dimension by one-dimensional convolution to obtain mixed features. Represents the mixed feature dimension after dimensionality reduction.

7. The EEG signal spike detection method based on KAN feature fusion according to claim 2, characterized in that: The specific steps in S3 include: S31. The obtained hybrid features are used to calculate the dynamic fusion weights of the seven KAN network features through the multi-head self-attention mechanism to obtain the KAN network self-attention weights at each time step; Mixing features Dynamic weight calculation based on the self-attention mechanism is as follows: in, Represents the seven KAN network dynamic weights obtained by self-attention calculation of data; is an activation function, Fusion features The three different embedding vectors generated by the mapping are, are the corresponding three different mapping matrices, is the feature dimension in the attention mechanism; S32. Use self-attention weights to mix features by time step Perform weighted fusion to obtain fusion features , the formula is: in, Indicates the The seed function is used as the KAN network with the underlying fitting function of the learnable activation function. The value of 、 、 、 、 、 、 ; represents the time step, Represents data at time step Next Dynamic weights of a KAN network; Indicates that the data passes through After the KAN network is generated, Next dimensional features; Represents the weighted fusion features of the seven KAN networks at time step t. Indicates a splicing operation in the time dimension.

8. The EEG signal spike detection method based on KAN feature fusion according to claim 7, characterized in that: The specific steps in S4 include: S41, the obtained fusion features Use the multi-head self-attention mechanism to capture long-term dependencies. The formula is: Among them, the subscript Represents the first An attention head, represents the total amount of multi-head attention; is an activation function, Fusion features The three different embedding vectors generated by the mapping are, are the corresponding three different mapping matrices; (∙) indicates a splicing operation; is a learnable linear transformation coefficient matrix; Residual connection and normalization; Initial weight fusion features to be normalized and residual connections; is the initial weight fusion feature; S42, the obtained preliminary weight fusion features Through the learnable attention mechanism, the time dimension is fixed and compressed, the key time period is dynamically focused, and the final weighted fusion feature is finally obtained. , the formula is: in, is an activation function, Initial weight fusion feature The two different embedding vectors generated by the mapping, are the corresponding two different mapping matrices, To learn the query vector, we set the fixed dimension to To achieve the purpose of compressing the time dimension, back-propagation learning optimization can be used.

9. The EEG signal spike detection method based on KAN feature fusion according to claim 1, characterized in that: The specific steps in S5 include: The final output weight fusion feature Send it to the classifier to get the predicted probability of the final output of the model; Then, based on the predicted probability, the binary cross entropy loss function of the model is back-propagated to update the model parameters and train the model. The formula is: Among them, the subscript Represents the input model EEG data; Represents the prediction result output by the model, represents an activation function, represents a linear layer; represents the true label of the EEG data, represents the total number of EEG data samples, Represents the mean of the loss function of all samples in this model.

10. A detection system using the EEG signal spike detection method based on KAN feature fusion according to any one of claims 1 to 9, characterized in that: include: The data preprocessing module is used to preprocess and segment the EEG data sampled from epileptic patients during interictal periods to obtain training and test sets of segmented EEGs; The multi-KAN parallel feature extraction module is used to perform parallel feature extraction based on the KAN network of multiple basis functions according to the obtained training set, and then splice and reduce the dimension of the obtained multi-KAN parallel features to obtain hybrid features; The gated dynamic selection module is used to perform gated dynamic selection on the obtained mixed features to obtain the fusion features of the comprehensive multi-scale analysis of the EEG signal; The dual-attention temporal compression module is used to capture long-term dependencies using multi-head self-attention based on the dual-attention mechanism. It then uses learnable attention to compress the temporal dimension to focus on key time features, thereby obtaining weighted fusion features. The classification prediction module is used to input the obtained weighted fusion features into the classifier and train the prediction model based on the cross entropy loss function; The test evaluation module is used to evaluate the model performance using the test set and output the classification results.

Citation Information

Patent Citations

  • Epilepsy prediction method and device

    CN117752308A

  • Topological graph-based space-time multi-mode ratchet wave detection method

    CN118411366A