An epilepsy signal detection method based on channel selection time convolution network
The epilepsy signal detection method, which selects EEG channels by MRMR and combines TCN and particle swarm optimization algorithms, solves the problems of low accuracy and high computational load in existing epilepsy detection technologies, and achieves automated epilepsy detection with high sensitivity and low false alarm rate.
Patent Information
- Application Number
- CN202310485488.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-28
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2043-04-28
AI Technical Summary
Existing epilepsy detection methods rely on visual inspection of long-term EEG, resulting in a large workload, results dependent on personal experience, and unbalanced ictal and non-ictal samples during model training, leading to high computational costs, loss of temporal information in frequency domain features, and inappropriate channel selection, resulting in low detection accuracy.
The MRMR method is used to select EEG channels, and the model is trained by combining it with a temporal convolutional network (TCN). The particle swarm optimization algorithm is used to optimize the Kalman filter for epilepsy signal detection. By combining time-domain and frequency-domain features, the problem of data imbalance is alleviated and the detection accuracy is improved.
It achieves high sensitivity and high accuracy in epileptic seizure detection, reduces computational load, is suitable for long-term EEG signal processing, and improves the performance of automated epilepsy detection.
Smart Images

Figure CN116584893B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of electroencephalogram deep learning, and particularly relates to an epilepsy signal detection method of a channel selection time convolution network. BACKGROUND
[0002] Epilepsy is a chronic brain dysfunction syndrome caused by various causes. About 500 million people in the world suffer from epilepsy, and epilepsy has become the second most common disease in neurology in China. The chronic brain dysfunction symptoms of epilepsy are long duration and repeated seizures, which is caused by abnormal physiological electrical activity of part of the brain tissue, leading to abnormal discharge between brain regions. Clinically, it may manifest as loss of consciousness, limb convulsions, behavioral disorders, and other secondary injuries such as falls, burns, and drowning, which pose a great threat to the safety of patients' lives. Patients who have long suffered from seizures may experience psychological trauma, greatly reducing the quality of life of patients. The current clinical detection of epilepsy mainly relies on visual detection of long-term electroencephalogram, which results in a large workload for medical staff and detection results that are highly dependent on personal experience and subjective consciousness. Therefore, automatic diagnosis of seizures has important clinical significance.
[0003] Electroencephalogram (EEG) can record the electrical activity of brain nerve cell groups, which contains a large amount of physiological and pathological information. EEG has the advantages of effectiveness and non-invasiveness. Currently, the identification of seizure and lesion localization is mainly observed by doctors' eyes, but in actual use, a short period of EEG recording may not be able to record seizures, so it is necessary to record the long-term EEG of patients for several hours or even several days. In addition, epilepsy is heterogeneous, and the EEG characteristics of different types of epilepsy are different. The above reasons make the identification of epilepsy time-consuming and laborious, and subjective. If the clinician's experience is insufficient, misjudgment may occur. Therefore, the automatic detection of seizures by using the difference between the EEG signals during the seizure and non-seizure periods has become the focus of many scientific researches, which can greatly reduce the workload of doctors and improve the accuracy and objectivity of epilepsy detection.
[0004] The patent application with the existing application number: CN201910967804.1 discloses a kind of epilepsy electroencephalogram prediction method based on convolution and recurrent neural network combination time multi-scale, according to the distance of seizure period far and near, it is divided into interval, pre-stage data for sliding window segmentation to N guide epilepsy patient electroencephalogram signal, and increase pre-stage sample, interval sample is not overlapped, then after pre-processing sample is carried out three layer wavelet packet decomposition, obtains eight frequency band wavelet coefficients, then reconstructs the time domain signal corresponding to frequency band, extract inter-electrode correlation coefficient as feature matrix and then input to convolution network, by the continuous fusion of convolution kernel to data to learn the high-level representation of data, to predict the electroencephalogram signal of epilepsy;There are the following shortcomings: first, there is no balance of seizure period and non-seizure period sample, which may cause the model to have preference for non-seizure period sample;Second, only frequency domain features are used during model training, and the high-level representation of time domain features is lost, which may cause the model training accuracy to be low;Third, no channel selection is performed, and all N guide epilepsy patient electroencephalogram signal data is used as the input of the model, the training time of the model is longer, and the hardware requirements for the computer are higher. SUMMARY
[0005] In order to overcome the defects of the above-mentioned prior art, the purpose of the present application is to provide a kind of epilepsy signal detection method based on channel selection time convolution network, the score of electroencephalogram channel can be calculated by Max-Relevance and Min-Redundancy (MRMR) calculation formula, and the electroencephalogram channel is sorted according to the score, and the most suitable electroencephalogram channel is selected according to the sorting, so as to complete the channel selection of electroencephalogram signal, the features of electroencephalogram signal after channel selection are used for model training using neural convolution network, the trained model first carries out seizure detection of epilepsy signal based on segment to select the optimal channel electroencephalogram data of patient, then the Kalman filter parameters are optimized using particle swarm optimization algorithm to carry out seizure detection of epilepsy signal based on event, with the advantages of high sensitivity, high accuracy and low false alarm rate, suitable for processing long-term, unbalanced electroencephalogram signal, effectively improving the performance of automatic detection of epilepsy.
[0006] To achieve the above-mentioned purpose, the technical scheme adopted by the present application is as follows:
[0007] A kind of epilepsy signal detection method of channel selection time convolution network, comprising the following steps:
[0008] Step one: obtain channel electroencephalogram data, and the electroencephalogram data is not preprocessed;
[0009] Step two: divide the data after labeling after Ts segmenting electroencephalogram data;
[0010] Step 3: Extract features from EEG data. Extract time-domain and frequency-domain features from the EEG signals of epileptic patients during seizures and non-seizures, and then perform z-score standardization.
[0011] Step 4: Calculate the MRMR of the features after z-score standardization, score and rank the EEG channels, and select the top-ranked EEG channels to complete the channel selection.
[0012] Step 5: Input the data after channel selection into the TCN network for model training by merging S segments. First, use segment-based epileptic seizure signal detection to obtain the optimal channel of EEG data, and then use event-based epileptic seizure signal detection to detect and analyze the EEG data of the optimal channel.
[0013] Step 6: Use the particle swarm optimization algorithm to find the optimal comprehensive index SF corresponding to the seizure detection limit, detection threshold and seizure shielding time. Perform Kalman filtering on the results obtained from the event-based epileptic seizure signal detection. Finally, evaluate the results after Kalman filtering.
[0014] Each EEG data acquired in step one contains multiple EDF files, and each EDF file can contain EEG signals for a relatively long period, including 1 hour, 2 hours, and 4 hours. The EEG signal contains n EEG channels, and the electrode positions follow the 10-20 international standard lead system. The acquisition duration is t, the number of acquisition groups is I, the number of channels is n, the sampling frequency is f, and the acquired EEG data is represented as X(t) = {x1(t), x2(t), ..., x...} n (t)}, where n represents the number of EEG data channels, t represents the acquisition time of the EEG data, and x n (t) represents the EEG data of the nth channel, which is a continuous time series.
[0015] Step two specifically involves:
[0016] 2.1. The EEG data is segmented and labeled by Ts. The collected EEG data is X(t) = {x1(t), x2(t), ..., x...} n After completing the T s segmentation and labeling operation, it is represented as X(i)={x1(i), x2(i), …, x n (i)}, transforming continuous time-series data into a discrete sequence, where i represents the number of segments in the EEG data, n represents the number of channels in the EEG data, and x n (i) represents the EEG data of the nth channel, which is a discrete sequence;
[0017] 2.2, according to the requirements of the time convolution network (TCN) for the input time series in data division, use 10*T s sliding time window to sample all the preliminary division fragments, that is, X(i)={x1(i), x2(i), …, x n (i)} to divide the onset period data by T / 2s overlap;
[0018] The specific operation mode of the onset period data T / 2s overlap is: if the current sample is a non-onset sample, slide 10 fragments forward; if the current sample is an onset sample, slide 1 fragment forward, until the time window cannot obtain complete 10 fragments to stop sample division, and discard the last less than 10 fragments.
[0019] The specific process of feature extraction in step three, that is, time domain and frequency domain feature extraction of X(i)={x1(i), x2(i), …, x n (i)} fragments, which are used as the input of the classifier, including A time domain features and five frequency domain features, and each TsEEG signal in X(i)={x1(i), x2(i), …, x n (i)} fragments is labeled with time label and seizure label, and the seizure time label is "1" and the non-seizure label is "0".
[0020] The extraction of time domain features in step three extracts A statistical parameters of X(i)={x1(i), x2(i), …, x n (i)} fragments, calculates the maximum value, minimum value, median value, average value, standard deviation, variance, mean absolute deviation, root mean square, skewness and kurtosis of each TsEEG signal; wherein The average value of one segment Ts EEG signal x n (i) of each channel electroencephalogram data in X(i)={x1(i), x2(i), …, x n (i), i is the segment number, n is the channel number, and N is the number of collected electroencephalogram data in x n (i), I is the total number of TsEEG signal segments, and when the collected electroencephalogram signal frequency f is 256 Hz, the value of N is 512.
[0021] The five frequency domain features in step three are extracted by using wavelet decomposition principle to process the brain electrical data in frequency band and extract five typical brain electrical signal bands in the brain electrical signal, i.e. δ wave, θ wave, α wave, β wave and γ wave; wherein, A is the detail part coefficient, D is the approximate part coefficient; D1 and D2 correspond to the γ wave band after reconstruction, the γ wave band > 32 Hz, D3 corresponds to the β wave band, the β wave band = 12-32 Hz, D4 corresponds to the α wave band after reconstruction, the wave band = 8-12 Hz, D5 corresponds to the θ wave band after reconstruction, the θ wave band = 4-8 Hz, and A5 corresponds to the δ wave band after reconstruction, the δ wave band = 0.5-4 Hz; in order to extract the above wave band signals by using wavelet transform, according to the principle of wavelet decomposition, when the frequency of the signal is 256 Hz, five-layer decomposition of the wavelet is carried out, so that the target frequency band is obtained; the wavelet decomposition is carried out on each Ts EEG signal, and the energy of the above five frequency bands is extracted as the frequency domain feature used in the subsequent operation; after the feature extraction, x n (i) becomes a sequence containing multiple features with A time domain features, five frequency domain features, time labels and seizure labels after feature extraction, and is represented as: x n (i) = {[x 11 , x 12 , …, x 1k ], … [x c1 , x c2 , …, x ck ], [1, 2, …, I], [0, 1, …, 0]}; each feature vector in xn(i) after the feature extraction is subjected to z score standardization.
[0022] The frequency domain features in step three are subjected to z score standardization, and the formula of z score standardization is:
[0023]
[0024] In the step four, the MRMR is calculated for the z score standardized features to score and sort the brain electrical channels, wherein the MRMR used is a filter type feature selection method based on mutual information, and an incremental search is used to select the features so as to maximize the correlation between the features and the categories and minimize the redundancy between the features; in order to select the channels, A+5 features of each channel are changed into one dimension, and then the MRMR score calculation and the brain electrical channel selection are carried out, and the mutual information is calculated before the MRMR is solved, and the formula of calculating the mutual information is:
[0025]
[0026] Wherein, P(x, y) is the joint probability distribution function of X and Y, and P(x) and P(y) are the marginal probability distribution functions of X and Y, respectively.
[0027] The correlation degree is calculated by calculating the mutual information of the electroencephalogram channel feature and the corresponding category, and the calculation formula of the correlation degree is:
[0028]
[0029] Wherein, S i represents the channel feature, |S| represents the number of channels, f i is the independent variable of the channel feature, and c is the category corresponding to the channel data, i.e. the label.
[0030] The redundancy degree is calculated by calculating the mutual information of the electroencephalogram channel feature and the selected channel feature subset S, and the calculation formula of the redundancy degree is:
[0031]
[0032] Wherein, S j represents the selected channel feature subset, f i is the independent variable of the channel feature, and f j is the independent variable of the selected channel feature subset.
[0033] The MRMR score of each channel is solved, and the calculation formula is:
[0034] MRMR(i) = D(S i ; c) - R(S i ; S j ) (5).
[0035] In the step four, when MRMR is used for scoring and selecting electroencephalogram channels, the A+5 features extracted from each electroencephalogram channel are calculated MRMR(i), which is substituted into formula (5), and the MRMR(i) of n electroencephalogram channels can be obtained, and finally n MRMR(i) is calculated. The MRMR(i) of the electroencephalogram channel obtained after calculation is arranged in descending order, if m optimal channels are used, the feature data of the electroencephalogram channel corresponding to MRMR(i) is selected in descending order, and the electroencephalogram channel corresponding to the electroencephalogram feature data arranged in the first m is selected, which is used for subsequent training of the electroencephalogram channel number.
[0036] In the step five, the TCN network, the causal convolution controls the current output, which is only obtained by analyzing the input at the current t time and before, and has nothing to do with the information after the future t time. Secondly, one-dimensional full convolution FCN is used and zero padding is performed, so that the input and output length of the TCN network remains the same, i.e.
[0037] TCN = FCN 1D + Casual 1D (6)
[0038] In the formula, TCN is the input of the TCN network, FCN 1D is one-dimensional full convolution, and Casual 1D is causal convolution.
[0039] The dilated convolution in the TCN network introduces a dilation factor, and the receptive field of the convolution kernel is controlled by adjusting the size of the dilation factor. When the input time series is x and the convolution filter is f{0,…,k-1}, the calculation formula of the dilated convolution is:
[0040]
[0041] In the formula, d is the dilation factor, k is the size of the convolution filter, and s-d i is the data before s in the input sequence.
[0042] The residual network in the TCN network effectively expands the depth of the network by adding an identity mapping and a cross-layer connection mechanism. The residual block contains three structures of full convolution, causal convolution and dilated convolution, and at the same time, a WeightNorm weight normalization unit, a ReLU activation function unit and a Dropout discard layer unit are added in turn. The output of the network contains two parts, one part is obtained by input through a series of transformations F(x), and the other part is obtained by input x through an identity mapping to the output, which is specifically:
[0043] o = Activation(x + F(x)) (8)
[0044] In the step five, the optimal channel of the electroencephalogram data is obtained by using the segment-based seizure signal detection. The data set is divided into test data and training data according to the ratio of 1-3:7-9. In order to alleviate the serious imbalance problem between the seizure period and the non-seizure period data, the seizure period data in the training data is repeated to be equal in length to the non-seizure period data. Then the relatively balanced training data is divided into a validation set and a training set again according to the ratio of 1-3:7-9. The training set is used to train the model, and the validation set is used to verify the model. At the same time, N-fold cross-validation is used to prevent model overfitting (N can be any number greater than or equal to 1). The results of each fold are averaged to obtain the final result, so as to better evaluate the network performance. For the n-channel electroencephalogram data of each patient, a total of n training is performed and n corresponding results are obtained. The sensitivity, specificity, G-mean and accuracy of the four indicators are used to evaluate the n results, and the number of electroencephalogram channels required to obtain the best result for each patient is obtained. The number of electroencephalogram channels is 10-18 electroencephalogram channels.
[0045] The TCN network runtime in the fifth step classifies the data after channel selection into seizures and non-seizures using a TCN network model, the iteration number is epoch, taking 30-500; the sample number is batch_size, taking any integer; the learning rate is learn_rate, taking 0.0001-0.01; the number of filters in the convolutional layer is nb_filters, taking 10-20; the kernel size in the convolutional layer is kernel_size, taking 2-5; the number of residual block stacks is nb_stacks, taking any integer.
[0046] In the fifth step, the optimal channel electroencephalogram data is detected and analyzed based on the event-based seizure signal detection, specifically: the number of electroencephalogram channels required to obtain the best result for each patient is selected, and N-fold cross-validation is used, where N is the number of seizures for each patient. If a patient has N seizures, the non-seizure period of I hours is divided into N parts, each containing I / N hours of non-seizure data. The I / N hour non-seizure period and 1 seizure period data are spliced to obtain one-fold data, a total of N folds, taking (N-1) folds of training data and the remaining one fold as the test set. Similarly, the training data is balanced and divided into training and validation sets in a ratio of 1-3:7-9. The above process is performed N times, and the final result is obtained by averaging each result.
[0047] In the sixth step, the particle swarm optimization algorithm is used to optimize the optimal comprehensive index SF to obtain the seizure detection limit value, detection threshold value and seizure screening time, specifically: the detection threshold value k, seizure detection limit s and seizure screening time ignore_t are selected using the comprehensive index SF, and the particle swarm optimization algorithm is used to optimize the optimal comprehensive index SF to obtain the seizure detection limit value s and detection threshold value k. The comprehensive index SF calculation formula is as follows:
[0048]
[0049] In the formula, Sens is the sensitivity of event-based detection, and FDR is the false positive rate per hour. When the FDR value is greater than 1 / h, it is set to 1 for calculation. The range of SF is 0-100%, and the calculated SF is used as the threshold value k. G(s;k;ignore_t) is the optimization formula of the particle swarm optimization algorithm, which is a function of k, s and ignore_t. The operation process of the particle swarm optimization algorithm is to find a set of values of k, s and ignore_t that maximize the function value of G(s;k;ignore_t).
[0050] The step six is to perform Kalman filtering on the results of the event-based seizure signal detection, specifically, to perform Kalman filtering and linear interpolation on the output values of the TCN network, and then compare with the detection threshold k solved by the particle swarm optimization algorithm, that is, once the probability value after smoothing and interpolation exceeds the threshold, it is marked as a seizure, and the value k of each patient in the experiment is specific. At the same time, in order to effectively reduce the false positive rate, the condition that the threshold is exceeded for s times in succession is set as a seizure, and the value is also solved by the particle swarm optimization algorithm, and the value s of each patient is fixed; in addition, in order to avoid repeated alarms for the same seizure, an ignore_t shielding period is set after detecting a seizure in the experiment, that is, the seizure is not detected during this period, and the value is solved by the particle swarm optimization algorithm, and the ignore_t value of each patient is fixed.
[0051] The step six is to evaluate the results of Kalman filtering on the event-based seizure signal detection, specifically, four indexes of sensitivity, false detection rate, latency and comprehensive index SF are selected; wherein the sensitivity (Sens) is the number of correct detections / the number of seizures marked by doctors, if the algorithm judges that the seizure period overlaps with the seizure period marked by doctors, it is considered that the seizure event is successfully detected; the false detection rate (FDR) is the number of false detections per hour; the comprehensive index SF is introduced to balance the sensitivity and the false detection rate; the latency (Latency) is the difference between the detection time of the seizure and the real seizure time.
[0052] Compared with the prior art, the present application has the following advantages:
[0053] (1) The present application proposes a seizure detection algorithm based on MRMR channel selection and time convolution network, which is beneficial to improve the accuracy of long-term identification and classification of seizure and non-seizure periods, and the proposed algorithm can be well used for long-term EEG seizure detection, solving the problems of low sensitivity of the existing seizure detection algorithm, loss of part of the patient's information, large model training calculation amount and the like.
[0054] (2) The MRMR method is used for channel selection, and the optimal EEG channel data with high correlation with seizures is obtained for subsequent model training, which excludes a large amount of redundant EEG channel information irrelevant to seizures and reduces the algorithm calculation amount.
[0055] (3) The time domain features and frequency domain features are simultaneously input into the time convolution network model, which not only considers the related features in the time domain, but also considers the Fourier domain frequency band energy features, realizing high-level representation of time domain features and frequency domain features in the time convolution network.
[0056] (4) First, the optimal number of channels of electroencephalogram data is obtained by using the segment-based seizure signal detection, and then the event-based seizure signal detection is used to output the model of the electroencephalogram data of the patient, so that the result is more accurate, and the calculation amount is greatly reduced.
[0057] (5) The particle swarm optimization algorithm is used to find the seizure detection limit, detection threshold and seizure shielding time when the best result is obtained, and different seizure detection limit, detection threshold and seizure shielding time can be obtained for each patient, so that the result accuracy of the trained model for a single patient is greatly improved.
[0058] (6) The time convolution network (TCN) is used for automatic detection of the seizure signal, the TCN is an improvement of the convolutional neural network (CNN), has strong processing capability for time sequence, has the obvious characteristics of simple structure, and can improve the detection effect of the seizure signal. BRIEF DESCRIPTION OF DRAWINGS
[0059] Figure 1 The algorithm flowchart used in the present application.
[0060] Figure 2 The 23-channel electrode position map used in the CHB-MIT database.
[0061] Figure 3 The data division schematic diagram.
[0062] Figure 4 The TCN network structure schematic diagram.
[0063] Figure 5 The event-based optimal channel seizure detection result. DETAILED DESCRIPTION
[0064] The flow and advantages of the present application will be described in detail below with reference to the accompanying drawings.
[0065] The specific experiment of the present application is carried out under the Windows 10 (64-bit) operating system, the electroencephalogram preprocessing, feature extraction and channel selection are based on Matlab R2019b, the network training is based on TensorFlow2.6.0 framework, Keras is used as the front-end API, and Python3.9 is used as the virtual environment of the compiler for training.
[0066] Figure 1 The entire algorithm is a brief flowchart, and the entire algorithm is divided into five modules, including the collection and data division of motor execution electroencephalogram signals, feature extraction, MRMR channel selection, and finally obtaining the detection result through the convolutional neural network classifier.
[0067] The motion execution electroencephalogram signal data set used in the application is collected from experiments, 22 electroencephalogram channels are used, including: FP1-F7, F7-T7, T7-P7, P7-O1, FP1-F3, F3-C3, C3-P3, P3-O1, FP2-F4, F4-C4, C4-P4, P4-O2, FP2-F8, F8-T8, T8-P8, P8-O2, FZ-CZ, CZ-PZ, P7-T7, T7-FT9, FT9-FT10, FT10-T8. Since chb13, chb15, chb16, chb17, chb18 and chb19 change the electrode channel in the data collection process, only 18 channels with consistent front and back electrodes are selected.
[0068] Based on the above electroencephalogram data set, the algorithm flow shown in the figure is used, and the specific implementation steps of the application are as follows taking one subject as an example: Figure 1
[0069] Step 1: Obtain 23-channel electroencephalogram data, and the electroencephalogram data is not preprocessed, such as denoising, artifact or filtering.
[0070] The CHB-MIT data set is used in the experiment. The data set collects the EEG signals of 23 patients in Boston Children's Hospital. The records from 23 patients are divided into 24 groups (the 21st group is added by resampling patient 1 after several years), and each group contains the EEG signal record of one patient for more than ten hours. In most cases, each EDF file contains only 1h of digitized EEG signal, and some files are 2h or 4h. The signal sampling frequency is 256Hz, and the EEG signal of each patient is composed of a single-channel data set by collecting 18 points, and then processed into a 23-channel multi-channel data. There are a total of 664 EDF files in the data set, including 129 files containing one or more seizures, recording a total of 198 seizures.
[0071] Figure 2 It is a 23-channel electrode position map used in the CHB-MIT database. In the CHB-MIT database, channel 23 and channel 15 have the same data, both from “T8-P8”. In order to avoid data redundancy, channel 23 is deleted, and 22 electroencephalogram channels are used, including: FP1-F7, F7-T7, T7-P7, P7-O1, FP1-F3, F3-C3, C3-P3, P3-O1, FP2-F4, F4-C4, C4-P4, P4-O2, FP2-F8, F8-T8, T8-P8, P8-O2, FZ-CZ, CZ-PZ, P7-T7, T7-FT9, FT9-FT10, FT10-T8.
[0072] The collected EEG data can be represented as X(t) = {x1(t), x2(t), ..., x...} n (t)}, where n represents the number of EEG data channels, t represents the acquisition time of the EEG data, and x n (t) represents the EEG data of the nth channel, which is a continuous time series.
[0073] Step 2: After segmenting and labeling the EEG data into T (T=2) s segments, the data is further divided;
[0074] 2.1. Segment and label the EEG2s data. The collected EEG data is X(t) = {x1(t), x2(t), ..., x...} n After completing the 2s segmentation and labeling operation, it can be represented as X(i) = {x1(i), x2(i), ..., x}. n (i)}, transforming continuous time-series data into discrete sequences, where i represents the number of segments in the EEG data, n represents the number of channels in the EEG data, and x n (i) represents the EEG data of the nth channel, which is a discrete sequence.
[0075] 2.2 In the data partitioning process, based on the requirements of the Temporal Convolutional Network (TCN) for the input time series, a 10*T s sliding time window is used for all initially partitioned segments, i.e., for X(i)=(x1(i), x2(i), …, x n (i)} Sample division was carried out. Considering that the time of epileptic seizures accounts for a very short period of the total EEG collection time, and most of the data are non-seizure segments, in order to initially solve the problem of severe imbalance in the length of EEG data during seizures and non-seizures, T / 2s overlap was performed on the seizure data.
[0076] Figure 3 This is a schematic diagram of the data partitioning method. Based on the requirements of the Temporal Convolutional Network (TCN) for the input time series, a 20-second sliding time window is used to partition all initially divided segments. Since the duration of epileptic seizures is very short, and most of the data consists of non-seizure segments, to initially address the severe imbalance in EEG data length between seizure and non-seizure periods, a 1-second overlap is applied to the seizure data. Specifically, if the current sample is a non-seizure sample, slide forward 10 segments; if the current sample is a seizure sample, slide forward 1 segment, until the time window can no longer capture a complete set of 10 segments, at which point the sample partitioning stops, and the last segment with fewer than 10 segments is discarded. Thus, the data segments are merged into a group of 10, preserving the temporal continuity of the original EEG signal within each group.
[0077] Step 3: Extract features from EEG data. Extract time-domain and frequency-domain features from the EEG signals of epileptic patients during seizures and non-seizures, and then perform z-score standardization.
[0078] Ten statistical parameters were selected as temporal features of the EEG signal for extraction, specifically including: maximum value, minimum value, median, mean, standard deviation, variance, mean absolute deviation, root mean square, skewness, and kurtosis. The specific methods for calculating these ten temporal features are as follows. For X(i)={x1(i), x2(i),…,x n (i)} A 2-second segment of EEG signal x from each channel of the EEG data in the fragment. n (i) is the average value, where i is its segment number, n is its channel number, and N is the average value of x. n (i) contains the number of collected EEG data, where I is the total number of 2sEEG signal segments. When the frequency of the collected EEG signal is 256Hz, the value of N is 512.
[0079] The formula for finding the maximum value is:
[0080] max(x) (1)
[0081] The formula for finding the minimum value is:
[0082] min(x) (2)
[0083] The formula for finding the mean is:
[0084] median(x) (3)
[0085] The formula for calculating the average is:
[0086]
[0087] The formula for calculating the standard deviation is:
[0088]
[0089] The formula for calculating variance is:
[0090]
[0091] The formula for calculating the mean absolute deviation is:
[0092]
[0093] The formula for solving the root mean square is:
[0094]
[0095] The formula for calculating skewness is:
[0096]
[0097] The formula for solving kurtosis is:
[0098]
[0099] Using wavelet decomposition, the electroencephalogram data is processed in frequency band, and five typical electroencephalogram signal bands in the electroencephalogram signal, i.e. δ wave, θ wave, α wave, β wave and γ wave, are extracted. In order to extract the above-mentioned wave band signals using wavelet transform, according to the principle of wavelet decomposition, when the frequency of the signal is 256 Hz, the wavelet is decomposed for five layers, and the target frequency band can be obtained. The 2s EEG signal is decomposed by wavelet, and the energy of the above-mentioned five frequency bands is extracted as the frequency domain feature used in the subsequent operation.
[0100] After the features are extracted, x n (i) is changed from the electroencephalogram data sequence of the previous n channel and containing I 2s EEG signals to a sequence containing multiple features with 15 features, time labels (arranged in order, a total of I time labels) and seizure labels (the label is "1" when the seizure occurs, and the label is "0" when the seizure does not occur, a total of I seizure labels), which can be expressed as: x n (i) = {[x 11 , x 12 , …, x lk ], [x 21 , x 22 , …, x 2k ], …, [x c1 , x c2 , …, x ck ], [1, 2, …, I], [0, 1, …, 0]}. Each feature vector in x n (i) after feature extraction needs to be subjected to z score standardization, and the formula for z score standardization applied by the present application is:
[0101]
[0102] Step four: calculating the MRMR of the z score standardized features to score and sort the electroencephalogram channels, and selecting the electroencephalogram channels with high ranking to complete the channel selection.
[0103] The MRMR used is a filter type feature selection method based on mutual information, which uses incremental search to select features, so that the correlation between the features and the categories is maximized, and the redundancy between the features is minimized. In order to select the channels, the A+5 features of each channel are changed into one dimension, and then the MRMR score calculation and electroencephalogram channel selection are performed. Before solving the MRMR, the mutual information needs to be calculated, and the formula for calculating the mutual information is:
[0104]
[0105] Where P(x,y) is the joint probability distribution function of X and Y, and P(x) and P(y) are the marginal probability distribution functions of X and Y, respectively.
[0106] First, the relevance needs to be obtained by calculating the mutual information between the channel feature and its corresponding category. The formula for calculating the relevance is:
[0107]
[0108] Among them, S i This represents the characteristics of the channel, |S| represents the number of channels, and f i is the independent variable of the channel feature, and c is the category, i.e., the label, of the data in this channel.
[0109] The redundancy is obtained by calculating the mutual information between the channel feature and the selected channel feature subset S. The formula for calculating the redundancy is:
[0110]
[0111] Among them, S j f represents a subset of the selected channel features. i f is the independent variable representing the characteristics of this channel. j It is the independent variable of the selected channel feature subset.
[0112] The MRMR score for each channel is calculated using the following formula:
[0113] MRMR(i)=D(S i ;c)-R(S i S j (15)
[0114] When using MRMR to score and select EEG channels in step four, MRMR(i) is calculated for the 15 features extracted from each EEG channel. Substituting these features into formula (5), MRMR(i) for 23 EEG channels can be obtained (23 MRMR(i) are finally calculated). The calculated MRMR(i) of the EEG channels are arranged in descending order. If m optimal channels are to be used, the feature data of the EEG channels corresponding to MRMR(i) are selected in descending order. The EEG feature data corresponding to the first m ranked EEG channels are selected to reduce the number of EEG channels for subsequent training.
[0115] Step five: the data after channel selection is input into the TCN network for model training through ten-segment merging. First, the optimal channel of the electroencephalogram data is obtained by using the seizure signal detection based on the segment, and then the electroencephalogram data of the optimal channel is detected and analyzed by using the seizure signal detection based on the event.
[0116] When the TCN network model is running, the data after channel selection is classified into seizures and non-seizures by using the TCN network model, the iteration number epoch is 300, the sample number batch_size is 100, the learning rate learn_rate is 0.001, the number of filters in the convolution layer nb_filters is 16, the kernel size in the convolution layer kernel_size is 3, and the number of residual block stacks nb_stacks is 1.
[0117] Figure 4 is a schematic diagram of the TCN network structure. The TCN network has three special structures, namely, casual convolution (Casual Conv1D), dilated convolution (Dilated Conv1D), and residual network (Residual Block), and also has a normalization layer (LayerNorm), a ReLu activation function (ReLu), and a dropout layer (Dropout). Among them, the casual convolution can control the current output to be obtained only by analyzing the input at the current t time and before, and has nothing to do with the information after the future t time, so as to ensure that the future information will not be leaked in advance, which is also consistent with the situation of detecting and monitoring epilepsy according to the electroencephalogram signal in practice. Secondly, one-dimensional full convolution (FCN) is used and zero padding is performed, so that the input and output lengths of the TCN network remain the same. That is:
[0118] TCN=FCN·1D+Casual·1D (16)
[0119] In the formula, TCN is the input of the TCN network, FCN·1D is one-dimensional full convolution, and Casual·1D is casual convolution.
[0120] Among them, the dilated convolution introduces a dilation factor on the basis of the traditional convolution, and controls the receptive field of the convolution kernel by adjusting the size of the dilation factor. The increase of the dilation factor can make the receptive field expand exponentially, so as to obtain the long-time dependent information of the signal. In general, the receptive field of the TCN network depends on the convolution kernel size, the dilation factor size and the depth of the network. For example, when the input time sequence signal is x and the convolution filter is f{0,…,k-1}, the calculation formula of the dilated convolution is:
[0121]
[0122] where d is the dilation factor, k is the size of the convolution filter, and s-d·i is the data before s in the input sequence.
[0123] where, the residual network is proposed to solve the problem of gradient explosion and gradient disappearance in the training process of deep network, and the depth of the network is effectively expanded by adding identity mapping and cross-layer connection mechanism. The residual block contains three structures of full convolution, causal convolution and dilated convolution, and WeightNorm weight normalization unit, ReLU activation function unit and Dropout discard layer unit are added in turn. The output of the network contains two parts, one part is obtained by a series of transformations F(x), and the other part is the input x through identity mapping to the output, which is specifically:
[0124] o=Activation(x+F(x)) (18)
[0125] First, the optimal channel of electroencephalogram data is obtained by using the segment-based seizure signal detection, and the data set is divided into test data and training data according to the ratio of 1:9. In order to alleviate the serious imbalance problem between the seizure period and the non-seizure period data, the seizure period data in the training data is repeated to be equal in length to the non-seizure period data. Then, the relatively balanced training data is divided again into validation set and training set according to the ratio of 1:9. The training set is used to train the model, and the validation set is used to verify the model. At the same time, ten-fold cross-validation is used to prevent model overfitting, and the results of each fold are averaged to obtain the final result, so as to better evaluate the network performance. For the 23-channel electroencephalogram data of each patient, a total of 23 times of training are performed and 23 corresponding results are obtained (the first time is to select only the first electroencephalogram channel in MRMR ranking, and so on). Four indicators of sensitivity, specificity, G-mean and accuracy are selected to evaluate the n results, and the number of electroencephalogram channels required to obtain the best result for each patient can be obtained, which is generally 10-18 electroencephalogram channels (under the condition of 23-channel electroencephalogram data acquisition).
[0126] In the performance evaluation of the network based on segment-based seizure detection, four indicators of sensitivity, specificity, G-mean and accuracy are selected. The specific definitions are as follows:
[0127] Among them, the sensitivity (Sensitivity, Sens) formula is:
[0128]
[0129] Among them, the specificity (Specificity, Spec) formula is:
[0130]
[0131] Among them, the G-Mean formula is:
[0132]
[0133] wherein the accuracy (Accuracy, Acc) formula is:
[0134]
[0135] In the formula, the true positive (TP) is the number of segments that are judged as the onset period by both the algorithm and the doctor; the false positive (FP) is the number of segments that are identified as the seizure period by the algorithm but are marked as the non-onset period by the doctor; the true negative (TN) is the number of segments that are judged as the non-onset period by both the algorithm and the doctor; and the false negative (FN) is the number of segments that are identified as the non-onset period by the algorithm but are marked as the onset period by the doctor.
[0136] The electroencephalogram data of the optimal channel is analyzed by using the event-based seizure signal detection, and the number of electroencephalogram channels required to obtain the best result for each patient is selected. In order to detect the seizure event of each patient, N-fold cross-validation is used, wherein N is the number of seizures of each patient. If a patient has N seizures, the I-hour non-onset period is divided into N parts, each containing I / N hours of non-onset data. The I / N-hour non-onset period and 1 seizure period data are spliced to obtain one-fold data, a total of N folds, (N-1) folds of training data are taken, and the remaining one is taken as the test set. Similarly, after the data balancing operation, the training data are divided into the training set and the validation set according to the ratio of 1:9. The above process is performed for N times, and the final result is obtained by averaging the results of each time.
[0137] Step six: using the particle swarm optimization algorithm to optimize to obtain the optimal comprehensive index SF corresponding to the seizure detection limit value, the detection threshold value and the seizure shielding time, the result obtained by the event-based seizure signal detection is subjected to Kalman filtering, and finally the result after Kalman filtering is evaluated.
[0138] In the step six, the particle swarm optimization algorithm is used to optimize to obtain the optimal comprehensive index SF corresponding to the seizure detection limit value, the detection threshold value and the seizure shielding time, the present application selects the detection threshold value k (the output value of the TCN network is subjected to Kalman filtering and linear interpolation, and then compared with the threshold value k, that is, once the probability value after smoothing and interpolation exceeds the threshold value, it is marked as the seizure, and the threshold value of each patient in the experiment is specific), the seizure detection limit s (that is, 7 times continuously exceeding the threshold value is regarded as the seizure) and the seizure shielding time ignore_t (after detecting a seizure, the ignore_t shielding period is set, the unit is s, that is, the seizure is not detected during this period) by using the particle swarm optimization algorithm to optimize to obtain the optimal comprehensive index SF corresponding to the seizure detection limit value s and the detection threshold value k. The comprehensive index SF used in the present application is calculated according to the following formula:
[0139]
[0140] In the formula, Sens is the sensitivity of event-based detection, FDR is the false detection rate per hour. When the FDR value is greater than 1 / h, it is set to 1 for calculation, the range of SF is 0-100%, and the SF obtained after calculation is used as the threshold k. G(s; k; ignore_t) is the optimization formula of the particle swarm optimization algorithm, which can be regarded as a function of k, s and ignore_t. The operation process of the particle swarm optimization algorithm is to find a set of values of k, s and ignore_t that can maximize the function value of G(s; k; ignore_t).
[0141] In the Kalman filtering of the results of the event-based seizure signal detection in step six, Kalman filtering is a statistical method that can obtain an estimate close to the true value. Therefore, the output value of the TCN network is subjected to Kalman filtering and linear interpolation in the experiment, and then compared with the detection threshold k solved by the particle swarm optimization algorithm. Once the probability value after smoothing and interpolation exceeds the threshold, it is marked as a seizure. The value k of each patient in the experiment is specific. At the same time, in order to effectively reduce the false detection rate, it is necessary to set the condition that s consecutive times exceed the threshold as a seizure, and the value is also solved by the particle swarm optimization algorithm. The value of s of each patient is fixed. In addition, in order to avoid repeated alarms for the same seizure, an ignore_t shielding period is set after detecting a seizure in the experiment, i.e., no seizure detection is performed during this period, and the value is solved by the particle swarm optimization algorithm. The ignore_t value of each patient is fixed.
[0142] In the evaluation process of the Kalman filtered results of the event-based seizure signal detection in step six, four indexes of sensitivity, false detection rate, latency and comprehensive index SF are selected. Among them, the sensitivity (Sens) is the number of correct detections of the algorithm / the number of seizures marked by the doctor. If the algorithm judges that there is an overlap with the seizure period marked by the doctor, it is considered as successfully detecting the seizure event. The false detection rate (FDR) is the number of false detections per hour. At the same time, an ideal algorithm should achieve high detection sensitivity and low false detection rate, but in reality, these two are contradictory. Therefore, the comprehensive index SF is introduced to balance the sensitivity and false detection rate. The calculation formula has been described in the optimization of the seizure detection limit value, the detection threshold and the seizure shielding time using the particle swarm optimization algorithm to obtain the optimal comprehensive index SF. The latency (Latency) is the difference between the time of detecting the seizure and the time of the real seizure.
[0143] Figure 5The final results are shown in Table 4. It can be seen that the average sensitivity (Sens) of the event-based seizure signal detection is 100%, the average false detection rate (FDR) is 0.067 times / h, the average latency is 2.348 s, and the average comprehensive index SF is 96.836%.
Claims
1. A method for detecting epilepsy signals using a channel-selective temporal convolutional network, characterized in that, Includes the following steps: Step 1: Acquire channel EEG data; the EEG data is not preprocessed. Step 2: After Ts segmentation and labeling of the EEG data, the data is further divided; Step 3: Extract features from EEG data. Extract time-domain and frequency-domain features from the EEG signals of epileptic patients during seizures and non-seizures, and then perform z-score standardization. Step 4: Calculate the MRMR of the features after z-score standardization, score and rank the EEG channels, and select the top-ranked EEG channels to complete the channel selection. Step 5: Input the data after channel selection into the TCN network for model training by merging S segments. First, use segment-based epileptic seizure signal detection to obtain the optimal channel of EEG data, and then use event-based epileptic seizure signal detection to detect and analyze the EEG data of the optimal channel. Step 6: Use the particle swarm optimization algorithm to find the optimal comprehensive index SF corresponding to the seizure detection limit, detection threshold and seizure shielding time. Perform Kalman filtering on the results of event-based epileptic seizure signal detection. Finally, evaluate the results after Kalman filtering. Step six uses a particle swarm optimization algorithm to find the optimal comprehensive index SF, which corresponds to the seizure detection limit, detection threshold, and seizure blocking time. Specifically, the detection threshold k, seizure detection limit s, and seizure blocking time ignore_t are selected using the comprehensive index SF. The particle swarm optimization algorithm is then used to find the optimal comprehensive index SF, which corresponds to the seizure detection limit s and detection threshold k. The formula for calculating the comprehensive index SF is as follows: In the formula, Sens represents the sensitivity based on event detection, FDR represents the false alarm rate per hour; when the FDR value is greater than 1 / h, it is set to 1 for calculation, SF ranges from 0 to 100%, and the calculated SF is used as the threshold k. G(s; k; ignore_t) is the optimization formula of the particle swarm optimization algorithm, which is regarded as a function of k, s, and ignore_t. The operation process of the particle swarm optimization algorithm is to find a set of values of k, s, and ignore_t that maximizes the function value of G(s; k; ignore_t). In step six, the results of the event-based epileptic seizure signal detection are subjected to Kalman filtering. Specifically, the output value of the TCN network is Kalman filtered and linearly interpolated, and then compared with the detection threshold k obtained by the particle swarm optimization algorithm. That is, if the smoothed and interpolated probability value exceeds the threshold, it is marked as a seizure. In the experiment, the value k is specific for each patient. At the same time, in order to effectively reduce the false alarm rate, a condition is set that exceeding the threshold s times consecutively is regarded as a seizure. The value of s is also solved by the particle swarm optimization algorithm, and the value of s is fixed for each patient. In addition, in order to avoid repeated alarms for the same seizure, an ignore_t blocking period is set after a seizure is detected in the experiment. That is, during this period, epileptic seizures are no longer detected. The value of ignore_t is solved by the particle swarm optimization algorithm, and the value of ignore_t is fixed for each patient.
2. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, Each EEG data acquired in step one contains multiple EDF files, and each EDF file can contain EEG signals for a relatively long period, including 1 hour, 2 hours, and 4 hours. The EEG signal contains n EEG channels, and the electrode positions follow the 10-20 international standard lead system. The acquisition duration is t, the number of acquisition groups is l, the number of channels is n, the sampling frequency is f, and the acquired EEG data is represented as X(t) = {x1(t), x2(t), ..., x...} n (t)}, where n represents the number of EEG data channels, t represents the acquisition time of the EEG data, and x n (t) represents the EEG data of the nth channel, which is a continuous time series.
3. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, Step two specifically involves: 2.
1. The EEG data is segmented and labeled by Ts. The collected EEG data is X(t) = {x1(t), x2(t), ..., x...} n After completing the segmentation and labeling operation for T = 2s, it is represented as X(i) = {x1(i), x2(i), ..., x}. n [i], transforming continuous time-series data into discrete sequences, where i represents the number of segments in the EEG data, n represents the number of channels in the EEG data, and x n (i) represents the EEG data of the nth channel, which is a discrete sequence; 2.2 In the data partitioning process, based on the requirements of the Temporal Convolutional Network (TCN) for the input time series, a 10*T s sliding time window is used for all initially partitioned segments, i.e., for X(i)={x1(i), x2(i), …, x n (i)} Perform sample division and T / 2s overlap on the ictal period data; The specific operation method for T / 2s overlay of the seizure period data is as follows: if the current sample is a non-seizure sample, slide forward 10 segments; if the current sample is a seizure sample, slide forward 1 segment, until the time window cannot obtain a complete set of 10 segments, stop the sample division, and discard the last segment with less than 10 segments.
4. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, The specific process of feature extraction in step three is as follows: for X(i) = {x1(i), x2(i), ..., x...} n (i)} segment is used for time-domain and frequency-domain feature extraction, which serves as the input to the classifier. This includes A time-domain features and five frequency-domain features, and is represented as X(i)={x1(i), x2(i), …, x n (i)} Each segment of TsEEG signal features are labeled with a time label and an attack label, with "1" for an attack and "0" for no attack; In step three, the extraction of time-domain features extracts X(i) = {x1(i), x2(i), ..., x...} n (i)} Calculate the maximum, minimum, median, mean, standard deviation, variance, mean absolute deviation, root mean square, skewness, and kurtosis of the A time-domain characteristic statistical parameters of each TsEEG signal segment; where For X(i)={x1(i), x2(i),…,x n (i)} In each channel of the EEG data segment, there is a segment of Ts's EEG signal x n (i) is the average value, where i is its segment number, n is its channel number, and N is the average value of x. n (i) contains the number of collected EEG data, where I is the total number of TsEEG signal segments. When the frequency f of the collected EEG signal is 256Hz, the value of N is 512. The extraction of five frequency domain features in step three utilizes wavelet decomposition to perform frequency band processing on the EEG data, extracting five typical EEG signal bands: delta wave, theta wave, alpha wave, beta wave, and gamma wave. Here, A represents the detail coefficients, and D represents the approximation coefficients. D1 and D2, after reconstruction, correspond to the gamma band (γ > 32 Hz); D3 corresponds to the beta band (β = 12-32 Hz); D4, after reconstruction, corresponds to the alpha band (8-12 Hz); D5, after reconstruction, corresponds to the theta band (4-8 Hz); and A5, after reconstruction, corresponds to the delta band (0.5-4 Hz). To extract the signals of these bands using wavelet transform, based on the principle of wavelet decomposition, when the signal frequency is 256 Hz, a five-level wavelet decomposition is performed to obtain the target frequency band. Wavelet decomposition is performed on each segment of the TsEEG signal to extract the energy of the five frequency bands, which are then used as frequency domain features in subsequent operations. After feature extraction, x n (i) The EEG data sequence from the previous nth channel containing I segments of TsEEG signal is transformed into a sequence with multiple features after feature extraction, including A time-domain features, five frequency-domain features, a time label, and an episodic label, denoted as: x n (i)={[x 11 ,x 12 , ..., x 1k ],…[x c1 ,x c2 , ..., x ck [1,2,…,I],[0,1,…,0]};x after feature extraction n Each feature vector in (i) must be standardized using z-score; In step three, after analyzing the frequency domain features, z-score normalization is performed. The formula for z-score normalization is:
5. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, In step four, the MRMR calculation of the z-score standardized features is used for EEG channel scoring and ranking. The MRMR used is a mutual information-based filtering feature selection method that uses incremental search to select features, maximizing the correlation between features and categories and minimizing feature redundancy. For channel selection, the A+5 features of each channel are transformed into one dimension before MRMR score calculation and EEG channel selection. Mutual information needs to be calculated before solving for MRMR. The formula for calculating mutual information is: Where P(x,y) is the joint probability distribution function of X and Y, while P(x) and P(y) are the marginal probability distribution functions of X and Y, respectively. The correlation is obtained by calculating the mutual information between EEG channel features and their corresponding categories. The formula for calculating the correlation is: Among them, S i This represents the characteristics of the channel, |S| represents the number of channels, and f i is the independent variable of the channel feature, and c is the category, i.e., the label, of the data in this channel; Redundancy is obtained by calculating the mutual information between the EEG channel features and the selected channel feature subset S. The formula for calculating redundancy is: Among them, S j f represents a subset of the selected channel features. i f is the independent variable representing the characteristics of this channel. j It is the independent variable of the selected channel feature subset; The MRMR score for each channel is calculated using the following formula: MRMR(i)=D(S i ;c)-R(S i ;S j ) (5); When using MRMR to score and select EEG channels in step four, MRMR(i) is calculated for the A+5 features extracted from each EEG channel. Substituting these features into formula (5) yields MRMR(i) for n EEG channels. Finally, n MRMR(i) are calculated and arranged in descending order of the calculated EEG channels. If m optimal channels are to be used, the feature data of the EEG channels corresponding to MRMR(i) are selected in descending order. The EEG feature data corresponding to the first m ranked EEG channels are selected to reduce the number of EEG channels used for subsequent training.
6. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, In step five, the TCN network uses causal convolution to control the current output, which is obtained solely from analyzing the input at time t and before, and is unrelated to information after time t. Furthermore, a one-dimensional fully convolutional FCN with zero padding is used to ensure that the input and output lengths of the TCN network remain the same. TCN = FCN·1D + Casual·1D (6) In the formula, TCN is the input of the TCN network, FCN·1D is a one-dimensional fully convolution, and Casual·1D is a causal convolution; In TCN networks, dilated convolution introduces a dilation factor, and the receptive field of the convolution kernel is controlled by adjusting the size of the dilation factor. The residual network in the TCN network effectively extends the network depth by incorporating identity mapping and cross-layer connections. The residual block contains three main structures: fully convolutional, causal convolution, and dilated convolution. It also sequentially incorporates WeightNorm weight normalization units, ReLU activation function units, and Dropout dropout layer units. The network output consists of two parts: one part is obtained from the input through a series of transformations F(x), and the other part is the input x transformed into the output through identity mapping, specifically: o = Activation(x + F(x)) (8) In step five, the optimal channel of EEG data is first obtained using fragment-based epileptic seizure signal detection. The dataset is divided into test data and training data in a 1-3:7-9 ratio. To alleviate the severe imbalance between seizure-phase and non-seizure-phase data, the seizure-phase data in the training data is repeated until it is the same length as the non-seizure-phase data. Then, the relatively balanced training data is divided into validation set and training set again in a 1-3:7-9 ratio. The training set is used to train the model, and the validation set is used to validate the model. At the same time, N-fold cross-validation is used to prevent overfitting of the model. N is any number greater than or equal to 1. The results of each fold are averaged to obtain the final result, so as to better evaluate the network performance. For each patient's n-channel EEG data, a total of n training sessions were conducted to obtain n corresponding results. Four indicators, sensitivity, specificity, G-mean, and accuracy, were used to evaluate these n results to obtain the number of EEG channels required for each patient to achieve the best results. This number of EEG channels is 10-18.
7. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, In step five, during the TCN network operation, the TCN network model is used to classify the data after channel selection into epileptic seizures and non-seizures. The number of iterations is epoch, ranging from 30 to 500; the number of samples is batch_size, an arbitrary integer; the learning rate is learn_rate, ranging from 0.0001 to 0.01; the number of filters in the convolutional layer is nb_filters, ranging from 10 to 20; the kernel size of the convolutional layer is kernel_size, ranging from 2 to 5; and the number of residual block stacks is nb_stacks, an arbitrary integer.
8. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, In step five, the EEG data of the optimal channel is analyzed using event-based epileptic seizure signal detection. Specifically, the number of EEG channels required to obtain the best results for each patient is selected, and N-fold cross-validation is used, where N is the number of seizures for each patient. If a patient has N seizures, the non-seizure period of 1' hours is divided into N parts, each containing 1' / N hours of non-seizure data. The 1' / N hours of non-seizure period data and the data from one seizure are concatenated to obtain one fold of data, for a total of N folds. (N-1) folds of training data are used, and the remaining seizure is used as the test set. Similarly, after data balancing, the training data is divided into training and validation sets according to a ratio of 1-3:7-9. The above process is performed N times, and the average of each result is used to obtain the final result.
9. The method for detecting epilepsy signals using a channel-selective temporal convolutional network according to claim 1, characterized in that, In step six, the evaluation process of the Kalman filter results for event-based epileptic seizure signal detection involves selecting four indicators: sensitivity, false alarm rate (FDR), delay time, and a comprehensive index (SF). Sensitivity is the ratio of the number of correctly detected seizures by the algorithm to the number of seizures marked by the doctor. If the algorithm determines that the seizure period overlaps with the doctor-marked seizure period, it is considered a successful detection of the seizure event. The false alarm rate (FDR) is the number of incorrect detections per hour. The comprehensive index SF is introduced to balance sensitivity and false alarm rate. The delay time is the difference between the detected seizure time and the actual seizure time.
Citation Information
Patent Citations
Epileptic EEG prediction method based on convolution and recurrent neural network and multiple time scales
CN110693493A
Video sentiment classification method and device
CN108205686A
Epileptic seizure prediction method based on electroencephalogram signals
CN113974655A