Focal seizure detection system based on ae anomaly detection and band selection

CN117297548BActive Publication Date: 2026-08-07HANGZHOU DIANZI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU DIANZI UNIV
Filing Date
2023-10-17
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]1.传统方法对提取出的特征的表征能力要求较高,分类器参数的优化过程通常比较复杂;

Benefits of technology

[0097]运用此种基于AE异常检测和频带选择的局灶性癫痫发作检测系统后,利用多通道脑电信号,使用’db4’的7层小波包分解得到对应5个子频带信号,采用单因素方差分析筛选出特定某一子频带信号。利用该频带信号的发作间期数据训练网络模型,AE模型对发作间期数据很好的重构,同时不能很好的重构发作期数据。从样本层面实现癫痫发作检测即发作间期与发作期二分类;同时在样本的通道层面,对局灶性癫痫发作起始过程,时间维度上连续的信号通道异常的检测。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117297548B_ABST
    Figure CN117297548B_ABST
Patent Text Reader

Abstract

The application discloses a focal seizure detection system based on AE anomaly detection and frequency band selection. Firstly, the original electroencephalogram signals of 18 channels are subjected to filtering, threshold preliminary screening and pretreatment operations, and after segmentation, 1s-long electroencephalogram signal segments are obtained; 5 sub-band signals are obtained by adopting wavelet packet decomposition. 11-dimensional features of the 5 sub-band waveforms are extracted, and single-factor variance analysis is adopted to select the frequency band of interest from the 5 sub-bands. Only the interictal data of the specific frequency band is used to train the convolutional autoencoder AE, the encoder encodes and decodes the signal to reconstruct the original signal; the corresponding anomaly score is calculated according to the reconstruction error, and the ictal sample and the interictal sample are distinguished. The channel of the focal seizure onset anomaly is described from the channel angle. Through wavelet packet decomposition and frequency band selection, the application combines the AE anomaly detection algorithm to achieve the effect of seizure detection, and can detect the starting abnormal channel of the focal seizure process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of electroencephalogram (EEG) signal processing and intelligent medical auxiliary analysis, and relates to a focal epileptic seizure detection system based on EEG abnormality detection and frequency band selection. It constructs a model for epileptic seizure detection and seizure initiation channel abnormality identification. Background Technology

[0002] Epilepsy is a common chronic neurological disorder and one of the most prevalent neurological diseases worldwide. Due to variations in the origin and propagation of abnormal electrical activity in the brain, the clinical manifestations of epilepsy are diverse and complex. Recurrent seizures can have a lasting negative impact on a patient's mental and cognitive functions, and may even be life-threatening. Research on the automatic identification of EEG signals during epileptic seizures can provide objective reference data for the diagnosis, treatment, and assessment of epilepsy, thereby reducing the workload of physicians and improving treatment efficiency. This research has significant theoretical and practical value.

[0003] Existing methods for detecting epileptic seizures can be divided into two sub-problems: feature extraction and classifier construction. The main approaches fall into two categories. Traditional methods primarily rely on the inherent features of the waveform itself, extracting time-domain, frequency-domain, time-frequency-domain, and nonlinear features of the EEG signal, and then using machine learning methods such as clustering and support vector machines to achieve binary classification for seizure detection. Deep learning methods, on the other hand, tend to design deep neural network classification models, directly using the raw EEG signal or several basic features as input to the deep neural network to achieve seizure detection. These detection methods often suffer from the following drawbacks:

[0004] 1. Traditional methods require high representational ability of the extracted features, and the optimization process of classifier parameters is usually quite complex;

[0005] 2. Deep learning models generally use fully connected neural networks or convolutional neural networks. However, due to the short duration of epileptic seizures and the imbalance between seizure data and interictal data, the model learns less information from the seizure data, resulting in a high data requirement for deep learning models.

[0006] To address these issues, based on the concept of AE (acute epilepsy) anomaly detection, this invention first constructs a reconstruction network model based on a convolutional autoencoder (AE). It then uses a 7-layer wavelet packet decomposition with 'db4' to reconstruct sub-signals in five frequency bands: δ, θ, α, β, and γ. Eleven-dimensional features are extracted from these five sub-bands, and one-way ANOVA is used to select the bands with strong discriminative power between the two signal types. The AE model is trained using only interictal data within these frequency bands. The model effectively reconstructs interictal data but not ictal data. This constructed AE seizure detection and analysis model overcomes the imbalance between seizure and interictal data by using only interictal data for training. Compared to existing methods, the proposed method has significant advantages in focal epilepsy seizure detection and seizure onset pathway abnormality identification. Summary of the Invention

[0007] This invention addresses the shortcomings of existing epileptic seizure detection methods by proposing a focal epileptic seizure detection system based on AE anomaly detection and frequency band selection. This invention enables network training using only interictal data, achieving binary classification of epileptic seizures at the sample level and identification of channel anomalies during the onset of focal epileptic seizures at the channel level.

[0008] The technical solution of this invention mainly includes the following steps:

[0009] Step 1: Preprocess the pre-labeled multi-channel EEG signal. The pre-labeling involves marking the start and end times of the epileptic seizure on the original multi-channel EEG signal. The preprocessing includes cascade filtering and threshold screening.

[0010] Step 2: Decompose the preprocessed EEG signal from Step 1 into wavelet packets to obtain 5 sub-bands with a frequency range of 0-62.5Hz. Segment the signals of the 5 sub-bands to obtain EEG signal segments with a length of 1s. Extract 11-dimensional features of the waveforms of the 5 sub-bands.

[0011] Step 3: Analyze the distribution of 11-dimensional features extracted in Step 2 in 5 sub-bands during the interictal and ictal periods. Use one-way ANOVA to select signal waveforms of specific frequency bands from the 5 sub-bands as input for the focal epilepsy seizure detection and analysis model.

[0012] Step 4: For the signal waveform of the specific frequency band obtained in Step 3, standardize the signal waveform and build a focal epilepsy seizure detection and analysis model based on AE anomaly detection. Only use the data of the interictal period for model learning to minimize the reconstruction loss of the model.

[0013] Step 5: Apply the focal epilepsy seizure detection and analysis model built in Step 4 to detect epileptic seizures and identify the abnormal pathways at the onset of focal epileptic seizures.

[0014] The specific implementation of step 1 is as follows:

[0015] First, the multi-channel EEG signals are bandpass filtered from 1 to 70 Hz to obtain the frequency band where the EEG energy signals are most concentrated. Then, a 50 Hz notch filter is used to filter and remove power frequency noise. After that, the signals are initially screened by thresholding to remove abnormal EEG data caused by electrode detachment or movement.

[0016] The specific implementation of step 2 is as follows:

[0017] 2-1 The pre-labeled EEG data at the onset and end of epileptic seizures were divided into interictal data and ictal data. The divided interictal data and ictal data were then continuously segmented without overlap, with each EEG signal segment being 1 second in length.

[0018] 128 frequency bands were obtained through 7-level 'db4' wavelet basis decomposition, from which 5 sub-bands with a frequency range of 0-62.5Hz were derived. The 'db4' wavelet has two functions: an adjustment function (low-pass filtering) and a wavelet function (high-pass filtering). The coefficients of the adjustment function and the wavelet function need to be established first, and then the sub-wavelets of the corresponding frequency bands can be reconstructed. The expression of the adjustment function at each level in the multi-scale analysis is as follows:

[0019]

[0020] Where N is the length of the db wavelet, (a0,...,a N-1 Let be a finite-length real number sequence, x be the signal, and φ(2x-k) be the Dobbesi formula, which is recursively used to calculate the adjustment function φ(x). Simultaneously, the wavelet function can also be a linear combination expression of the adjustment function:

[0021]

[0022] Where M is the length of the db wavelet, (b0,...,b M-1 Let φ(2x-k) be a finite-length real number sequence, x be a signal, and φ(2x-k) be the Daubechies formula, recursively used to calculate the wavelet function ψ(x). Commonly used wavelet bases, Daubechies Wavelets, range from db2 to db20. Since the vanishing momentum of the db wavelet is finite, the adjustment function and the wavelet function can represent a finite-length polynomial.

[0023] a[n]=a n (3)

[0024] The above equation, after Z-transformation, yields the following expression:

[0025] A(Z) = a0 + a1Z + ... + a N-1 Z N-1 (4)

[0026] The above equation can be converted into the general expression for orthogonal discrete wavelet transform:

[0027] a(Z)=2 1-A (1+Z) A p(Z),order=A (5)

[0028] At this point, p(Z) is a symmetric Lorenz polynomial, p(1) = 1, p has real coefficients and deg(p) = A-1, where A is the value of vanishing momentum.

[0029] The original multichannel EEG signal was reconstructed by 7 layers of 'db4' wavelet basis decomposition to obtain 5 sub-signals with a length of 1s each for δ, θ, α, β, and γ sub-bands;

[0030] 2-2 The mean, kurtosis, skewness, waveform factor, peak factor, impulse factor, margin factor, gap factor, approximate entropy, sample entropy, and fuzzy entropy of the absolute amplitude of the EEG signal segments during the interictal and ictal periods of the five sub-bands are calculated respectively; a total of 11 features are extracted from the signals of the five sub-bands respectively.

[0031] Assume the original sample is x, (f = 1, 2, 3, 4, 5; i = 1, 2, ..., N) represents the data of the EEG signal segment obtained by wavelet packet decomposition, where f represents the corresponding frequency band and N represents the data length;

[0032] (1) Calculate the mean value of the absolute values ​​of the amplitudes using the following formula:

[0033]

[0034] In the formula, mean represents the average value;

[0035] (2) Calculate the kurtosis KF using the following formula:

[0036]

[0037] In the formula, μ represents the mean of all data in the signal segment, and σ represents the variance of all data in the signal segment;

[0038] (3) Calculate the skewness SK using the following formula:

[0039]

[0040] In the formula, μ represents the mean of all data in the signal segment, and σ represents the variance of all data in the signal segment;

[0041] (4) The waveform factor SF is calculated using the following formula:

[0042]

[0043] In the formula, RMS represents the effective value of all data in the signal segment;

[0044] (5) The peak factor PF is calculated using the following formula:

[0045]

[0046] In the formula, Peak represents the peak value of all data in the calculated signal segment, and RMS represents the effective value of all data in the calculated signal segment;

[0047] (6) The pulse factor PUF is calculated using the following formula:

[0048]

[0049] In the formula, Peak represents the peak value of all data in the signal segment, and mean represents the average value of all data in the signal segment.

[0050] (7) Calculate the margin factor MF using the following formula:

[0051]

[0052] In the formula, Peak represents the peak value of all data in the calculated signal segment;

[0053] (8) Calculate the clearance factor CF using the following formula:

[0054]

[0055] In the formula, Peak represents the peak value of all data in the calculated signal segment, and RMS represents the effective value of all data in the calculated signal segment;

[0056] (9) Calculate the approximate entropy Apen using the following formula:

[0057]

[0058]

[0059]

[0060] In the formula, m represents the length of the window, which divides the time series into N-m+1 sequences, r represents the 'similarity' metric, N represents the length of the data, and d[x(i),x(j)] represents the distance between sequences x(i) and x(j).

[0061] (10) Calculate the sample entropy Sampen using the following formula:

[0062]

[0063]

[0064]

[0065] In the formula, m represents the length of the window, dividing the time series into N-m+1 sequences, r represents the 'similarity' metric, and N represents the length of the data. This represents the ratio of the number of rows in each vector that are greater than the threshold F (F = r * SD, where SD represents the standard deviation of the sequence) to the total number of rows excluding themselves, nm.

[0066] (11) Calculate the fuzzy entropy using the following formula:

[0067] Fuzzyen(m,r,N)=lnφ m,r,n -lnφ m+1,r,n (20)

[0068]

[0069]

[0070]

[0071] In the formula, m represents the length of the window, dividing the time series into N-m+1 sequences, r represents the 'similarity' metric, and N represents the length of the data. represents the fuzzy membership degrees calculated for window lengths m and m+1, respectively, n is the fuzzy coefficient, and d[x(i),x(j)] represents the distance between sequences x(i) and x(j).

[0072] Furthermore, the specific implementation of step 3 is as follows:

[0073] Eleven-dimensional features were extracted from all samples of signals in five sub-bands during the ictal and interictal periods, forming a T*11 dimensional feature matrix X, where T is the number of samples. Based on the feature matrix X, the 11-dimensional feature distributions of the ictal and interictal periods in the five sub-bands were analyzed. Through one-way ANOVA, the five sub-bands of the 11 features were voted on, and the frequency band with differences between the interictal and ictal samples was finally determined to be the γ band.

[0074] Furthermore, the specific implementation of step 4 is as follows:

[0075] 4-1 The waveform signal of the γ band is obtained through frequency band filtering in step 3. The interictal data of the γ band is randomly divided into training set, validation set and test set according to 8:1:1; the ictal data are all used as test set.

[0076] 4-2 Calculate the mean μ and variance σ of sample x using the training set data partitioned in 4-1; standardize the data using the following expression:

[0077]

[0078] 4-3 Autoencoder (AE) includes encoding and decoding. The input signal is encoded, and the features are mapped to the hidden layer space. Then the decoder decodes the features in the hidden layer space to obtain the reconstructed input sample.

[0079] (1) The process of compressing and reducing the dimensionality of a feature during the encoding stage:

[0080] z = Encoder(x) (25)

[0081] (2) The decoding stage is the process of restoring and reconstructing the original input from the features of the hidden layer:

[0082]

[0083] (3) The encoding process uses a structure of multiple CovBlocks + DownSamples connected together to reduce the dimensionality of the input signal; the decoding process uses a structure of multiple CovBlocks + UpSamples connected together to complete the reconstruction process. The CovBlock, DownSample, and UpSample structures are as follows:

[0084] (Conv1d+BN(Batch Normalization))*2+LeakyReLU

[0085] Conv1d+BN(Batch Normalization)+LeakyReLU

[0086] ConvTranspose1d+BN(Batch Normalization)+LeakyReLU

[0087] (4) The focal epilepsy seizure detection and analysis model was trained using only the data of the interictal period in the γ band, so that the model could reconstruct the data of the interictal period in the γ band well and minimize its reconstruction error. The expression for its reconstruction error is as follows:

[0088] ||xd φ (e θ (x))|| 2 (27)

[0089] In the formula e θ ,d Φ Indicates the encoding and decoding process;

[0090] A focal epilepsy seizure detection and analysis model was trained using interictal training data in the gamma band. The validation set ensured the convergence of the loss function, yielding the optimal weight parameters. This led to the construction of an optimal focal epilepsy seizure detection and analysis model.

[0091] Furthermore, step 5 is implemented as follows:

[0092] 5-1 Input the γ band test data into the trained focal epilepsy seizure detection and analysis model to obtain the reconstruction error of the EEG signal segment of the test data. The abnormal score of the EEG signal segment of the γ band test data includes the abnormal score of the interictal signal and the abnormal score of the ictal signal.

[0093] 5-2 Because the training process of the focal epilepsy seizure detection and analysis model only uses interictal data, at the sample level, the model can reconstruct the interictal data well, and the reconstruction error value corresponding to each interictal sample is less than the set abnormality score. However, the ictal data has a more complex waveform than the interictal data, and the model cannot reconstruct the ictal data well, with a corresponding reconstruction error value greater than the set abnormality score. The two types of samples are distinguished based on the reconstruction error value. At the channel level, the corresponding reconstruction error value is output for the data in each channel of each sample, resulting in an 18-dimensional reconstruction vector for each sample. Since the onset of a focal epilepsy seizure is caused by abnormal discharge in a local brain region, some channels exhibit abnormal characteristics during the seizure initiation stage. Therefore, for the obtained 18-dimensional reconstruction vector, the reconstruction error corresponding to the abnormal channel at the seizure initiation is greater than the set abnormality score, while the reconstruction error value of the remaining channels is less than the set abnormality score, thus characterizing the abnormal channels during the seizure initiation process.

[0094] 5-3 Statistical analysis of four basic parameters: true positive, true negative, false positive, and false negative. True positive is the number of seizure samples in the correctly identified samples; true negative is the number of interictal samples in the correctly identified samples; false positive is the number of interictal samples in the incorrectly identified samples; and false negative is the number of seizure samples in the incorrectly identified samples.

[0095] 5-4 The effectiveness of the focal epilepsy seizure detection and analysis model was verified based on the four basic parameters obtained.

[0096] The beneficial effects of this invention are as follows:

[0097] This focal epilepsy seizure detection system, based on AE anomaly detection and frequency band selection, utilizes multi-channel EEG signals and employs 7-layer wavelet packet decomposition (db4) to obtain five corresponding sub-frequency band signals. One-way ANOVA is then used to select a specific sub-frequency band signal. A network model is trained using interictal data from this frequency band signal. The AE model reconstructs the interictal data well but not the ictal data. This achieves epilepsy seizure detection at the sample level, i.e., binary classification of interictal and ictal periods; simultaneously, at the channel level, it detects continuous signal channel abnormalities in the temporal dimension during the onset of focal epilepsy seizures.

[0098] This invention trains a convolutional autoencoder (AE) using only interictal data from a specific frequency band. The encoder encodes and decodes the signal to reconstruct the original signal. The model can reconstruct interictal data well, but not ictal data well. Therefore, anomaly scores are calculated based on the reconstruction error to distinguish between ictal and interictal samples. Furthermore, it characterizes the channels of focal epileptic seizure initiation abnormalities from a channel perspective. This invention achieves epileptic seizure detection by combining wavelet packet decomposition and frequency band selection with an AE anomaly detection algorithm, and simultaneously detects abnormal channels at the initiation of focal epileptic seizures. Therefore, this invention overcomes the problem of imbalance between interictal and ictal data, realizing the detection of focal epileptic seizures and the identification of abnormal channels during seizure initiation. Attached Figure Description

[0099] Figure 1 Flowchart of the method of this invention;

[0100] Figure 2 An illustration of the effect of identifying abnormal channels at the onset of focal epileptic seizures in an embodiment of the present invention. Detailed Implementation

[0101] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.

[0102] like Figure 1 As shown, the implementation steps of the focal epilepsy seizure detection system based on AE anomaly detection and frequency band selection have been described in detail in the invention content. That is, the technical solution of the present invention mainly includes the following steps:

[0103] Step 1: Preprocess the pre-labeled multi-channel EEG signal. The pre-labeling involves marking the start and end times of the epileptic seizure on the original multi-channel EEG signal. The preprocessing includes cascade filtering and threshold screening.

[0104] Step 2: Decompose the preprocessed EEG signal from Step 1 into wavelet packets to obtain 5 sub-bands with a frequency range of 0-62.5Hz. Segment the signals of the 5 sub-bands to obtain EEG signal segments with a length of 1s. Extract 11-dimensional features of the waveforms of the 5 sub-bands.

[0105] Step 3: Analyze the distribution of 11-dimensional features extracted in Step 2 in 5 sub-bands during the interictal and ictal periods. Use one-way ANOVA to select signal waveforms of specific frequency bands from the 5 sub-bands as input for the focal epilepsy seizure detection and analysis model.

[0106] Step 4: For the signal waveform of the specific frequency band obtained in Step 3, standardize the signal waveform and build a focal epilepsy seizure detection and analysis model based on AE anomaly detection. Only use the data of the interictal period for model learning to minimize the reconstruction loss of the model.

[0107] Step 5: Apply the focal epilepsy seizure detection and analysis model built in Step 4 to detect epileptic seizures and identify the abnormal pathways at the onset of focal epileptic seizures.

[0108] The specific implementation of step 1 is as follows:

[0109] First, the multi-channel EEG signals are bandpass filtered from 1 to 70 Hz to obtain the frequency band where the EEG energy signals are most concentrated. Then, a 50 Hz notch filter is used to filter and remove power frequency noise. After that, the signals are initially screened by thresholding to remove abnormal EEG data caused by electrode detachment or movement.

[0110] The specific implementation of step 2 is as follows:

[0111] 2-1 The pre-labeled EEG data at the onset and end of epileptic seizures were divided into interictal data and ictal data. The divided interictal data and ictal data were then continuously segmented without overlap, with each EEG signal segment being 1 second in length.

[0112] 128 frequency bands were obtained through 7-level 'db4' wavelet basis decomposition, from which 5 sub-bands with a frequency range of 0-62.5Hz were derived. The 'db4' wavelet has two functions: an adjustment function (low-pass filtering) and a wavelet function (high-pass filtering). The coefficients of the adjustment function and the wavelet function need to be established first, and then the sub-wavelets of the corresponding frequency bands can be reconstructed. The expression of the adjustment function at each level in the multi-scale analysis is as follows:

[0113]

[0114] Where N is the length of the db wavelet, (a0,...,a N-1Let be a finite-length real number sequence, x be the signal, and φ(2x-k) be the Dobbesi formula, which is recursively used to calculate the adjustment function φ(x). Simultaneously, the wavelet function can also be a linear combination expression of the adjustment function:

[0115]

[0116] Where M is the length of the db wavelet, (b0,...,b M-1 Let φ(2x-k) be a finite-length real number sequence, x be a signal, and φ(2x-k) be the Daubechies formula, recursively used to calculate the wavelet function ψ(x). Commonly used wavelet bases, Daubechies Wavelets, range from db2 to db20. Since the vanishing momentum of the db wavelet is finite, the adjustment function and the wavelet function can represent a finite-length polynomial.

[0117] a[n]=a n (3)

[0118] The above equation, after Z-transformation, yields the following expression:

[0119] A(Z) = a0 + a1Z + ... + a N-1 Z N-1 (4)

[0120] The above equation can be converted into the general expression for orthogonal discrete wavelet transform:

[0121] a(Z)=2 1-A (1+Z) A p(Z),order=A (5)

[0122] At this point, p(Z) is a symmetric Lorenz polynomial, p(1) = 1, p has real coefficients and deg(p) = A-1, where A is the value of vanishing momentum.

[0123] The original multichannel EEG signal was reconstructed by 7 layers of 'db4' wavelet basis decomposition to obtain 5 sub-signals with a length of 1s each for δ, θ, α, β, and γ sub-bands;

[0124] 2-2 The mean, kurtosis (KF), skewness, waveform factor, peak factor, impulse factor, margin factor, gap factor, approximate entropy, sample entropy, and fuzzy entropy of the absolute amplitude of the EEG signal segments during the interictal and ictal periods of the five sub-bands are calculated respectively. These 11 features are extracted from the signals of the five sub-bands respectively.

[0125] Assume the original sample is x, (f = 1, 2, 3, 4, 5; i = 1, 2, ..., N) represents the data of the EEG signal segment obtained by wavelet packet decomposition, where f represents the corresponding frequency band and N represents the data length;

[0126] (1) Calculate the mean value of the absolute values ​​of the amplitudes using the following formula:

[0127]

[0128] In the formula, mean represents the average value;

[0129] (2) Calculate the kurtosis KF using the following formula:

[0130]

[0131] In the formula, μ represents the mean of all data in the signal segment, and σ represents the variance of all data in the signal segment;

[0132] (3) Calculate the skewness SK using the following formula:

[0133]

[0134] In the formula, μ represents the mean of all data in the signal segment, and σ represents the variance of all data in the signal segment;

[0135] (4) The waveform factor SF is calculated using the following formula:

[0136]

[0137] In the formula, RMS represents the effective value of all data in the signal segment;

[0138] (5) The peak factor PF is calculated using the following formula:

[0139]

[0140] In the formula, Peak represents the peak value of all data in the calculated signal segment, and RMS represents the effective value of all data in the calculated signal segment;

[0141] (6) The pulse factor PUF is calculated using the following formula:

[0142]

[0143] In the formula, Peak represents the peak value of all data in the signal segment, and mean represents the average value of all data in the signal segment.

[0144] (7) Calculate the margin factor MF using the following formula:

[0145]

[0146] In the formula, Peak represents the peak value of all data in the calculated signal segment;

[0147] (8) Calculate the clearance factor CF using the following formula:

[0148]

[0149] In the formula, Peak represents the peak value of all data in the calculated signal segment, and RMS represents the effective value of all data in the calculated signal segment;

[0150] (9) Calculate the approximate entropy Apen using the following formula:

[0151]

[0152]

[0153]

[0154] In the formula, m represents the length of the window, which divides the time series into N-m+1 sequences, r represents the 'similarity' metric, N represents the length of the data, and d[x(i),x(j)] represents the distance between sequences x(i) and x(j).

[0155] (10) Calculate the sample entropy Sampen using the following formula:

[0156]

[0157]

[0158]

[0159] In the formula, m represents the length of the window, dividing the time series into N-m+1 sequences, r represents the 'similarity' metric, and N represents the length of the data. This represents the ratio of the number of rows in each vector that are greater than the threshold F (F = r * SD, where SD represents the standard deviation of the sequence) to the total number of rows excluding themselves, nm.

[0160] (11) Calculate the fuzzy entropy using the following formula:

[0161] Fuzzyen(m,r,N)=lnφ m,r,n -lnφ m+1,r,n (20)

[0162]

[0163]

[0164]

[0165] In the formula, m represents the length of the window, dividing the time series into N-m+1 sequences, r represents the 'similarity' metric, and N represents the length of the data. Let represent the fuzzy membership degrees calculated for window lengths m and m+1, respectively, where n is the fuzzy coefficient, and d[x(i),x(j)] represents the distance between sequences x(i) and x(j).

[0166] The specific implementation of step 3 is as follows:

[0167] Eleven-dimensional features were extracted from all samples of signals in five sub-bands during the ictal and interictal periods, forming a T*11 dimensional feature matrix X, where T is the number of samples. Based on the feature matrix X, the 11-dimensional feature distributions of the ictal and interictal periods in the five sub-bands were analyzed. Through one-way ANOVA, the five sub-bands of the 11 features were voted on, and the frequency band with differences between the interictal and ictal samples was finally determined to be the γ band.

[0168] The specific implementation of step 4 is as follows:

[0169] 4-1 The waveform signal of the γ band is obtained through frequency band filtering in step 3. The interictal data of the γ band is randomly divided into training set, validation set and test set according to 8:1:1; the ictal data are all used as test set.

[0170] 4-2 Calculate the mean μ and variance σ of sample x using the training set data partitioned in 4-1; standardize the data using the following expression:

[0171]

[0172] 4-3 Autoencoder (AE) includes encoding and decoding. The input signal is encoded, and the features are mapped to the hidden layer space. Then the decoder decodes the features in the hidden layer space to obtain the reconstructed input sample.

[0173] (1) The process of compressing and reducing the dimensionality of a feature during the encoding stage:

[0174] z = Encoder(x) (25)

[0175] (2) The decoding stage is the process of restoring and reconstructing the original input from the features of the hidden layer:

[0176]

[0177] (3) The encoding process uses a structure of multiple CovBlocks + DownSamples connected together to reduce the dimensionality of the input signal; the decoding process uses a structure of multiple CovBlocks + UpSamples connected together to complete the reconstruction process. The CovBlock, DownSample, and UpSample structures are as follows:

[0178] (Conv1d+BN(Batch Normalization))*2+LeakyReLU

[0179] Conv1d+BN(Batch Normalization)+LeakyReLU

[0180] ConvTranspose1d+BN(Batch Normalization)+LeakyReLU

[0181] (4) The focal epilepsy seizure detection and analysis model was trained using only the data of the interictal period in the γ band, so that the model could reconstruct the data of the interictal period in the γ band well and minimize its reconstruction error. The expression for its reconstruction error is as follows:

[0182] ||xd φ (e θ (x))|| 2 (27)

[0183] In the formula e θ ,d Φ Indicates the encoding and decoding process;

[0184] A focal epilepsy seizure detection and analysis model was trained using interictal training data in the gamma band. The validation set ensured the convergence of the loss function, yielding the optimal weight parameters. This led to the construction of an optimal focal epilepsy seizure detection and analysis model.

[0185] The specific implementation of step 5 is as follows:

[0186] 5-1 Input the γ band test data into the trained focal epilepsy seizure detection and analysis model to obtain the reconstruction error of the EEG signal segment of the test data. The abnormal score of the EEG signal segment of the γ band test data includes the abnormal score of the interictal signal and the abnormal score of the ictal signal.

[0187] 5-2 Because the training process of the focal epilepsy seizure detection and analysis model only uses interictal data, at the sample level, the model can reconstruct the interictal data well, and the reconstruction error value corresponding to each interictal sample is less than the set abnormality score. However, the ictal data has a more complex waveform than the interictal data, and the model cannot reconstruct the ictal data well, with a corresponding reconstruction error value greater than the set abnormality score. The two types of samples are distinguished based on the reconstruction error value. At the channel level, the corresponding reconstruction error value is output for the data in each channel of each sample, resulting in an 18-dimensional reconstruction vector for each sample. Since the onset of a focal epilepsy seizure is caused by abnormal discharge in a local brain region, some channels exhibit abnormal characteristics during the seizure initiation stage. Therefore, for the obtained 18-dimensional reconstruction vector, the reconstruction error corresponding to the abnormal channel at the seizure initiation is greater than the set abnormality score, while the reconstruction error value of the remaining channels is less than the set abnormality score, thus characterizing the abnormal channels during the seizure initiation process.

[0188] Figure 2 This is a diagram illustrating the effect of identifying abnormal channels at the onset of focal epileptic seizures according to an embodiment of the present invention.

[0189] In step 2-1, 1 second is selected as the length of a sample because the identification of the abnormal channel for the onset of focal epileptic seizures is sensitive to time. The seizure period data and interictal period data mentioned in this patent are based on the onset and end times of epileptic seizures in the original signals, which have been marked by professional physicians.

[0190] To realistically test the effectiveness of this invention in detecting focal epileptic seizures and identifying channel abnormalities, a comparative experiment was conducted with several mainstream detection algorithms on EEG data from real patients with focal epileptic seizures at the Children's Hospital Affiliated to Zhejiang University School of Medicine:

[0191] The experimental data consisted of 18 channels with a sampling frequency of 1000 Hz, and included 18 individual datasets of patients with different focal epilepsy. The DCGAN-based generative adversarial network proposed by Sungmin You et al. in 2020 achieved an AUC of 80.64%, precision of 89.04%, F1 score of 78.10%, and sensitivity of 69.55% on the 18-channel raw EEG dataset. The VAE-based variational autoencoder proposed by Ilkay Yildiz et al. in 2021 achieved an AUC of 85.38%, precision of 88.82%, F1 score of 84.84%, and sensitivity of 81.20% on the same dataset. The proposed focal epileptic seizure detection method based on AE anomaly detection and frequency band selection achieves an AUC of 88.59%, precision of 89.49%, F1 score of 87.81%, and sensitivity of 86.82% on an 18-channel raw EEG dataset. After frequency band selection, the AUC on an 18-channel gamma band dataset is 94.96%, precision is 94.33%, F1 score is 91.85%, and sensitivity is 89.51%. After frequency band selection, compared to the original 18-channel dataset, the AUC is improved by 6.37%, precision by 5.19%, sensitivity by 3.31%, and F1 score by 4.04%. This demonstrates the advantages of this invention over current epileptic seizure detection methods based on anomaly detection in real-world data.

[0192] In summary, the focal epileptic seizure detection method based on AE anomaly detection and frequency band selection in this invention overcomes the problem of imbalance between interictal and ictal data by using wavelet packet decomposition and sub-frequency band screening, and reconstructing the autoencoded AE, thereby realizing the detection of focal epileptic seizures and the identification of abnormal channels in the seizure initiation process.

Claims

1. A focal epileptic seizure detection system based on AE anomaly detection and frequency band selection, characterized in that, The implementation of this system includes the following steps: Step 1: Preprocess the pre-labeled multi-channel EEG signal. The pre-labeling involves marking the start and end times of the epileptic seizure on the original multi-channel EEG signal. The preprocessing includes cascade filtering and threshold screening. Step 2: Decompose the preprocessed EEG signal from Step 1 into wavelet packets to obtain 5 sub-bands with a frequency range of 0-62.5Hz. Segment the signals of the 5 sub-bands to obtain EEG signal segments with a length of 1s. Extract 11-dimensional features of the waveforms of the 5 sub-bands. Step 3: Analyze the distribution of 11-dimensional features extracted in Step 2 in 5 sub-bands during the interictal and ictal periods. Use one-way ANOVA to select signal waveforms of specific frequency bands from the 5 sub-bands as input for the focal epilepsy seizure detection and analysis model. The specific implementation is as follows: For all samples of signals from 5 sub-bands during the ictal and interictal periods, 11-dimensional features were extracted and a T*11-dimensional feature matrix X was constructed, where T is the number of samples. Based on the feature matrix X, the 11-dimensional feature distribution of the ictal and interictal periods in the 5 sub-bands was analyzed. Through one-way ANOVA, the 5 sub-bands of the 11 features were voted on, and the frequency band with differences between the interictal and ictal samples was finally determined to be the γ band. Step 4: For the signal waveform of the specific frequency band obtained in Step 3, standardize the signal waveform and build a focal epilepsy seizure detection and analysis model based on AE anomaly detection. Only use the data of the interictal period for model learning to minimize the reconstruction loss of the model. The specific implementation is as follows: 4-1 Obtained through frequency band filtering in step 3 γ The waveform signal of the frequency band will γ Interictal data of the frequency band were randomly divided into training, validation and test sets in a ratio of 8:1:1; ictal data were used as the test set. 4-2 Calculate the mean μ and variance σ of sample x using the training set data partitioned in 4-1; standardize the data using the following expression: (24) 4-3 Autoencoder (AE) includes encoding and decoding. The input signal is encoded, and the features are mapped to the hidden layer space. Then the decoder decodes the features in the hidden layer space to obtain the reconstructed input sample. (1) The process of compressing and reducing the dimensionality of a feature during the encoding stage: (25) (2) The decoding stage is the process of restoring and reconstructing the original input from the features of the hidden layer: (26) (3) The encoding process uses a structure of multiple CovBlocks + DownSamples connected together to reduce the dimensionality of the input signal; the decoding process uses a structure of multiple CovBlocks + UpSamples connected together to complete the reconstruction process; the CovBlock, DownSample, and UpSample structures are as follows: (Conv1d+BN(Batch Normalization))*2+LeakyReLU Conv1d+BN (Batch Normalization) + LeakyReLU ConvTranspose1d+BN (Batch Normalization) + LeakyReLU (4) The focal epilepsy seizure detection and analysis model is trained using only the data of the interictal period in the γ band, so that the model can reconstruct the data of the interictal period in the γ band well and make its reconstruction error as small as possible. The expression of its reconstruction error is as follows: (27) In the formula , Indicates the encoding and decoding process; By training a focal epilepsy seizure detection and analysis model using interictal training data in the γ-band, and using a validation set to ensure the convergence of the loss function, the optimal weight parameters are obtained; thus, the optimal focal epilepsy seizure detection and analysis model is constructed. Step 5: Apply the focal epilepsy seizure detection and analysis model built in Step 4 to detect epileptic seizures and identify the abnormal initiation pathway of the focal epilepsy seizure process.

2. The focal epileptic seizure detection system based on AE anomaly detection and frequency band selection according to claim 1, characterized in that, The specific implementation of step 1 is as follows: First, the multi-channel EEG signals are bandpass filtered from 1 to 70 Hz to obtain the frequency band where the EEG energy signals are most concentrated. Then, a 50 Hz notch filter is used to filter and remove power frequency noise. After that, the signals are initially screened by thresholding to remove abnormal EEG data caused by electrode detachment or movement.

3. The focal epileptic seizure detection system based on AE anomaly detection and frequency band selection according to claim 2, characterized in that, The specific implementation of step 2 is as follows: 2-1 The pre-labeled EEG data at the onset and end of epileptic seizures were divided into interictal data and ictal data. The divided interictal data and ictal data were then continuously segmented without overlap, with each EEG signal segment being 1 second in length. 128 frequency bands were obtained by using a 7-layer 'db4' wavelet basis decomposition, from which 5 sub-bands with a frequency range of 0-62.5Hz were derived. The 'db4' wavelet has two functions: an adjustment function and a wavelet function. The coefficients of the adjustment function and the wavelet function need to be established first, and then the sub-wavelets of the corresponding sub-bands need to be reconstructed. The expression of the adjustment function at each layer in the multi-scale analysis is as follows: (1) Where N is the length of the db wavelet, ( a 0,. . ., a N-1 () is a sequence of real numbers of finite length. x For signal, ϕ (2 x - k This is the Dobermann formula, recursively used to calculate the adjustment function. ϕ ( x Meanwhile, the wavelet function is also a linear combination expression of the adjustment function: (2) Where M is the length of the db wavelet, ( b 0,. . ., b M-1 () is a sequence of real numbers of finite length. x For signal, ϕ (2 x - k This is the Dobermann formula, recursively used to calculate wavelet functions. ψ ( x The commonly used wavelet basis, Daubechies, ranges from db2 to db20. Since the vanishing momentum of the db wavelet is finite, the adjustment function and wavelet function represent polynomials of finite length. (3) The above equation, after Z-transformation, yields the following expression: (4) The above equation can be converted into the general expression for orthogonal discrete wavelet transform: (5) at this time, p (Z) is a symmetric Lorenz polynomial. p (1)=1, p Real coefficients and deg ( p )= A -1, where A is the value of vanishing momentum; The original multichannel EEG signal was reconstructed by 7 layers of 'db4' wavelet basis decomposition to obtain 5 sub-signals with a length of 1s each for δ, θ, α, β, and γ sub-bands; 2-2 The mean, kurtosis, skewness, waveform factor, peak factor, impulse factor, margin factor, gap factor, approximate entropy, sample entropy, and fuzzy entropy of the absolute amplitude of the EEG signal segments during the interictal and ictal periods of the five sub-bands are calculated respectively; a total of 11 features are extracted from the signals of the five sub-bands respectively. Assuming the original sample is x , This represents data from EEG signal segments obtained through wavelet packet decomposition. f N represents the corresponding frequency band, and N represents the data length. (1) Calculate the mean value of the absolute values ​​of the amplitudes using the following formula: (6) In the formula, mean represents the average value; (2) Calculate the kurtosis KF using the following formula: (7) In the formula This represents the mean of all data in the signal segment. This represents the variance of all data in the signal segment; (3) Calculate the skewness SK using the following formula: (8) In the formula This represents the mean of all data in the signal segment. This represents the variance of all data in the signal segment; (4) Calculate the waveform factor SF using the following formula: (9) In the formula, RMS represents the effective value of all data in the signal segment; (5) Calculate the peak factor PEF using the following formula: (10) In the formula, Peak represents the peak value of all data in the calculated signal segment, and RMS represents the effective value of all data in the calculated signal segment; (6) Calculate the pulse factor PUF using the following formula: (11) In the formula, Peak represents the peak value of all data in the signal segment, and mean represents the average value of all data in the signal segment. (7) Calculate the margin factor MF using the following formula: (12) In the formula, Peak represents the peak value of all data in the calculated signal segment; (8) Calculate the gap factor CF using the following formula: (13) In the formula, Peak represents the peak value of all data in the calculated signal segment, and RMS represents the effective value of all data in the calculated signal segment; (9) Calculate the approximate entropy Apen using the following formula: (14) (15) (16) In the formula, m represents the length of the window, dividing the time series into N-m+1 sequences, r represents the 'similarity' metric, and N represents the length of the data. d [ x ( i ), x ( j ] represents a sequence x ( i )and x ( j The distance between them; (10) Calculate the sample entropy Sampen using the following formula: (17) (18) (19) In the formula, m represents the length of the window, dividing the time series into N-m+1 sequences, r represents the 'similarity' metric, and N represents the length of the data. , This represents the ratio of the number of rows in each vector that are greater than the threshold F to the total number of rows excluding themselves, nm, where F = r * SD, and SD represents the standard deviation of the sequence. (11) Calculate the fuzzy entropy Fuzzyen using the following formula: (20) (21) (22) (23) In the formula, m represents the length of the window, dividing the time series into N-m+1 sequences, r represents the 'similarity' metric, and N represents the length of the data. , Let represent the fuzzy membership degrees calculated for window lengths m and m+1, respectively, where n is the fuzzy coefficient. d [ x ( i ), x ( j ] represents a sequence x ( i )and x ( j The distance between them.

4. The focal epileptic seizure detection system based on AE anomaly detection and frequency band selection according to claim 3, characterized in that, The specific implementation of step 5 is as follows: 5-1 Input the γ-band test data into the trained focal epilepsy seizure detection and analysis model to obtain the reconstruction error of the EEG signal segment of the test data. The abnormal score of the EEG signal segment of the γ-band test data includes the abnormal score of the interictal signal and the abnormal score of the ictal signal. 5-2 Since the training process of the focal epilepsy seizure detection and analysis model only uses interictal data, at the sample level, the model can reconstruct the interictal data well, and the reconstruction error value corresponding to each interictal sample is less than the set abnormality score. However, the waveform of the ictal data is more complex than that of the interictal data, and the model cannot reconstruct the ictal data well, and the corresponding reconstruction error value is greater than the set abnormality score. The two types of samples are distinguished according to the reconstruction error value. At the channel level of the sample, the corresponding reconstruction error value is output for the data of each channel of each sample, that is, a 18-dimensional reconstruction vector is obtained for each sample. Since the onset of focal epilepsy seizures is caused by abnormal discharge in a local brain region, some channels have abnormal characteristics in the initial stage of the seizure. Therefore, for the obtained 18-dimensional reconstruction vector, the reconstruction error corresponding to the channel with the abnormality at the onset of the attack is greater than the set abnormality score, while the reconstruction error value of the remaining channels is less than the set abnormality score, thus depicting the channels with abnormalities during the onset of the attack. 5-3 Statistical analysis of four basic parameters: true positive, true negative, false positive, and false negative. True positive is the number of seizure samples in the correctly identified samples; true negative is the number of interictal samples in the correctly identified samples; false positive is the number of interictal samples in the incorrectly identified samples; and false negative is the number of seizure samples in the incorrectly identified samples. 5-4 The effectiveness of the focal epilepsy seizure detection and analysis model was verified based on the four basic parameters obtained.