Method for detecting epilepsy based on markov transition field and improved two-dimensional multifractal analysis
Patent Information
- Application Number
- CN202311072722.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-23
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-08-23
AI Technical Summary
[0053]Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis can reduce signal pseudo-fluctuation error and improve the effectiveness and rationality of the algorithm; it makes full use of the advantages of deep learning methods in EEG signal image classification tasks, uses MTF images to detect focal seizures, extracts the multifractal spectrum features of the improved two-dimensional MFDFA, and realizes a feature-based CNN model for detecting epilepsy through MTF images, further improving the accuracy of epilepsy detection, as well as its generalization and robustness in complex noise backgrounds.
Smart Images

Figure CN117153372B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of heuristic algorithms and machine learning classification, and in particular to an epilepsy detection method based on Markov transition fields and an improved two-dimensional multifractal analysis method. Background Technology
[0002] Brain abnormalities, such as epilepsy, ischemic stroke, and brain tumors, can affect normal biological functions. If a brain abnormality is detected during screening surgery, doctors recommend appropriate signal or imaging modalities. Diagnostic tools such as electroencephalography (EEG), magnetoencephalography (MEG), computed tomography (CT), magnetic resonance imaging (MRI), and positron emission tomography (PET) are commonly used in the diagnosis of brain diseases. However, EEG is widely used for preliminary analysis of brain function due to its low cost and high temporal resolution. It records the potentials of neuronal activation from different areas of the brain. Epilepsy is an abnormal state of the brain that causes the uncontrolled release of neuronal impulses in specific areas of the brain, often leading to muscle spasms, or seizures. Epilepsy specialists need to analyze an individual's EEG recordings to determine the severity of seizures, which is often a tedious task and leads to subjective inferences. To overcome this problem, feature-based machine learning diagnostic systems have been extensively studied.
[0003] Many researchers have focused on using nonlinear methods to detect epilepsy from EEG signals. These methods can detect and quantify both linear and nonlinear mechanisms, thus reflecting the characteristics of EEG to some extent. Studies employing nonlinear parameters such as fractals and the maximum Lyapunov exponent to investigate sleep wave signals have expanded the potential applications of nonlinear EEG analysis methods; however, epilepsy identification remains a relevant area of research.
[0004] Recent prior art proposes an automated epilepsy detection system that extracts temporal or frequency features from electroencephalograms (EEGs) and classifies them as normal or focal (epilepsy) EEGs. The accuracy of the classifier depends on the nature of the features used to classify the EEG, and many early works have proposed a feature selection process to choose appropriate features to improve the classifier's performance. In recent years, in the field of image classification, an automated feature extraction method based on convolutional neural networks (CNNs) has been widely used, achieving high classification accuracy. CNN-based deep learning (DL) methods have provided effective generalization properties in image classification. Summary of the Invention
[0005] Purpose of the invention: The purpose of this invention is to provide an epilepsy detection method based on Markov transition fields and an improved two-dimensional multifractal analysis method.
[0006] Technical solution: The present invention includes the following steps:
[0007] (1) Acquire brain signals, obtain EEG datasets, and analyze the characteristics of brain signals;
[0008] (2) Preprocess the EEG signal, select independent component analysis to remove noise from the EEG, and select appropriate EEG segments to realize data segmentation technology;
[0009] (3) Convert the EEG fragment into a two-dimensional image;
[0010] (4) Extract the multifractal spectrum features of two-dimensional images using the improved two-dimensional MFDFA algorithm;
[0011] (5) Construct a convolutional neural network as an epilepsy detection model, select appropriate multifractal spectrum features as model input features, and train the neural network model based on the data training set;
[0012] (6) Input the trained network parameters into the test set to achieve epilepsy detection.
[0013] Furthermore, the selection of the EEG dataset in step (1) is based on the available benchmark Bern-Barcelona database.
[0014] Further, step (2) divides the EEG signal into time series segments of 256 samples, and then converts them into an image of size 256×256 pixels.
[0015] Further, step (3) uses the MTF algorithm to convert the one-dimensional EEG signal into a two-dimensional image, including:
[0016] (31) Given a time series of EEG signals x(t), t = 1, 2, ..., N, where N is the total number of data points, divide the data into Q quantile bins according to its value range, and assign each x... i Assigned to the corresponding box q j j∈[1,Q];
[0017] (32) Construct the Markov transition matrix W, and calculate the transition between quantile bins in the manner of a first-order Markov chain along the time axis, thereby constructing the Q×Q weighted adjacency matrix W. The calculation formula is as follows:
[0018]
[0019] Among them, w i,j From quantile q j A point followed by a quantile q i The frequency of a point is given, after After normalization, W is the Markov transition matrix;
[0020] (33) Construct a Markov transition field M with matrix size [N, N], and the value of M[i, j] is W[q]. i q j ],
[0021]
[0022] A Q×Q Markov transition matrix W is constructed by dividing the data size into Q quantile bins, where the quantile bins containing data at time steps i and j are q. i and q j In MTF, M[i,j] represents q i →q j The transition probability, M i,j||i-j|=k This represents the transition probability between points with a time interval of k.
[0023] Furthermore, in step (33), the main diagonal M[i,j] is a special case when k=0, capturing the probability from each quantile to itself at time step i, by using a fuzzy kernel. The MTF size is reduced by averaging the pixels in each non-overlapping m×m patch and aggregating the transition probabilities in each subsequence of length m.
[0024] Furthermore, step (3) divides the entire range of EEG signals into smaller time periods of 256 samples for MTF calculation, collecting a total of 780 images from various EEG records in the BemEEG dataset.
[0025] Further, step (4) includes first segmenting the EEG image into different pixel intervals, then calculating the cumulative sum of the pixel intervals, then calculating the residual matrix using a descent function, calculating the global descent fluctuation function for all pixels, and finally changing the value of the scale s to determine the scale s and the fluctuation function F. q The scaling relationship between (s) allows us to obtain the corresponding improved mass index function τ(q) for each q value. The singularity index function α(q) and the singularity spectrum f(α) can be calculated through Legendre transformation.
[0026] Further, step (4) includes:
[0027] (41) A self-similar image is represented by a two-dimensional array X(i,j), where i = 1, 2, ..., N1, j = 1, 2, ..., N2, and the image is divided into N... 1s ×N 2s N are non-overlapping pixel intervals of the same size s×s, where N 1s = [N1 / s], N 2s = [N² / s], where each pixel interval is represented by X.v,w Therefore, X v,w (i, j)=X(l1+i, l2+j), 1≤i, j≤s, where, l1=(v-1)s, v=1, 2,...N 1s , l2=(w-1)s, w=1, 2,...N 2s ;
[0028] (42) For each pixel interval X marked with v and w v,w Accumulation, and u v,w The formula for calculating (i, j) is:
[0029]
[0030] Where i, j = 1, 2, ..., s, and u v,w It is itself an image;
[0031] (43) Constructing image u v,w The trend is determined using a pre-selected two-variable polynomial function. To fit the data, the residual matrix after fitting is:
[0032]
[0033] Pixel Block X v,w The descending trend function F v,w (s) is derived from the residual matrix ε v,w The sample variance of (i, j) is defined as follows:
[0034]
[0035] (44) Calculate the global descending oscillation function for all pixel intervals:
[0036]
[0037] q can take any real value other than q = 0;
[0038] (45) Change the value of the scale s, from s min ≈6 to The changes between these parameters determine the scale s and the wave function F. q Scale relationship between (s):
[0039] F q (s)~s H(q)
[0040] For each value of q, the corresponding improved quality exponent function τ(q) can be obtained:
[0041] τ(q)=[qH(q)-D f ]1 / q
[0042] Where D f Topological dimension, obtaining the extended fractal dimension D q The singularity exponential function α(q) and the singularity spectrum f(α) are calculated using the Legendre transform:
[0043] α(q)=dτ(q) / dq
[0044] f(α)=inf q [qα(q)-τ(q)]
[0045] The multifractal spectrum of the time series is obtained by using the multifractal spectrum calculation formula f(α).
[0046] Furthermore, step (5) employs three convolutional layers with ReLU activation functions, batch processing normalization and max pooling layers, and then uses the Sigmoid activation function to extract high-level features from the dense layer. The last classification layer consists of the SoftMax activation function, used for binary classification of normal and focal GASF.
[0047] Furthermore, step (6) uses the best neural network model obtained from the training set to provide classification results. The experimental results are evaluated using accuracy, precision, sensitivity, and specificity as follows:
[0048]
[0049]
[0050]
[0051]
[0052] Wherein, TP represents the frequency of predicting positive samples as positive, TN represents the frequency of predicting negative samples as negative, FP represents the frequency of predicting negative samples as positive, FN represents the frequency of predicting positive samples as negative, ACC represents accuracy, PPV represents precision, SEN represents sensitivity, and SPE represents specificity.
[0053] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis can reduce signal pseudo-fluctuation error and improve the effectiveness and rationality of the algorithm; it makes full use of the advantages of deep learning methods in EEG signal image classification tasks, uses MTF images to detect focal seizures, extracts the multifractal spectrum features of the improved two-dimensional MFDFA, and realizes a feature-based CNN model for detecting epilepsy through MTF images, further improving the accuracy of epilepsy detection, as well as its generalization and robustness in complex noise backgrounds. Attached Figure Description
[0054] Figure 1 This is a schematic diagram of the structure of the present invention. Detailed Implementation
[0055] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0056] like Figure 1 As shown, the present invention includes:
[0057] (1) Electroencephalogram (EEG) signals were acquired to obtain an EEG dataset, and the characteristics of the EEG signals were analyzed. The available benchmark Bern-Barcelona (Bern) database was considered. This database was originally recorded by Andrejak et al. from normal and epileptic patients, and can be divided into normal and epileptic types according to the amplitude level of the EEG. The dataset includes EEG recordings from five patients with drug-resistant temporal lobe epilepsy, of which 3750 are focal and 3750 are nonfocal bivariate EEG files. Three patients were seizure-free, and two patients had only aura after surgery, but no other seizures. Multichannel EEG signals were recorded using intracranial strips and deep electrodes. Electrode implantation used 10-20 bits. The EEG signal sampling frequency was 512 Hz. Based on the intracranial EEG recordings, they were able to locate the brain regions where seizures began in all five patients.
[0058] (2) The EEG signal was preprocessed. Independent component analysis (ICA) was used to remove noise from the EEG, and appropriate EEG segments were selected to implement data segmentation technology. Detecting the entire EEG sample in the dataset is very complex and time-consuming. In order to detect epilepsy more accurately, the selected EEG signal was denoised. Independent component analysis (ICA) was used to remove muscle artifacts in the EEG signal to obtain a clean EEG signal. Then, in order to minimize the analysis time / cost, a data segmentation technique was implemented to segment the test EEG signal into time series segments of 256 samples, and then convert them into images of size 256×256 pixels.
[0059] (3) Convert the EEG fragments into two-dimensional images; use the MTF algorithm to convert the one-dimensional EEG signal into a two-dimensional image, and extend this idea by sequentially representing the Markov transition probabilities to preserve temporal information. The specific implementation is as follows:
[0060] (31) Given a time series of EEG signals x(t), t = 1, 2, ..., N (N is the total number of data), divide it into Q quantile bins according to its value range, and assign each x... i Assigned to the corresponding box q j (j∈[1,Q]);
[0061] (32) Construct the Markov transition matrix W, and calculate the transition between quantile bins in the manner of a first-order Markov chain along the time axis, thereby constructing the Q×Q weighted adjacency matrix W. The calculation formula is as follows:
[0062]
[0063] w i,j From quantile q j A point followed by a quantile q i The frequency of a point is given, after After normalization, W is the Markov transition matrix. It is insensitive to the distribution of x(t) and its time dependence on the time step t.
[0064] (33) Construct a Markov transition field M with matrix size [N, N], and the value of M[i, j] is W[q]. i q j ],
[0065]
[0066] A Q×Q Markov transition matrix (W) is constructed by dividing the data (size) into Q quantile bins, where the quantile bins containing data at time steps i and j (time axis) are q. i and q j In MTF, M[i,j] represents q i →q j The transition probabilities. In other words, by considering the time position, we expand the matrix W, which contains the transition probabilities on the amplitude axis, into the MTF matrix.
[0067] By assigning the probability of the quantile of time step i at each pixel M[i,j] to the quantile of time step j, the MTF effectively encodes the multi-span transition probability of the time series. i,j||i-j|=k This represents the transition probability between points with a time interval of k. For example, M i,j||i-j|=1This represents a jump along the time axis. The main diagonal M[i, j] is a special case when k = 0, capturing the probability of transitioning from each quantile to itself at time step i (self-transition probability). To make the image size easier to manage and computationally more efficient, we use a blur kernel. The MTF size is reduced by averaging the pixels in each non-overlapping m×n patch, that is, by aggregating the transition probabilities in each subsequence of length m.
[0068] Each EEG segment was sampled with 256 samples, resulting in MTF images [256, 128]. The Bern EEG dataset consists of single-channel recordings of normal and focal EEG signals. The entire range of EEG signals (10240 samples / sampling rate = 512 Hz) was divided into smaller time intervals of 256 samples for MTF calculation. A total of 780 images were collected from various EEG recordings in the BernEEG dataset, which comprises 199,680 time samples.
[0069] (4) The improved two-dimensional MFDFA algorithm is used to extract the multifractal spectrum features of the two-dimensional image. First, the EEG image is segmented into different pixel intervals. Then, the cumulative sum of the pixel intervals is calculated. Next, the residual matrix is calculated using the descent function. Then, the global descent fluctuation function is calculated for all pixels. Finally, the value of the scale s is changed to determine the scale s and the fluctuation function F. q To reduce pixel fluctuation errors in the image, the scale relationship between (s) is used. For each q value, an improved quality index function τ(q) can be obtained. The singularity index function α(q) and the singularity spectrum (or singularity dimension) f(α) are calculated through Legendre transformation. The specific implementation is as follows:
[0070] (41) A self-similar (or self-affine) image can be represented by a two-dimensional array x(i, j), where i = 1, 2, ..., N1, j = 1, 2, ..., N2. This image can be divided into N... 1s ×N 2s N are non-overlapping pixel intervals of the same size s×s. 1s = [N1 / s], N 2s = [N² / s]. Each pixel interval is represented by X. v,w Therefore, X v,w (i, j)=X(l1+i, l2+j), 1≤i, j≤s, where, l1=(v-1)s, v=1, 2,...N 1s , l2=(w-1)s, w=1, 2,...N 2s ;
[0071] (42) For each pixel interval X marked with v and wv,w , cumulative sum u v,w The formula for calculating (i, j) is:
[0072]
[0073] Where i, j = 1, 2, ..., s. Note u v,w It is itself an image;
[0074] (43) The constructed image u v,w The trend can be represented by a pre-selected two-variable polynomial function. To fit the function, the simplest function is a plane. During the research, we used the following five descending trends to verify the effectiveness of the algorithm:
[0075]
[0076]
[0077]
[0078]
[0079]
[0080] Where 1 ≤ i, j ≤ s. Parameters α, b, c, d, e, and f are undetermined free parameters. These parameters can be obtained numerically using the least squares method and simple matrix operations. Next, the residual matrix is calculated:
[0081]
[0082] Pixel Block X v,w The descending trend function F v,w (s) is derived from the residual matrix ε v,w The sample variance of (i, j) is defined as follows:
[0083]
[0084] (44) Calculate the global descending oscillation function for all pixel intervals:
[0085]
[0086] Here, q can take any real value other than q=0. When q=0, according to L'Hospital's rule, the calculation formula is as follows:
[0087]
[0088] (45) Change the value of the scale s, from smin ≈6 to The changes between these values can determine the scale s and the wave function F. q Scale relationship between (s):
[0089] F q (s)~s H(q)
[0090] To reduce pixel fluctuation errors in an image, for each q value, a corresponding improved quality exponent function τ(q) can be obtained:
[0091] τ(q)=[qH(q)-D f ] 1 / q
[0092] Where D f Topological dimension, for a two-dimensional signal sequence, D f =2, therefore the extended fractal dimension D is easily obtained. q The singularity exponential function α(q) and the singularity spectrum (or singularity dimension) f(α) are calculated using the Legendre transformation:
[0093] α(q)=dτ(q) / dq
[0094] f(α)=inf q [qα(q)-τ(q)]
[0095] The multifractal spectrum of a time series can be obtained using the multifractal spectrum calculation formula f(α). For the left endpoint of the multifractal spectrum, the singularity index α is used. min The horizontal axis represents the point, reflecting the degree of large fluctuations in the signal. α0 is the singularity index of the apex of the multifractal spectrum, corresponding to the most probable subset of the time series. The right endpoint is α. max This reflects the degree of small fluctuations in the signal, with a spectral width Δα = α. max -α min It reflects the degree of unevenness in signal fluctuations.
[0096] (5) Step S5: Construct a convolutional neural network (CNN) as an epilepsy detection model, select appropriate multifractal spectrum features as model input features, and train the neural network model based on the data training set; including:
[0097] After feature extraction, the singularity index at the left endpoint, the singularity index at the top, and the spectral width of the multifractal spectrum are used as the feature set. 80% of this feature set is selected as the training set, and 20% as the CNN test set. This invention employs a custom CNN model for EEG signal classification, such as... Figure 1As shown, the proposed DNN architecture is used to classify normal and focused MTF images. In this work, a transfer learning method is implemented with a pre-trained CNN. The pre-trained CNN architecture preserves the weight configuration of the deep neural layers, and the top layers are retrained to solve the MTF image classification problem.
[0098] Table 1. Configuration of the custom CNN architecture used for EEG analysis
[0099]
[0100] This application employs three convolutional layers with ReLU activation, followed by batch normalization (BN) and max pooling layers, and then uses the Sigmoid activation function for high-level feature extraction from the dense layers. The final classification layer consists of a SoftMax activation function for binary classification of normal and focal GASF. Detailed configurations of the various processing modules of the CNN model are shown in Table 1. Furthermore, the training sequence of the custom model involves checkpointing, where the accuracy of the validation is monitored over 10 trials. The weight parameters with the highest validation accuracy are stored for performance evaluation of the custom CNN model.
[0101] (6) Input the trained network parameters into the test set to achieve epilepsy detection; input the trained network parameters into the test set to achieve epilepsy detection; give the classification result of the best neural network model obtained from the training set, and evaluate the experimental results using accuracy (ACC), precision (PPV), sensitivity (SEN), and specificity (SPE), as shown in the following formula:
[0102]
[0103]
[0104]
[0105]
[0106] Wherein, TP represents the frequency of predicting a positive sample as positive, TN represents the frequency of predicting a negative sample as negative, FP represents the frequency of predicting a negative sample as positive, and FN represents the frequency of predicting a positive sample as negative.
Claims
1. A method for epilepsy detection based on Markov transformation fields and an improved two-dimensional multifractal analysis, characterized in that: Includes the following steps: (1) Acquire EEG signals, obtain EEG datasets, and analyze the characteristics of EEG signals; (2) Preprocess the EEG signal, select independent component analysis to remove noise from the EEG, and select EEG segments to realize data segmentation technology; (3) Convert the EEG fragment into a two-dimensional image; (4) Extract the multifractal spectrum features of two-dimensional images using the improved two-dimensional MFDFA algorithm; (5) Construct a convolutional neural network as an epilepsy detection model, select multifractal spectrum features as model input features, and train the neural network model based on the data training set; (6) Input the trained network parameters into the test set to achieve epilepsy detection; Step (3) divides the entire range of EEG signals into smaller time periods of 256 samples for MTF calculation, collecting a total of 780 images from various EEG records in the BernEEG dataset. Step (4) includes: (41) A self-similar image, represented by a two-dimensional array It means that among them , The image was divided into Each pair of non-overlapping elements has the same size. The pixel range, where, , Each pixel range is used Therefore , ,in, , ; (42) For each use and Marked pixel range Accumulation, sum The calculation formula is: in, ,in It is itself an image; (43) Constructing images The trend is determined using a pre-selected two-variable polynomial function. To fit the data, the residual matrix after fitting is: Pixel Blocks Descending function From the residual matrix The sample variance is defined as follows: ; (44) Calculate the global descending oscillation function for all pixel intervals: Pick Any real value other than; (45) Change the scale The value ranges from arrive Changes between them determine the scale. and wave function Scale relationship between them: For each The value is used to obtain the corresponding improved quality index function. : in Topological dimension, obtaining the extended fractal dimension. The singularity exponential function is calculated using the Legendre transformation. and the spectrum of singularity : According to the multifractal spectrum calculation formula The multifractal spectrum of the time series was obtained.
2. The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis according to claim 1, characterized in that: The selection of the EEG dataset in step (1) is based on the available benchmark Bern-Barcelona database.
3. The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis according to claim 1, characterized in that: Step (2) divides the EEG signal into time series segments of 256 samples, and then converts them into... Image in pixels.
4. The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis according to claim 1, characterized in that: Step (3) uses the MTF algorithm to convert the one-dimensional EEG signal into a two-dimensional image, including: (31) Given the time series of EEG signals , , The total number of data points is divided into categories according to their value range. quantile bins, and each Assigned to the corresponding boxes ; (32) Construct the Markov transition matrix The transformation between quantile bins is calculated using a first-order Markov chain along the time axis, thereby constructing... Weighted adjacency matrix The calculation formula is as follows: in, From quantiles A point followed by a quantile The frequency of a point is given, after After normalization, The Markov transition matrix; (33) Constructing a Markov transition field The matrix size is , The value is , By dividing the data size into To construct quantile bins Markov transition matrix Including time step and time step The quantile bins of the data are and In MTF express The transition probability, This represents the transition probability between points with a time interval of k.
5. The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis according to claim 4, characterized in that: In step (33), the main diagonal yes Special cases at time step Capture the probability from each quantile to itself by using a fuzzy kernel. Average of each non-overlapping The pixels in the patch are used to reduce the MTF size, and each pixel is of length 1. The transition probabilities in the subsequences are aggregated together.
6. The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis according to claim 1, characterized in that: Step (4) includes first segmenting the EEG image into different pixel intervals, then calculating the cumulative sum of the pixel intervals, then calculating the residual matrix using a descent function, calculating the global descent fluctuation function for all pixels, and finally changing the scale. The value determines the scale. and wave function The scale relationship between them, for each The value is used to obtain the corresponding improved quality index function. The singularity exponential function is calculated using the Legendre transformation. and the spectrum of singularity .
7. The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis according to claim 1, characterized in that: Step (5) employs three convolutional layers with ReLU activation functions, batch processing normalization and max pooling layers, and then uses the Sigmoid activation function to extract high-level features from the dense layer. The last classification layer consists of the SoftMax activation function, which is used to perform binary classification of normal and focal GASF.
8. The epilepsy detection method based on Markov transition field and improved two-dimensional multifractal analysis according to claim 1, characterized in that: Step (6) provides the classification results of the neural network model obtained from the training set. The experimental results are evaluated using accuracy, precision, sensitivity, and specificity as follows: Wherein, TP represents the frequency of predicting positive samples as positive, TN represents the frequency of predicting negative samples as negative, FP represents the frequency of predicting negative samples as positive, FN represents the frequency of predicting positive samples as negative, ACC represents accuracy, PPV represents precision, SEN represents sensitivity, and SPE represents specificity.
Citation Information
Patent Citations
Recognition method of epileptic electroencephalograph based on two-dimensional time-frequency image depth convolution neural network
CN106909784A
Epileptic seizure detection system based on attention mechanism
CN115359909A