Seizure signal detection method based on fuzzy clustering and long short-term memory network
By using a two-level classifier consisting of fuzzy clustering and long short-term memory networks, combined with physiological signals collected by a wristwatch, the portability and accuracy issues of epilepsy seizure detection in existing technologies have been resolved, achieving efficient and real-time epilepsy seizure identification.
Patent Information
- Application Number
- CN202410977726.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-07-22
AI Technical Summary
Existing methods for detecting epileptic seizures suffer from problems such as large and portable equipment, susceptibility to signal interference, low detection performance, high computational requirements, long model training time, and a lack of balanced samples during and outside seizures, resulting in low detection accuracy.
A two-level classifier based on fuzzy clustering and long short-term memory network is used to collect acceleration, angular velocity and surface electromyography signals through a wristwatch device. Data segmentation, filtering, feature extraction and normalization are performed. Fuzzy C-means clustering and LSTM network are combined to identify and determine epileptic seizure signals.
It achieves portable, real-time, and efficient epileptic seizure detection, improves detection accuracy and practicality, reduces algorithm complexity, enhances the model's ability to generalize to new data, and reduces the false positive rate.
Smart Images

Figure CN118902392B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine learning and pattern recognition technology, and specifically relates to a method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks. It combines fuzzy C-means clustering and long short-term memory network algorithms to improve the accuracy and efficiency of epileptic seizure signal detection. Background Technology
[0002] Epilepsy is a relatively common neurological disorder, affecting approximately 50 million people worldwide. The main characteristic of epilepsy is sudden, recurrent, and unannounced abnormal neuronal discharges, leading to temporary brain dysfunction. This dysfunction may manifest as sensory disturbances, loss of consciousness, limb convulsions, or even complete loss of consciousness and rigidity, the so-called "grand mal seizure." The frequency and severity of epileptic seizures significantly impact a patient's quality of life.
[0003] Currently, methods for detecting epileptic seizure signals based on electroencephalogram (EEG) signals have relatively stringent requirements for signal acquisition quality. Acquisition requires professional guidance and is difficult to perform outside of hospitals, resulting in relatively high costs. EEG devices are bulky and difficult to carry, hindering monitoring of epilepsy patients in daily life. Furthermore, EEG signals are easily interfered with by external signals, leading to frequent signal misinterpretations and low detection performance when using EEG signals alone.
[0004] Methods for detecting epileptic seizures based on electrocardiogram (ECG) signals also face the challenge of difficult signal acquisition. Furthermore, ECG signals are easily interfered with by other vigorous activities, exhibiting poor stability and resulting in relatively large errors. Therefore, existing solutions place relatively high demands on the computing speed and battery life of the hardware, which also limits the miniaturization of the devices.
[0005] Patent application CN202410322510.4 discloses a real-time detection system for single-channel EEG signals in epilepsy patients. The system calculates the first slope of the EEG signal in the time domain and compares it with a standard slope to obtain a first comparison result. It then performs a Fast Fourier Transform (FFT) on the EEG signal within a measurement time window to obtain the corresponding frequency domain information. A power processing module acquires the first power of the EEG signal within the measurement time window and compares it with a standard power to obtain a second comparison result. Based on the second comparison result, the system labels the EEG signal within the measurement time window. However, this system has two main drawbacks: first, it uses a bulky EEG device for epilepsy detection, which is inconvenient for patients' daily lives; second, the system only uses basic signal processing and feature extraction for comparison with a standard slope, lacking universality for epilepsy detection.
[0006] Patent application CN201910967804.1 discloses a method for predicting epilepsy EEG based on a combination of convolutional and recurrent neural networks with temporal multi-scale processing. This method divides the EEG signals of N-channel epilepsy patients into interictal and pre-ictal data based on their proximity to the seizure, performs sliding window segmentation, and adds pre-ictal samples. Interictal samples do not overlap. The preprocessed samples are then subjected to three-layer wavelet packet decomposition to obtain wavelet coefficients for eight frequency bands. The corresponding time-domain signals are then reconstructed, and the inter-electrode correlation coefficients are extracted as a feature matrix before being input into a convolutional network. The high-level representation of the epilepsy EEG signals is learned through continuous data fusion via convolutional kernels. However, this technique has several drawbacks: first, it does not balance the seizure- and non-seizure-phase samples, potentially causing the model to favor non-seizure-phase samples; second, the model training only uses frequency-domain features, losing the high-level representation of time-domain features, which may result in low training accuracy; and third, it does not perform channel selection, using all EEG signal data from N-channel epilepsy patients as model input, leading to long training times and high hardware requirements.
[0007] Currently, no effective solution has been proposed to address the low performance of existing epileptic seizure detection technologies. Therefore, developing an accurate, efficient, and easy-to-implement method for detecting epileptic seizure signals is of significant clinical importance. Summary of the Invention
[0008] To overcome the shortcomings of existing epilepsy seizure detection algorithms and better meet the requirements of current acquisition devices for high real-time performance, portability, and low cost, this invention provides an epilepsy seizure signal detection method based on fuzzy clustering and long short-term memory networks. By analyzing physiological signals and using a two-level classifier, the algorithm complexity is reduced and its real-time performance is improved through the screening of motion states. At the same time, by combining fuzzy C-means clustering and long short-term memory networks, the utilization rate of temporal information is improved, effectively enhancing the algorithm performance and enabling rapid and accurate determination of epilepsy seizures, thereby improving the accuracy and practicality of epilepsy seizure detection.
[0009] To achieve the above objectives, the technical solution of the present invention is as follows:
[0010] A method for detecting seizure signals based on fuzzy clustering and long short-term memory networks includes the following steps:
[0011] Step 1: Data Acquisition and Preprocessing; Using a wristwatch device equipped with an accelerometer, gyroscope, and surface electromyography (EMG) sensor, continuously acquire the user's acceleration, angular velocity, and surface EMG signals. Segment the raw data, assess signal quality by threshold detection within the mean range of the EMG signals, and use a digital filter for noise reduction.
[0012] Step 2: Feature extraction; feature extraction is performed on samples with acceptable signal quality, and feature values are obtained through linear interpolation for samples with unacceptable signal quality, followed by data normalization.
[0013] Step 3: Fuzzy C-means clustering (FCM); Input the features extracted from each sample into the fuzzy C-means clustering (FCM) model to perform motion pattern recognition on the samples and divide the samples into non-seizure samples and potential seizure samples. The seizure probability of non-seizure samples is zero, while the seizure probability of potential seizure samples needs to be further analyzed to determine the seizure probability.
[0014] Step 4: Long Short-Term Memory (LSTM) classification; Based on the output of the FCM model in Step 3, reconstruct the potential seizure samples and input them into the LSTM model for training. Estimate the seizure probability of the potential seizure samples based on the trained LSTM model.
[0015] Step 5: Post-processing and seizure judgment; Forward mean filtering is applied to the sample seizure probabilities output by the FCM model and LSTM model. If nine consecutive sample outputs exceed a predefined threshold, they are considered as epileptic seizure events; If multiple seizure events occur within 5 minutes, they are considered as the same epileptic seizure event.
[0016] In step one, the wristwatch device is a wearable physiological signal acquisition device worn on the wrist, which collects physiological signals through semi-embedded electrodes that come into contact with the skin.
[0017] The acquired acceleration, angular velocity, and surface electromyography signals include both episodic and non-epileptic states. The acquisition duration is t (seconds), the number of acquisition groups is l, and the sampling frequency is f. s The unit is Hz, meaning the time series has a total length of t×l×f. s Duration of acceleration, angular velocity, and surface electromyography signals;
[0018] During the data acquisition process, acceleration, angular velocity, and surface electromyography signals correspond to different sampling frequencies f. s .
[0019] In step one, the specific process of data preprocessing is as follows:
[0020] (1) Data partitioning
[0021] First, the data is divided into data segments of X seconds as samples, where 4≤X≤8. The data is then segmented using an X-second sliding time window with an overlap of X-1 seconds, and each subsequent sample maintains an 80% to 90% overlap with the previous sample.
[0022] (2) Signal quality assessment
[0023] Signal quality is assessed using the mean range. The mean range of a sample is defined as the difference between the maximum and minimum values of the signal average for each second within the sample's time window. The calculation formula is as follows:
[0024] RM = max(x) - min(x)
[0025] Where x represents a vector consisting of the mean of the electromyographic signal per second;
[0026] When the mean value of the electromyography signal of a sample exceeds 70 μV, the signal quality of the sample is considered unqualified; otherwise, the signal quality of the sample is considered qualified.
[0027] (3) Digital Filtering
[0028] For acceleration and angular velocity signals, Butterworth filters are used for 0.5Hz high-pass filtering and 15Hz low-pass filtering to remove interference signals;
[0029] For surface electromyography signals, a 10Hz high-pass filter was used with a Butterworth filter to remove low-frequency interference, and a notch filter was applied in the 49–51Hz range.
[0030] The feature extraction and normalization in step two are as follows:
[0031] (1) Feature extraction
[0032] Amplitude and frequency features are extracted from acceleration, angular velocity, and surface electromyography signals. Amplitude features include mean amplitude, root mean square, standard deviation, energy, quartiles, standard deviation, quartile range, kurtosis coefficient, skewness coefficient, histogram frequency, waveform length, Jerk, SD2, and number of zero crossings. Frequency features include relative power, median frequency, mean frequency, quantile frequency, peak frequency, maximum power spectral density, and power spectral standard deviation.
[0033] (2) Normalization
[0034] z-score normalization is performed on all features.
[0035] Among them, X norm X represents the normalized features, and X represents the original features. σ(X) represents the characteristic mean, and σ(X) represents the characteristic standard deviation.
[0036] The specific process of step three is as follows:
[0037] (3.1) Dataset partitioning
[0038] Divide the entire dataset into N equal-sized subsets, where 1 ≤ N ≤ 10; select one subset as the test set and the other N-1 subsets as the training set. Repeat this process at least five times to ensure that each subset is used as the test set once.
[0039] (3.2) Training set sampling
[0040] For each training set, systematic sampling is used to further divide the training set into M training subsets, with the initial sample indices being 1, 2, ..., M, resulting in training subsets D1, D2, ..., D... M
[0041] (3.3) Ranking of feature importance
[0042] For each training subset, calculate the Laplacian score and rank the features by importance;
[0043] (3.3.1) Construct a graph based on 10-nearest neighbors. The specific steps are as follows:
[0044] First, calculate the Euclidean distance between all sample points in the training subset:
[0045]
[0046] Where n represents the length of the sample feature sequence;
[0047] Then, determine the nearest neighbor region: for each data point, find the 10 closest other data points as its nearest neighbors; finally, construct the similarity matrix S. ij The data point x is calculated based on the Euclidean distance between the data points. i and x j Similarity between them:
[0048]
[0049] (3.3.2) Calculate the Laplacian fraction LS(f) r The specific process is as follows:
[0050] First, calculate the degree matrix D. ii :
[0051]
[0052] Then, construct the Laplacian matrix L:
[0053] L = D–S
[0054] Finally, the Laplacian score LS(f) for each feature is calculated. r ):
[0055] Define f r =[x 1r ,x 2r ,…,x mr ],make
[0056]
[0057] (3.3.3) Rank the features by importance;
[0058] Laplacian score LS(f) for each feature r Sort the features in ascending order. The position of a feature in the sorted feature sequence is defined as the rank of that feature, which ranges from 1 to 71. The smaller the rank of a feature, the more important the feature is.
[0059] (3.4) The number of clusters C and the number of features K in grid search;
[0060] (3.4.1) Initialization: Set the fuzzy coefficient m of FCM to between 1 and 2;
[0061] (3.4.2) Iteration: Perform grid search on the number of clusters C and the number of features K in each data subset. Arrange the features of acceleration and angular velocity in descending order of feature importance. In the wrap-around feature selection, use the first K features as the feature subset and C as the number of clusters to train the FCM model.
[0062] (3.4.3) Evaluation: The silhouette coefficient of all samples is used as the evaluation index of the FCM model;
[0063] First, calculate the silhouette coefficient s(i) for each sample:
[0064]
[0065] Where a(i) is the average distance from data point i to other points within its cluster:
[0066]
[0067] b(i) is the average distance from data point i to all points in its nearest other cluster:
[0068]
[0069] Then, calculate the silhouette coefficients for all samples:
[0070]
[0071] (3.4.4) Determine the optimal parameters: When the average silhouette coefficient of the M training subsets reaches the maximum value, the corresponding number of clusters C and the number of features K are optimal. The optimal feature subset is the set of the top K features with the highest average importance in the M training subsets.
[0072] (3.5) Training the FCM model
[0073] Based on the optimal subset and the number of clusters, the FCM model is trained and tested to determine which clusters may correspond to epileptic seizure signals. The specific process is as follows: the clusters are arranged in ascending order of distance from the cluster center to the origin, and the clusters are represented as G1, G2, etc., where G1 is regarded as non-seizure samples and other clusters are regarded as potential non-seizure samples.
[0074] Step four specifically involves:
[0075] (4.1) Reconstructing the LSTM training set
[0076] Based on the feature selection and parameter selection results of FCM, an LSTM model is trained on the entire training set. The input of the LSTM is all K features of s consecutive samples.
[0077] First, for each sample other than G1, the sample and the s-1 consecutive samples before it are combined to form an LSTM sample, and the corresponding sample label is the label of the last sample.
[0078] Then, based on the clustering result of the s-th sample in the LSTM samples, the LSTM samples are divided into C-1 training sets;
[0079] (4.2) Training the LSTM model
[0080] For these C-1 LSTM training sets, train LSTM models separately to obtain C-1 LSTM models. The specific structure of the LSTM models is as follows:
[0081] Input layer: The input to the LSTM model is an s*K time series with a sequence length of s and a feature dimension of K; while the feature extraction yields a 1*K feature sequence. Therefore, when the feature sequence of a sample is processed by the FCM model and input into the LSTM network, the current sample and its previous s-1 samples are concatenated into an LSTM sample, and the sample label is the label of the current sample, which is independent of the labels of the previous s-1 samples.
[0082] LSTM layer: contains multiple hidden layer units, and outputs a sequence;
[0083] Dropout layer: To prevent overfitting, a dropout layer is introduced, with the dropout rate set to 0 to 0.5;
[0084] The LSTM layer placed after the Dropout layer contains multiple hidden layer units and only outputs the prediction value at the last time step;
[0085] Fully connected layer: contains multiple neurons;
[0086] Activation function: The activation function chosen is the softmax function.
[0087]
[0088] Where i is 1 or 2; when i = 1, σ(z) i The probability that the sample represents a non-seizure sample; when i = 2, σ(z) i The probability that a sample represents an attack sample; z j Represents the input vector;
[0089] Output layer: The LSTM output is the probability that the sample is a non-seizure and seizure sample, and only the probability of the seizure sample is selected for output;
[0090] During LSTM training, the batch size is set to 2. N We selected the cross-entropy loss function as the cost function, used the Adam optimizer, set the learning rate to 0.000001 to 0.01, and set the number of iterations to 20 to 100. When the validation set loss is higher than the minimum loss for q consecutive iterations, we stopped the iteration, where q is 20% of the number of iterations.
[0091] (4.3) Testing the LSTM model
[0092] For each test set, the potential seizure period samples are reconstructed, input into the corresponding LSTM model for testing, and the seizure probability of the potential seizure period samples in the test set is estimated.
[0093] Step five specifically involves:
[0094] (5.1) Mean Filtering
[0095] Smooth all outputs using a 6-point forward mean filter:
[0096]
[0097] Among them, y i This represents the processed seizure probability, which is the average of the seizure probability of the current sample and the seizure probabilities of the previous 5 samples output by the model.
[0098] (5.2) Criteria for Judging Attack Events
[0099] If the output of 9 consecutive samples exceeds a predefined threshold, it is considered an outbreak event;
[0100] If multiple seizures occur within 5 minutes, they are considered as a single seizure.
[0101] Compared with the prior art, the present invention has the following advantages:
[0102] (1) In step one of the present invention, a wristwatch device is used to collect physiological signals, thereby realizing non-invasive attack detection, improving patient comfort and device convenience.
[0103] (2) Step 3 uses clustering for data preprocessing to improve algorithm efficiency: Fuzzy C-means clustering can effectively identify and handle uncertainty and fuzziness in the data by providing the membership degree of each data point to multiple clusters; this preprocessing reduces the data complexity that the subsequent LSTM classifier needs to process, especially in boundary decision making, which is more accurate and effective.
[0104] (3) Steps three and four build a two-layer classifier model to improve classification accuracy: By first performing fuzzy C-means clustering, the LSTM classifier can more accurately model key features, especially on the feature vectors formed by cluster centers. This not only improves the classification accuracy, but also enhances the model's ability to generalize to new data.
[0105] In summary, this invention analyzes physiological signals, uses a two-level classifier, and reduces algorithm complexity and improves real-time performance by filtering motion states. Simultaneously, it combines fuzzy C-means clustering and long short-term memory networks to improve the utilization of temporal information, effectively enhancing algorithm performance and enabling rapid and accurate determination of epileptic seizures, thereby improving the accuracy and practicality of epileptic seizure detection. Attached Figure Description
[0106] Figure 1 This is a flowchart of the algorithm used in this invention.
[0107] Figure 2 The spatial coordinate system of the physiological signal acquisition wristwatch device and internal sensors used in the experiment.
[0108] Figure 3 The results show the waveform of the electromyographic signal and its signal quality assessment, including: Figure 3 (a) in the image represents the electromyographic signal affected by motion artifacts. Figure 3 (b) in the figure represents the signal quality assessment result of the electromyographic signal.
[0109] Figure 4 The preprocessing includes the acceleration, angular velocity, electromyography signal waveforms, and power spectrum before and after processing. Figure 4 In the diagram, (a) shows the waveforms of the signal before and after preprocessing. Figure 4 (b) in the diagram represents the power spectrum of the signal before and after preprocessing.
[0110] Figure 5 The LTSM network architecture used.
[0111] Figure 6 The algorithm post-processing and seizure detection strategy is shown. The solid red line represents the sample seizure probability curve after mean filtering, the dashed red line represents the seizure probability threshold, and the arrow indicates that a seizure event has been detected. Detailed Implementation
[0112] The process and advantages of the present invention will now be described in detail with reference to the accompanying drawings.
[0113] The specific experiments of this invention were conducted under the Windows 10 (64-bit) operating system, with the overall operating environment based on Matlab R2020b.
[0114] Reference Figure 2 The wristwatch used in the experiment was the independently developed Biovital Epilepsy Watch, patent application number 202321390683.7. The detailed description of the device is as follows: The Biovital Epilepsy Watch is a wearable device that monitors and alerts to epileptic seizures by collecting multimodal biosignals from the wrist. It effectively reflects epileptic seizures by collecting biomarkers such as wrist acceleration, angular velocity, and surface electromyography, and trains a fusion analysis algorithm model based on the three-modal data to achieve epilepsy monitoring, alarm, and quantitative assessment.
[0115] Reference Figure 1 A method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks includes the following steps:
[0116] Step 1: Data Acquisition and Preprocessing; Using a wristwatch device equipped with an accelerometer, gyroscope, and surface electromyography (EMG) sensor, continuously acquire the user's acceleration, angular velocity, and surface EMG signals. Segment the raw data, assess signal quality by threshold detection within the mean range of the EMG signals, and use a digital filter for noise reduction.
[0117] Step 2: Feature extraction; feature extraction is performed on samples with acceptable signal quality, and feature values are obtained through linear interpolation for samples with unacceptable signal quality, followed by data normalization.
[0118] Step 3: Fuzzy C-means clustering (FCM); Input the features extracted from each sample into the fuzzy C-means clustering (FCM) model to perform motion pattern recognition on the samples and divide the samples into non-seizure samples and potential seizure samples. The seizure probability of non-seizure samples is zero, while the seizure probability of potential seizure samples needs to be further analyzed to determine the seizure probability.
[0119] Step 4: Long Short-Term Memory (LSTM) classification; Based on the output of the FCM model in Step 3, reconstruct the potential seizure samples and input them into the LSTM model for training. Estimate the seizure probability of the potential seizure samples based on the trained LSTM model.
[0120] Step 5: Post-processing and seizure judgment; Perform 6-dimensional forward mean filtering on the sample seizure probabilities output by the FCM model and LSTM model. If 9 consecutive sample outputs exceed the predefined threshold, it is considered a seizure event; if multiple seizure events occur within 5 minutes, they are considered the same seizure event.
[0121] In step one, the wristwatch device is a wearable physiological signal acquisition device worn on the wrist, which collects physiological signals through semi-embedded electrodes that come into contact with the skin.
[0122] The acquired acceleration, angular velocity, and surface electromyography signals include both episodic and non-epileptic states. The acquisition duration is t (seconds), the number of acquisition groups is l, and the sampling frequency is f. s The unit is Hz, meaning the time series has a total length of t×l×f. s Acceleration over time, angular velocity, and surface electromyography signals.
[0123] During the data acquisition process, acceleration, angular velocity, and surface electromyography signals each correspond to different sampling frequencies f. s The accelerometer and gyroscope used in this device have a sampling frequency of 50Hz, and the surface electromyography sampling frequency is 200Hz.
[0124] Taking acceleration signals as an example, the acquired acceleration signals are represented as follows: Where l represents the number of sets of accelerometer data collected, the number of sets corresponds to the number of data points from different individuals, t×f s The x represents the total length of the time series of the acquired acceleration signal, where x n (l) represents the acceleration signal under the nth index, which is a single number.
[0125] In step one, the specific process of data preprocessing is as follows:
[0126] (1) Data partitioning
[0127] First, the data is divided into 6-second data segments as samples, maintaining an 83% overlap with the previous sample, i.e., using a 6-second sliding time window with a 5-second overlap for data segmentation.
[0128] (2) Signal quality assessment
[0129] Since the raw signal of this method comes from the semi-embedded electrodes in the watch mechanism, when the watch is worn too loosely, there is a large gap between the electrodes and the skin. The electrical signals generated by muscle activity cannot be conducted to the electrode pads, resulting in a reduced signal-to-noise ratio of the electromyographic signal, which is not conducive to subsequent analysis. Therefore, before data analysis, it is necessary to conduct a quality assessment of the collected electromyographic signals. When abnormal signals caused by wearing the watch too loosely are detected, the subject should be reminded to adjust the watch wearing position, and this part of the data will not be included in the epileptic seizure detection.
[0130] Comparing the electromyographic (EMG) signals collected when the watch was worn too loose with normal EMG signals, it can be found that the average amplitude of the EMG signal decreases when the watch is worn too loose. Therefore, the mean range is used to assess the signal quality. The mean range of the sample is defined as the difference between the maximum and minimum values of the average signal value per second within the sample's time window. The calculation formula is as follows:
[0131] RM = max(x) - min(x)
[0132] Where x represents a vector consisting of the mean of the electromyographic signal per second;
[0133] refer to Figure 3 When the mean value of the electromyography signal of a sample exceeds 70 μV, the signal quality of the sample is considered unqualified; otherwise, the signal quality of the sample is considered qualified.
[0134] (3) Digital Filtering
[0135] refer to Figure 4 Digital filtering preprocessing was performed on the acceleration, angular velocity and electromyography signals respectively.
[0136] For acceleration and angular velocity signals, Butterworth filters were used for 0.5Hz high-pass filtering and 15Hz low-pass filtering to remove interference signals.
[0137] For surface electromyography signals, a 10Hz high-pass filter was used with a Butterworth filter to remove low-frequency interference, and a notch filter was applied in the 49–51Hz range.
[0138] The feature extraction and normalization in step two are as follows:
[0139] (1) Feature extraction
[0140] Seventy-one amplitude and frequency features were extracted from acceleration, angular velocity, and surface electromyography signals. The amplitude features included mean amplitude, root mean square, standard deviation, energy, quartiles, standard deviation, quartile range, kurtosis coefficient, skewness coefficient, histogram frequency, waveform length, Jerk, SD2, and number of zero crossings. The frequency features included relative power, median frequency, mean frequency, quantile frequency, peak frequency, maximum power spectral density, and power spectral standard deviation.
[0141] (2) Normalization
[0142] z-score normalization is performed on all features to transform them to the same scale for subsequent analysis;
[0143]
[0144] Among them, X norm X represents the normalized features, and X represents the original features. σ(X) represents the characteristic mean, and σ(X) represents the characteristic standard deviation.
[0145] In step three, the importance of features is first ranked according to the Laplacian score; then, the optimal number of clusters and the optimal feature subset of fuzzy C-means clustering (FCM) are determined by grid search; finally, an FCM model is established to identify the motion patterns of the samples, dividing the samples into different motion patterns and identifying non-seizure samples and potential seizure samples.
[0146] This method uses five-fold cross-validation for model training and evaluation. By randomly splitting the training set multiple times and averaging the results, the randomness of model performance evaluation is reduced, enhancing the model's generalization ability and providing more reliable performance estimation and adaptability. The specific process is as follows:
[0147] (3.1) Dataset partitioning
[0148] The entire dataset is randomly divided into 5 subsets of equal size;
[0149] Select one subset as the test set and the other four subsets as the training set in turn. Repeat this process five times to ensure that each subset is used as the test set once.
[0150] Parameter tuning and model training are performed on the training set, and the trained model is evaluated on the test set.
[0151] (3.2) Training set sampling
[0152] For each training set, a 10:1 systematic sampling method is used to divide the training set into 10 subsets, with the indices of the initial samples being 1, 2, ..., 10, resulting in subsets D1, D2, ..., D10.
[0153] Systematic sampling can effectively reduce evaluation errors caused by sample selection bias, and can reduce computational costs by reducing the size of the training set when dealing with very large datasets.
[0154] (3.3) Ranking of feature importance
[0155] For each subset Dn, calculate the Laplacian score and rank the features by importance;
[0156] a. Construct a graph based on 10-nearest neighbors, the specific steps are as follows:
[0157] First, calculate the Euclidean distance between all sample points in the subset:
[0158]
[0159] Where n represents the length of the sample feature sequence.
[0160] Then, determine the nearest neighbor region: for each data point, find the 10 closest other data points as its nearest neighbors; finally, construct the similarity matrix S. ij The data point x is calculated based on the Euclidean distance between the data points. i and x j Similarity between them:
[0161]
[0162] b. Calculate the Laplacian fraction LS(f) r The specific process is as follows:
[0163] First, calculate the degree matrix D. ii :
[0164]
[0165] Then, construct the Laplacian matrix L:
[0166]
[0167] Finally, the Laplacian score LS(f) for each feature is calculated. r ):
[0168] Define f r =[x 1r ,x 2r ,…,x mr ],make
[0169]
[0170] c. Rank the features by importance;
[0171] Laplacian score LS(f) for each feature r Sort the features in ascending order. The position of a feature in the sorted feature sequence is defined as the rank of that feature, which ranges from 1 to 71. The smaller the rank of a feature, the more important the feature is.
[0172] (3.4) Grid search: number of clusters C and number of features K.
[0173] a. Initialization: Set the fuzzy coefficient m of FCM to 1.2.
[0174] b. Iteration: Perform grid search on each dataset for the number of clusters C (2, 3, 4, 5) and the number of features K (1, 2, 3, 4, 5, 6). Arrange the 50 features of acceleration and angular velocity in descending order of feature importance. In the wrap-around feature selection, use the first K features as the feature subset and C as the number of clusters to train the FCM model.
[0175] c. Evaluation: The silhouette coefficient of all samples is used as the evaluation index of the FCM model.
[0176] First, calculate the silhouette coefficient s(i) for each sample:
[0177]
[0178] Where a(i) is the average distance (cohesion) from data point i to other points within its cluster:
[0179]
[0180] b(i) is the average distance (separation) from data point i to all points in its nearest other cluster:
[0181]
[0182] Then, calculate the silhouette coefficients for all samples:
[0183]
[0184] (d) Determine the optimal parameters. When the average silhouette coefficient of the 10 subsets reaches its maximum value, the corresponding number of clusters C and the number of features K are optimal. The optimal feature subset is the set of the top K features with the highest average importance among the 10 subsets.
[0185] (3.5) Training the FCM model
[0186] Based on the optimal subset and the number of clusters, the FCM model is trained and tested to determine which clusters may correspond to epileptic seizures. The specific process is as follows: the clusters are arranged in ascending order of distance from the cluster center to the origin, and the clusters are represented as G1, G2, etc., where G1 is regarded as non-seizure samples and other clusters are regarded as potential non-seizure samples.
[0187] In step four, firstly, the potential seizure-phase samples are reconstructed based on the FCM results of the training set to obtain the LSTM training set; then, the LSTM model is trained; finally, the seizure probability of the potential seizure-phase samples in the test set is estimated based on the trained LSTM model; specifically:
[0188] (4.1) Reconstructing the LSTM training set
[0189] Based on the feature selection and parameter selection results of FCM, an LSTM model is trained on the entire training set. The input of the LSTM is all the features of 6 consecutive samples.
[0190] First, for each sample other than G1, the sample and the five consecutive samples preceding it are combined to form an LSTM sample, and the corresponding sample label is the label of the last sample.
[0191] Then, based on the clustering result of the 6th sample in the LSTM samples, the LSTM samples are divided into C-1 training sets.
[0192] (4.2) Training the LSTM model
[0193] For these C-1 LSTM training sets, train LSTM models separately to obtain C-1 LSTM models.
[0194] LSTM model structure as follows Figure 5 As shown, the details are as follows:
[0195] Input layer: The input to the LSTM model is a 6*71 time series with a sequence length of 6 and a feature dimension of 71; while the feature extraction yields a 1*71 feature sequence. Therefore, when the feature sequence of a sample is processed by the FCM model and input into the LSTM network, the current sample and its five previous samples are concatenated into an LSTM sample. The sample label is the label of the current sample, which is independent of the labels of the five previous samples.
[0196] LSTM layer: Contains 100 hidden layer units, output is a sequence;
[0197] Dropout layer: To prevent overfitting, a dropout layer is introduced, with the dropout rate set to 0.2;
[0198] The LSTM layer placed after the Dropout layer contains 50 hidden layer units and only outputs the prediction value at the last time step.
[0199] Fully connected layer: contains 2 neurons;
[0200] Activation function: The activation function chosen is the softmax function.
[0201]
[0202] Where, σ(z) i zj represents the probability that a sample is an epileptic sample (i=2) and the probability that a sample is a non-episode sample (i=1), and zj represents the input vector.
[0203] Output layer: The LSTM output is the probability that the sample is a non-seizure sample and a seizure sample. This method only selects to output the probability of a seizure sample.
[0204] During LSTM training, the batch size was set to 1000, the cross-entropy loss function was selected as the cost function, the Adam optimizer was used, the learning rate was 0.001, the maximum number of iterations was 50, and the iteration was stopped when the validation set loss was higher than the minimum loss for 10 consecutive iterations.
[0205] (4.3) Testing the LSTM model
[0206] For each test set, the potential seizure period samples are reconstructed, input into the corresponding LSTM model for testing, and the seizure probability of the potential seizure period samples in the test set is estimated.
[0207] Step five can be referred to. Figure 6 Specifically:
[0208] (5.1) Mean Filtering
[0209] A 6-point forward mean filter is used to smooth all outputs and suppress noise interference.
[0210]
[0211] Among them, y i This represents the processed seizure probability, which is the average of the seizure probability of the current sample and the seizure probabilities of the previous 5 samples output by the model.
[0212] (5.2) Criteria for Judging Attack Events
[0213] If the output of 9 consecutive samples exceeds a predefined threshold, it is considered an outbreak event.
[0214] If multiple seizures occur within 5 minutes, they are considered as a single seizure.
[0215] Model evaluation of the present invention
[0216] The performance of the seizure detection algorithm was evaluated by comparing the results with actual labels. If the algorithm detected a seizure during the seizure period, it was considered a true positive (TP). If the algorithm did not detect a seizure during the seizure period, it was considered a false negative (FN). If the algorithm detected a seizure outside the specified time period, it was considered a false positive (FP). The selected evaluation metrics included:
[0217] Sensitivity (SEN): The proportion of true positive events out of all occurrences.
[0218]
[0219] False detection rate (FDR): Defined as the average number of false positive events per 24 hours.
[0220]
[0221] SF: A comprehensive indicator of sensitivity and false detection rate.
[0222]
[0223] in, This represents the processed false positive rate. Its value is 1 if the original false positive rate is higher than 1 / 24h; otherwise, it is the same as the original false positive rate.
[0224] Detection delay time: The difference between the time it takes for the model to detect the seizure event and the time the seizure begins, in seconds.
[0225] Table 1 shows the five-fold cross-validation results of this epilepsy seizure detection algorithm. The table shows a total sensitivity of 98.33%; the average false alarm rate over 24 hours is only 2.14%, meaning only 2 out of every 100 patients experience a false alarm within 24 hours; and the detection delay is only about 30 seconds, indicating that it can quickly detect epilepsy seizures and generate an alarm effect. This demonstrates that the invention has advantages such as high sensitivity, low false alarm rate, and low delay, enabling rapid and accurate determination of epilepsy seizures.
[0226] Table 1. Five-fold cross-validation results of the epilepsy seizure detection algorithm.
[0227] test set SEN FDR / 24h SF Detection delay time / s 1 1.0000 0.0000 1.0000 34±14 2 1.0000 0.0000 1.0000 32±12 3 1.0000 0.0363 0.9820 31±12 4 1.0000 0.0658 0.9677 34±18 5 0.9167 0.0000 0.9592 27±11 overall 0.9833 0.0214 0.9810 31±14 。
Claims
1. A method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks, characterized in that, Includes the following steps: Step 1: Data Acquisition and Preprocessing; Using a wristwatch device equipped with an accelerometer, gyroscope, and surface electromyography (EMG) sensor, the device continuously collects the user's acceleration, angular velocity, and surface EMG signals. The raw data is segmented, signal quality is assessed by threshold detection of the mean range of EMG signals, and digital filters are used for filtering and noise reduction. Step 2: Feature extraction; feature extraction is performed on samples with acceptable signal quality, and feature values are obtained through linear interpolation for samples with unacceptable signal quality, followed by data normalization. Step 3: Fuzzy C-means Clustering (FCM); The features extracted from each sample are input into the fuzzy C-means clustering FCM model to identify the motion patterns of the samples. The samples are divided into non-seizure samples and potential seizure samples. The seizure probability of non-seizure samples is zero, while the seizure probability of potential seizure samples needs to be further analyzed to determine the seizure probability. Step 4: Long Short-Term Memory (LSTM) classification; Based on the output of the FCM model in Step 3, reconstruct the potential seizure samples and input them into the LSTM model for training. Estimate the seizure probability of the potential seizure samples based on the trained LSTM model. Step 5: Post-processing and seizure judgment; Forward mean filtering is performed on the sample seizure probabilities output by the FCM model and LSTM model. If the output of 9 consecutive samples exceeds the predefined threshold, it is considered an epileptic seizure event. If multiple seizures occur within 5 minutes, they are considered as a single epileptic seizure event.
2. The method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks according to claim 1, characterized in that, In step one, the wristwatch device is a wearable physiological signal acquisition device worn on the wrist, which collects physiological signals through semi-embedded electrodes that come into contact with the skin. The acquired acceleration, angular velocity, and surface electromyography signals include both episodic and non-epileptic states. The acquisition duration is t (seconds), the number of acquisition groups is l, and the sampling frequency is f. s The unit is Hz, meaning the time series has a total length of t×l×f. s Duration of acceleration, angular velocity, and surface electromyography signals; During the data acquisition process, acceleration, angular velocity, and surface electromyography signals correspond to different sampling frequencies f. s .
3. The method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks according to claim 1, characterized in that, In step one, the specific process of data preprocessing is as follows: (1) Data partitioning First, the data is divided into data segments of X seconds as samples, where 4≤X≤8. The data is then segmented using an X-second sliding time window with an overlap of X-1 seconds, and each subsequent sample maintains an 80% to 90% overlap with the previous sample. (2) Signal quality assessment Signal quality is assessed using the mean range. The mean range of a sample is defined as the difference between the maximum and minimum values of the signal average for each second within the sample's time window. The calculation formula is as follows: RM = max(x) - min(x) Where x represents a vector consisting of the mean of the electromyographic signal per second; When the mean value of the electromyography signal of a sample exceeds 70 μV, the signal quality of the sample is considered unqualified; otherwise, the signal quality of the sample is considered qualified. (3) Digital Filtering For acceleration and angular velocity signals, Butterworth filters are used for 0.5Hz high-pass filtering and 15Hz low-pass filtering to remove interference signals; For surface electromyography signals, a 10Hz high-pass filter was used with a Butterworth filter to remove low-frequency interference, and a notch filter was applied in the 49–51Hz range.
4. The method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks according to claim 1, characterized in that, The feature extraction and normalization in step two are as follows: (1) Feature extraction Amplitude and frequency features are extracted from acceleration, angular velocity, and surface electromyography signals. Amplitude features include mean amplitude, root mean square, standard deviation, energy, quartiles, standard deviation, quartile range, kurtosis coefficient, skewness coefficient, histogram frequency, waveform length, Jerk, SD2, and number of zero crossings. Frequency features include relative power, median frequency, mean frequency, quantile frequency, peak frequency, maximum power spectral density, and power spectral standard deviation. (2) Normalization z-score normalization is performed on all features. Among them, X norm X represents the normalized features, and X represents the original features. σ(X) represents the characteristic mean, and σ(X) represents the characteristic standard deviation.
5. The method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks according to claim 1, characterized in that, The specific process of step three is as follows: (3.1) Dataset partitioning Divide the entire dataset into N equal-sized subsets, where 1 ≤ N ≤ 10; select one subset as the test set and the other N-1 subsets as the training set. Repeat this process at least five times to ensure that each subset is used as the test set once. (3.2) Training set sampling For each training set, systematic sampling is used to further divide the training set into M training subsets, with the initial sample indices being 1, 2, ..., M, resulting in training subsets D1, D2, ..., D... M (3.3) Ranking of feature importance For each training subset, calculate the Laplacian score and rank the features by importance; (3.3.1) Construct a graph based on 10-nearest neighbors. The specific steps are as follows: First, calculate the Euclidean distance between all sample points in the training subset: Where n represents the length of the sample feature sequence; Then, determine the nearest neighbor region: for each data point, find the 10 closest other data points as its nearest neighbors; finally, construct the similarity matrix S. ij The data point x is calculated based on the Euclidean distance between the data points. i and x j Similarity between them: (3.3.2) Calculate the Laplacian fraction LS(f) r The specific process is as follows: First, calculate the degree matrix D. ii : Then, construct the Laplacian matrix L: L=Ds Finally, the Laplacian score LS(f) for each feature is calculated. r ): Define f r =[x 1r ,x 2r ,…,x mr ],make (3.3.3) Rank the features by importance; Laplacian score LS(f) for each feature r Sort the features in ascending order. The position of a feature in the sorted feature sequence is defined as the rank of that feature, which ranges from 1 to 71. The smaller the rank of a feature, the more important the feature is. (3.4) The number of clusters C and the number of features K in grid search; (3.4.1) Initialization: Set the fuzzy coefficient m of FCM to between 1 and 2; (3.4.2) Iteration: Perform grid search on the number of clusters C and the number of features K in each data subset. Arrange the features of acceleration and angular velocity in descending order of feature importance. In the wrap-around feature selection, use the first K features as the feature subset and C as the number of clusters to train the FCM model. (3.4.3) Evaluation: The silhouette coefficient of all samples is used as the evaluation index of the FCM model; First, calculate the silhouette coefficient s(i) for each sample: Where a(i) is the average distance from data point i to other points within its cluster: b(i) is the average distance from data point i to all points in its nearest other cluster: Then, calculate the silhouette coefficients for all samples: (3.4.4) Determine the optimal parameters: When the average silhouette coefficient of the M training subsets reaches the maximum value, the corresponding number of clusters C and the number of features K are optimal. The optimal feature subset is the set of the top K features with the highest average importance in the M training subsets. (3.5) Training the FCM model Based on the optimal subset and the number of clusters, the FCM model is trained and tested to determine which clusters may correspond to epileptic seizure signals. The specific process is as follows: the clusters are arranged in ascending order of distance from the cluster center to the origin, and the clusters are represented as G1, G2, ..., where G1 is regarded as non-seizure samples and other clusters are regarded as potential non-seizure samples.
6. The method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks according to claim 1, characterized in that, Step four specifically involves: (4.1) Reconstructing the LSTM training set Based on the feature selection and parameter selection results of FCM, an LSTM model is trained on the entire training set. The input of the LSTM is all K features of s consecutive samples. First, for each sample other than G1, the sample and the s-1 consecutive samples before it are combined to form an LSTM sample, and the corresponding sample label is the label of the last sample. Then, based on the clustering result of the s-th sample in the LSTM samples, the LSTM samples are divided into C-1 training sets; (4.2) Training the LSTM model For these C-1 LSTM training sets, train LSTM models separately to obtain C-1 LSTM models. The specific structure of the LSTM models is as follows: Input layer: The input to the LSTM model is an s*K time series with a sequence length of s and a feature dimension of K; while the feature extraction yields a 1*K feature sequence. Therefore, when the feature sequence of a sample is processed by the FCM model and input into the LSTM network, the current sample and its previous s-1 samples are concatenated into an LSTM sample, and the sample label is the label of the current sample, which is independent of the labels of the previous s-1 samples. LSTM layer: contains multiple hidden layer units, and outputs a sequence; Dropout layer: To prevent overfitting, a dropout layer is introduced, with the dropout rate set to 0 to 0.5; The LSTM layer placed after the Dropout layer contains multiple hidden layer units and only outputs the prediction value at the last time step; Fully connected layer: contains multiple neurons; Activation function: The activation function chosen is the softmax function. Where i is 1 or 2; when i = 1, σ(z) i The probability that the sample represents a non-seizure sample; when i = 2, σ(z) i The probability that a sample represents an attack sample; z j Input vector; Output layer: The LSTM output is the probability that the sample is a non-seizure and seizure sample, and only the probability of the seizure sample is selected for output; During LSTM training, the batch size is set to 2. N We selected the cross-entropy loss function as the cost function, used the Adam optimizer, set the learning rate to 0.000001 to 0.01, and set the number of iterations to 20 to 100. When the validation set loss is higher than the minimum loss for q consecutive iterations, we stopped the iteration, where q is 20% of the number of iterations. (4.3) Testing the LSTM model For each test set, the potential seizure period samples are reconstructed, input into the corresponding LSTM model for testing, and the seizure probability of the potential seizure period samples in the test set is estimated.
7. The method for detecting epileptic seizure signals based on fuzzy clustering and long short-term memory networks according to claim 1, characterized in that, Step five specifically involves: (5.1) Mean Filtering Smooth all outputs using a 6-point forward mean filter: Among them, y i This represents the processed seizure probability, which is the average of the seizure probability of the current sample and the seizure probabilities of the previous 5 samples output by the model. (5.2) Criteria for Judging Attack Events If the output of 9 consecutive samples exceeds a predefined threshold, it is considered an outbreak event; If multiple seizures occur within 5 minutes, they are considered as a single seizure.
Citation Information
Patent Citations
Epileptic EEG prediction method based on convolution and recurrent neural network and multiple time scales
CN110693493A
A real-time detection system for single-channel EEG signals of epileptic patients
CN117918861B
Triple wrist strap with separated sensors
CN220442653U
Prediction method for improving LSTM based on fuzzy clustering algorithm
CN110348608A
Epileptic seizure time period detection system and method based on multi-modal information
CN113907707A