Method for quantifying electrographic status epilepticus in sleep based on a multi-task deep network
By using a multi-task deep learning network, combined with shared feature extraction and signal channel attention modules, we have achieved efficient quantification of epileptiform activity and sleep staging, solving the inconsistency and time-consuming problems of identification and quantification in existing technologies, and improving the diagnosis and treatment efficiency of ESES patients.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIV
- Filing Date
- 2023-09-11
- Publication Date
- 2026-06-19
AI Technical Summary
Existing automated detection and quantification methods for epileptiform discharges are inconsistent, cumbersome, and time-consuming, making it difficult to accurately identify and quantify epileptic electrical states during sleep, especially spike-and-wave discharges in patients with epileptiform discharges (ESES), which affects patient development and treatment outcomes.
We employ a multi-task deep network-based approach, combining a shared feature extraction network and a signal channel attention module with an epileptiform activity segmentation decoder and a sleep staging classifier to achieve end-to-end epileptiform activity quantification and sleep staging. We utilize a one-dimensional version of ResNet34 for feature extraction and optimize the model through a multi-task learning loss function.
It achieves highly accurate and efficient quantification of epileptiform activity, reduces the burden on doctors, improves identification consistency, and can reliably quantify spike-and-wave discharge index and sleep stages, supporting early diagnosis and treatment.
Smart Images

Figure CN117122336B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of electroencephalogram (EEG) signal processing and smart healthcare, and relates to a method for detecting, quantifying, and staging epileptic electrical activity during sleep in children based on multi-task approaches. Background Technology
[0002] Epileptiform encephalopathy with statuse pilepticus during sleep (ESES) is a specific type of epileptic encephalopathy in children, diagnosed by epileptic electrical activity on electroencephalograms (EEGs) during sleep. Epileptiform discharges are more prevalent and frequent during non-rapid eye movement (NREM) sleep. The epileptic discharges during sleep-enhanced NEEM sleep and the disruption of slow-wave activity usually have adverse effects on the patient's development, and ESES can also lead to cognitive impairment, behavioral disorders, and language decline. Therefore, early diagnosis and treatment of children with ESES are crucial for diagnosis and prognosis. However, ESES patients often lack consistent and obvious clinical manifestations, making them difficult to identify. Since the epileptiform discharges in ESES consist of a series of continuous spike and slow-wave abnormalities, quantitative analysis of these discharges using quantitative parameters has become key to diagnosing ESES and can also reflect the evolution of the patient's condition.
[0003] The spike-wave index (SWI) is commonly used to quantify ESES or other syndromes with epileptiform discharges. It is defined as the percentage of the total duration of abnormal spike and spike-wave activity relative to the non-rapid eye movement (NREM) phase. However, comprehensive labeling and quantification of abnormal EEG discharges requires neurologists to meticulously analyze EEG data to detect millisecond-level epileptiform discharges, a process that is extremely tedious and time-consuming. Furthermore, manual labeling by physicians yields significant discrepancies, meaning different physicians may use different criteria to identify epileptiform discharges. To improve the consistency and reliability of epileptiform discharge quantification, reduce the burden on physicians, and promote early diagnosis and treatment of children with ESES, there is an urgent need to develop a reliable automated method for detecting and quantifying epileptiform discharges. Therefore, establishing an accurate, efficient, and convenient method for identifying and quantifying sleep epileptic electrical status epilepticus in ESES patients has significant economic and social value.
[0004] With the development of related technologies, some studies have demonstrated the feasibility of accurately quantifying sustained epileptic electrical activity. Existing research mainly focuses on the following directions:
[0005] Template matching-based quantification of sustained epileptic electrical activity: A manually set spike template is used for spike detection, thereby further quantifying spike discharge.
[0006] Epileptiform electrical activity quantification based on signal classification: By extracting EEG features in the time domain, frequency domain, and wavelet domain and using a classifier to classify the sliced signals, the category of the sliced signals is detected. Then, the epileptiform activity is quantified by combining the category and duration of the slice.
[0007] Quantification of epileptic electrical activity based on morphology and medical knowledge: Morphological methods are used to process the EEG signals of ESES patients to obtain the target waveform after filtering out background waves. Combined with medical knowledge, the morphological features are comprehensively analyzed to finally quantify epileptiform activity.
[0008] The methods described above have certain limitations in practical applications. Template matching-based methods heavily rely on manually selected predefined template parameters; using a single template may produce unsatisfactory results, and these methods lack the ability to detect and quantify slow-wave abnormalities. Signal classification-based methods are highly dependent on manually extracted features and lack robustness and generalization when dealing with different patients, resulting in poor quantification performance. Methods based on morphology and medical knowledge require manually determined thresholds and judgment logic to identify and quantify epileptiform discharges, and their ability to locate and detect epileptiform activity is weak.
[0009] In recent years, computer hardware has developed rapidly, while real-world applications have become increasingly complex and diverse, leading to greater attention being paid to deep learning-based methods. In the field of computer vision, deep learning has been widely applied to image classification, semantic segmentation, and object detection. These end-to-end models can automatically extract data features, possess strong generalization capabilities, and have achieved good performance in many complex tasks. The complex and variable waveforms of epileptic electrical activity during sleep in ESES patients have prompted us to combine deep learning methods to achieve higher accuracy and greater convenience in quantifying epileptic electrical activity. Summary of the Invention
[0010] To address the problems existing in the aforementioned methods for identifying and quantifying epileptiform electrical activity during sleep, this invention proposes a multi-task learning method with EEG channel attention for epileptiform activity quantification analysis (MCAQN). This method can simultaneously quantify epileptiform activity and stage sleep, exhibiting better applicability, social value, and economic value.
[0011] This invention targets data from BECT syndrome, a common condition observed in ESES (Electroencephalogram of Electroencephalograms). The most prominent feature of interphase EEG in BECT patients is the presence of numerous spike-wave and spike-slow-wave complexes in the Rolandic region. To mitigate the impact of interference, 0.5–70 Hz bandpass filters and a 50 Hz notch filter are used in the original multi-channel (19-channel) EEG signal, which may contain DC bias, power line interference, and muscle artifacts. The filtered signal is segmented into 30-second data segments for subsequent sleep staging and SWI quantization. Individual 30-second data samples are labeled with regions of sleep and epileptiform activity for use in training the deep network. This invention uses the preprocessed 19-channel EEG signal as input to the MCAQN (Multi-Channel Association of Questionnaires). The MCAQN uses a one-dimensional version of the typical feature extraction network ResNet34 as the shared feature extraction network. The shared feature extraction network aims to learn rich task-shared features from the input multi-channel signal. These shared features are encoded in feature maps at different depths of the shared network. Then, it is connected to the signal channel attention module in each task-specific network to learn the features of the specific task. Finally, the obtained weighted feature maps are input into the epileptiform activity segmentation decoder and the sleep stage classifier, respectively, to simultaneously calculate the spike-and-wave discharge index of the samples and identify the current sleep stage.
[0012] The technical solution of this invention mainly includes the following steps:
[0013] Step 1: Preprocess the signal. The preprocessed 19-channel EEG signal is segmented to obtain 30-second samples of equal length, and the sleep period and epileptiform activity events of each sample are labeled.
[0014] Step 2: Input the preprocessed 19-channel EEG signal into the shared feature extraction network of the MCAQN model for feature extraction to obtain task-shared features.
[0015] Step 3: Input the shared features of the tasks into the attention module of the task-specific signal channel to obtain the task-independent adaptive weighted feature map.
[0016] Step 4: Input the feature map of the epileptiform activity segmentation task into the epileptiform activity segmentation decoder. The decoder performs category determination for each sampling point, thereby obtaining a fine-grained label output for the epileptiform activity of a single sample. The total discharge time length is obtained through the fine-grained label output, and the spike-and-wave discharge index of a single sample is obtained.
[0017] Step 5: Input the feature map of the sleep staging task into the sleep staging classifier to obtain the sleep stage of each sample, namely wake, non-rapid eye movement sleep (NREM), and rapid eye movement sleep (REM).
[0018] Step 6: Train the MCAQN model using the preprocessed data, and combine it with the outputs of Steps 4 and 5 to achieve the identification and quantification of epileptic electrical activity during children's sleep.
[0019] The specific process of step 1 is as follows:
[0020] Step 1-1: Preprocess the original signal: Use a 0.5-70Hz bandpass filter and a 50Hz notch filter to filter out power frequency electrical interference and perform detrending operation to filter out the interference components in the signal.
[0021] Steps 1-2: The preprocessed data is segmented into 30-second data samples. Each data segment is then labeled with sleep phase and epileptiform activity events to obtain data sample labels. Sleep phases are labeled as wakefulness (Wake), non-rapid eye movement (NREM) sleep, and rapid eye movement (REM) sleep. Epileptiform activity events are labeled with a combination of start time and duration.
[0022] Steps 1-3: Convert the labels of epileptiform activity events into fine-grained labels. Specifically, convert the original combination of start time and duration into characters 0 and 1. Define epileptiform activity data points as character 1 and non-epileptiform activity data points as character 0. Each sample is 30 seconds long, and the sampling rate is 500 Hz, resulting in a 1*15000 vector of fine-grained labels.
[0023] The specific process of step 2 is as follows:
[0024] Step 2-1: The 19-channel EEG signal, along with sleep labels and fine-grained labels for epileptiform activity, is used as input to the MCAQN model. First, a shared feature extraction network learns rich task-shared features from the multi-channel input signals. The shared feature extraction network uses a one-dimensional version of the typical feature extraction network ResNet34, consisting of four encoding blocks. The first encoding block convolves the input of size (19B*1*15000) using 32 convolutional layers with kernel size 5. After batch normalization and ReLU layers, a feature map of size (19B*32*5000) is obtained, where B represents the training batch size. Subsequently, with each subsequent encoding block, the number of feature channels doubles, and the output size of that layer is halved. After the last encoding block, a feature map of size (19B*512*312) is obtained.
[0025] Step 2-2: Adjust the feature map size to (B*19*512*312) and input the feature map F (19*512*312) of a single batch into the signal channel attention module in each specific task network for use by the dedicated signal channel attention module of each task.
[0026] The specific process of step 3 is as follows:
[0027] Step 3-1: Convert the feature map F∈R obtained in the previous step. D×C×L Each task-specific network's dedicated signal channel attention module is input, where D, C, and L represent the number of EEG channels, the number of feature channels, and the feature length, respectively. First, convolution is performed using task-specific convolutional blocks, consisting of two 2D convolutional layers. After batch normalization, the feature maps are obtained.
[0028] Step 3-2: Use a two-dimensional AvgPooling layer to obtain the feature map Z∈R. D Each element of Z is calculated as follows:
[0029]
[0030] Where z d v is the d-th element of Z. d Let Z be the d-th element of V. Z combines feature channel and feature length information to describe the global distribution of features. The correlation between EEG signal channels is modeled by two fully connected layers. The EEG signal channel attention weight (ECW) is defined as:
[0031] ECW=σ(W2δ(W1Z)) (2)
[0032] Where W1∈R Dr×D and W2∈R D×Dr Here, δ represents the network parameters, σ is the ReLU activation function, σ is the softmax function, and r is the upsampling ratio. Finally, the ECW (1×19) of each EEG signal channel is obtained using the softmax function. Finally, the resized feature map F... * Weighted operations were performed, and the size of the feature maps was adjusted to obtain weighted feature maps F1 and F2 (512×312). F1 and F2 are the epileptiform activity quantification feature map and the sleep staging task feature map, respectively.
[0033] Furthermore, r is set to 16.
[0034] The specific process of step 4 is as follows:
[0035] Step 4-1: To obtain epileptiform activity (EPA) segmentation from the raw signal, an EPA segmentation decoder was designed for sample point-level segmentation. The decoder consists of multiple cascaded upsampling operations, which decode the high-level feature maps and output the final segmentation result. The EPA quantization feature map F1 is upsampled to 32*5000. Each step of the upsampling path consists of a transposed convolutional layer of the feature map, which doubles the input size and halves the number of feature channels. Finally, a transposed convolution with a stride of 3 and a kernel size of 3, along with a 1×1 convolution, is used to map each of the 32 component feature vectors to the required number of classes, resulting in fine-grained EPA label output.
[0036] Step 4-2: After obtaining the fine-grained epileptiform activity (ESES) tag output, calculate the spike-and-wave discharge index (SWI) of the sample signal (30s). SWI is a parameter used to quantify ESES, defined as the total duration of all spike-and-wave discharges divided by the total duration of non-rapid eye movement (NREM) sleep, then multiplied by 100%. The specific calculation formula is as follows:
[0037]
[0038] Where N represents the number of epileptiform activity events in the sample, L represents the duration of each epileptiform activity event, and Duration represents the duration of non-rapid movement sleep, with Duration always equal to 30 seconds.
[0039] Step 4-3: Use time estimation error and event detection error to measure the effect. Time estimation error refers to the difference between the actual SWI and the SWI estimated by the method for a single 30s signal segment, calculated as follows:
[0040] SWI Error =|SWI _L -SWI _pre | (5)
[0041] Among them, SWI _L SWI refers to the actual discharge index, while SWI_pre refers to the predicted discharge index. The absolute value of the difference between the two is used as the discharge index error SWI. Error The percentage of SWI error within Q%, PCT(Q%), was used to measure different levels of SWI. Error The distribution of the error, where Q represents different error levels, if SWI Error If the proportion of samples less than 5% is 10% of the total sample, then the value of PCT(5%) is 10%, and so on.
[0042] For detecting epileptiform activity (EPA), the Intersection over Union (IoU) is used to measure how well a detected EPA event matches a physician-labeled event (the gold standard event). IoU is typically used to quantify the overlap between two events in a detection task, defined as the ratio of their intersection size to their union size. If two events completely overlap, the IoU equals 1. Conversely, if they do not overlap at all, the IoU is obviously 0. To determine if two events match, a threshold iou_th (0-1) is set. If the IoU between the detected event and the gold standard event is greater than or equal to the threshold, they are considered a match. Multiple EPA events may exist within the gold standard event because two events with an interval of less than 0.3 seconds are merged into one event when labeling EPA. Therefore, if multiple detected events overlap with the gold standard event, the detected events are merged, and the match is calculated using the gold standard event. The number of detected events that match the gold standard event is TP, and the number of events that do not is FP. The number of events that are identified as normal events by the gold standard event is FN. Precision and Recall are used to evaluate the effectiveness of event detection, as shown in the following formula:
[0043]
[0044]
[0045] Precision represents the proportion of truly correct predictions out of all positive predictions; Recall represents the proportion of truly correct predictions out of all actual positive predictions. The higher the value, the lower the false negative rate.
[0046] The specific process of step 5 is as follows:
[0047] Step 5-1: To obtain the sleep stage of the current sample, a sleep stage classifier is designed to acquire relevant information. First, the sleep staging task feature map F2, weighted by the signal channel attention module, is specifically used for the sleep stage task. After being flattened by an adaptive average pooling layer, it is then passed through two linear layers with input and output sizes of (512, 128) and (128, 3), respectively. Finally, the softmax function is used to obtain the output class probability value, and the class with the highest probability value is taken as the sleep staging result.
[0048] Step 5-2: The model sleep staging results are measured using Accuracy, Precision, and Recall, which will not be elaborated here.
[0049] The specific process of step 6 is as follows:
[0050] Step 6-1: Optimize the MCAQN model using a combination of segmentation loss and classification loss. The joint loss function is defined as:
[0051] L jiont =λL seg +μL stage (9)
[0052] Where λ and μ are the weights of each loss, both of which are set to 0.5.
[0053] Step 6-2, Segmentation Loss L Seg Using binary cross-entropy loss, the calculation is as follows:
[0054]
[0055] Where n is the number of samples, y i It is a binary label value of 0 or 1. This indicates the actual output value.
[0056] Step 6-3, Classification Loss L stage The settings are as follows:
[0057]
[0058] Where n is the number of samples in each batch, m is the number of predicted labels, and p(x) ij ) and q(x ij ) represent the true probability and the predicted probability, respectively.
[0059] The beneficial effects of this invention are as follows:
[0060] This invention constructs an end-to-end deep neural network to achieve automatic detection and quantification of epileptiform activity. Its main advantages include: 1) An end-to-end multi-task learning network with ECA (Electroencephalography Attention Module). It simultaneously achieves epileptiform activity quantification and sleep staging. 2) To address the differences in the information value of different signal channels under different tasks, an ECA module is proposed, enabling each task-specific network to obtain more specific and useful features from the task-sharing network. 3) This scheme does not require empirical parameters and has strong generalization and robustness.
[0061] This invention extracts 19 channels of EEG data from patients 30 minutes before sleep to 30 minutes after wakefulness, and performs preprocessing operations such as filtering and detrending on the raw signals. A task-sharing network is used to extract common features, and each task-specific network can extract more useful features from the task-sharing network by incorporating channel information differences. Through multi-task learning, the effective information learned by each task can be shared, thereby improving model performance. Then, a multi-task learning loss is designed to balance these two tasks by combining the SWI quantization loss based on semantic segmentation and the sleep classification loss function. Studies show that the proposed multi-task learning model achieves good performance, outperforming existing single-task learning methods. For the SWI quantization task, this method does not rely on thresholds or expert experience, accurately and reliably quantizing SWI, with an average SWI... Error The accuracy was 2.406%. In the sleep staging task, the accuracy was 97.134%, and the F1 score was 96.935%. The experimental results show that this method can effectively identify and quantify epileptiform activity during sleep in ESES syndrome and can reliably perform sleep staging.
[0062] Based on this, an accurate and efficient system for identifying and quantifying epileptiform activity during sleep can be established for patients with ESES syndrome. This will facilitate long-term EEG monitoring of ESES patients and assist doctors in diagnosis and treatment, thus providing the possibility for patients to receive treatment as early as possible. Attached Figure Description
[0063] Figure 1 This is a system overall structure diagram according to an embodiment of the present invention.
[0064] Specific implementation method
[0065] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0066] An end-to-end deep neural network was constructed to achieve automatic detection and quantification of epileptiform activity. The innovations of this method are: 1) An end-to-end multi-task learning network with ECA (Electroencephalography Attention Module), simultaneously achieving epileptiform activity quantification and sleep staging. 2) To address the differences in the information value of different signal channels under different tasks, an ECA module for EEG signal channels was proposed, enabling each task-specific network to obtain more specific and useful features from the task-sharing network. 3) This scheme does not require empirical parameters and exhibits strong generalization and robustness.
[0067] like Figure 1 As shown, the implementation steps of the method for quantifying epileptic electrical persistence during sleep based on multi-task deep networks have been described in detail in the invention content. That is, the technical solution of the present invention mainly includes the following steps:
[0068] Step 1: Preprocess the signal. The preprocessed 19-channel EEG signal is segmented to obtain 30-second samples of equal length. The sleep phase and epileptiform activity events of each sample are labeled for subsequent training of the MCAQN model. The specific process is as follows:
[0069] Step 1-1: Preprocess the original signal: Use a 0.5-70Hz bandpass filter and a 50Hz notch filter to filter out power frequency electrical interference and perform detrending operation to filter out the interference components in the signal.
[0070] Steps 1-2: The preprocessed data is segmented into 30-second data samples. Each data segment is labeled with sleep phase and epileptiform activity events to obtain labels for training the MCAQN. Sleep phases are labeled as wakefulness (Wake), non-rapid eye movement (NREM) sleep, and rapid eye movement (REM) sleep. Epileptiform activity events are labeled with a combination of start time and duration.
[0071] Steps 1-3: Convert the labels of epileptiform activity events into fine-grained labels. Specifically, convert the original combination of start time and duration into characters 0 and 1. Define epileptiform activity data points as character 1 and non-epileptiform activity data points as character 0. Each sample is 30 seconds long, and the sampling rate is 500 Hz, resulting in a 1*15000 vector of fine-grained labels.
[0072] Step 2: Input the preprocessed 19-channel EEG signal into the shared feature extraction network of the MCAQN model for feature extraction to obtain task-shared features. The specific process is as follows:
[0073] Step 2-1: The 19-channel EEG signal, along with sleep labels and fine-grained labels for epileptiform activity, is used as input to the MCAQN model. First, a shared feature extraction network learns rich task-shared features from the multi-channel input signals. The shared feature extraction network uses a one-dimensional version of the typical feature extraction network ResNet34, consisting of four encoding blocks. The first encoding block convolves the input of size (19B*1*15000) using 32 convolutional layers with kernel size 5. After batch normalization and ReLU layers, a feature map of size (19B*32*5000) is obtained, where B represents the training batch size. Subsequently, with each subsequent encoding block, the number of feature channels doubles, and the output size of that layer is halved. After the last encoding block, a feature map of size (19B*512*312) is obtained.
[0074] Step 2-2: Adjust the feature map size to (B*19*512*312) and input the feature map F (19*512*312) of a single batch into the signal channel attention module in each specific task network for use by the dedicated signal channel attention module of each task.
[0075] Step 3: Input the shared features of each task into the task-specific signal channel attention module to obtain task-independent adaptively weighted feature maps. The specific process is as follows:
[0076] Step 3-1: Convert the feature map F∈R obtained in the previous step. D×C×L Each task-specific network's dedicated signal channel attention module is input, where D, C, and L represent the number of EEG channels, the number of feature channels, and the feature length, respectively. First, convolution is performed using task-specific convolutional blocks, consisting of two 2D convolutional layers. After batch normalization, the feature maps are obtained.
[0077] Step 3-2: Use a two-dimensional AvgPooling layer to obtain the feature map Z∈R. D Each element of Z is calculated as follows:
[0078]
[0079] Where z d v is the d-th element of Z. d Let Z be the d-th element of V. Z combines feature channel and feature length information to describe the global distribution of features. The correlation between EEG signal channels is modeled by two fully connected layers. The EEG signal channel attention weight (ECW) is defined as:
[0080] ECW=σ(W2δ(W1Z)) (2)
[0081] Where W1∈R Dr×D and W2∈R D×Dr Here, δ represents the network parameters, σ represents the ReLU activation function, σ represents the softmax function, and r represents the upsampling ratio, similar to dimensionality reduction that balances network complexity and performance. In this embodiment, r is set to 16. Finally, the ECW (1×19) of each EEG signal channel is obtained through the softmax function. Finally, the resized feature map F is used... * Weighted operations were performed, and the size of the feature maps was adjusted to obtain weighted feature maps F1 and F2 (512×312). F1 and F2 are the epileptiform activity quantification feature map and the sleep staging task feature map, respectively.
[0082] Step 4: Input the feature map of the epileptiform activity segmentation task into the epileptiform activity segmentation decoder. This decoder classifies each sampling point to obtain a fine-grained label output for the epileptiform activity of a single sample. The total discharge time length is obtained from the fine-grained label output, and the spike-and-wave discharge index of a single sample is also obtained. The specific process is as follows:
[0083] Step 4-1: To obtain epileptiform activity (EPA) segmentation from the raw signal, we designed an EPA segmentation decoder for sample point-level segmentation. The decoder consists of multiple cascaded upsampling operations, which decode the high-level feature maps and output the final segmentation results. The EPA quantization feature map F1 is upsampled to 32*5000. Each step of the upsampling path consists of a transposed convolutional layer of the feature map, which doubles the input size and halves the number of feature channels. Finally, a transposed convolution with a stride of 3 and a kernel size of 3, along with a 1×1 convolution, is used to map each of the 32 component feature vectors to the required number of classes, resulting in fine-grained EPA label outputs.
[0084] Step 4-2: After obtaining the fine-grained epileptiform activity (ESES) tag output, calculate the spike-and-wave discharge index (SWI) of the sample signal (30s). SWI is a parameter used to quantify ESES, defined as the total duration of all spike-and-wave discharges divided by the total duration of non-rapid eye movement (NREM) sleep, then multiplied by 100%. The specific calculation formula is as follows:
[0085]
[0086] Where N represents the number of epileptiform activity events in the sample, L represents the duration of each epileptiform activity event, and Duration represents the duration of non-rapid movement sleep, with Duration always equal to 30 seconds.
[0087] Step 4-3: Use time estimation error and event detection error to measure the effect. Time estimation error refers to the difference between the actual SWI and the SWI estimated by the method for a single 30s signal segment, calculated as follows:
[0088] SWI Error =|SWI _L -SWI_pre| (5)
[0089] Among them, SWI _L SWI refers to the actual discharge index, while SWI_pre refers to the predicted discharge index. The absolute value of the difference between the two is used as the discharge index error SWI. Error The percentage of SWI error within Q%, PCT(Q%), was used to measure different levels of SWI. ErrorThe distribution of the error, where Q represents different error levels, if SWI Error If the proportion of samples less than 5% is 10% of the total sample, then the value of PCT(5%) is 10%, and so on.
[0090] For detecting epileptiform activity (EPA), Intersection over Union (IoU) is used to measure how well a detected EPA event matches a physician-labeled event (gold standard event). IoU is typically used to quantify the overlap between two events in a detection task, defined as the ratio of their intersection size to their union size. If two events completely overlap, the IoU equals 1. Conversely, if they do not overlap at all, the IoU is obviously 0. To determine whether two events match, a threshold iou_th (0-1) needs to be set. This paper uses a threshold of 0.5. If the IoU between a detected event and the gold standard event is greater than or equal to the threshold, they are considered to be matched. Multiple EPA events may exist within the gold standard event because two events with an interval of less than 0.3 seconds are merged into one event when labeling EPA. Therefore, if multiple detected events overlap with the gold standard event, the detected events are merged, and the match degree is calculated using the gold standard event. The number of detected events that match the gold standard event is TP, and the number of events that do not is FP. The number of events that are identified as normal events by the gold standard event is FN. Precision and Recall are used to evaluate the effectiveness of event detection, as shown in the following formula:
[0091]
[0092]
[0093] Precision represents the proportion of truly correct predictions out of all positive predictions; Recall represents the proportion of truly correct predictions out of all actual positive predictions. The higher the value, the lower the false negative rate.
[0094] Step 5: Input the feature map of the sleep staging task into the sleep staging classifier to obtain the sleep stage of each sample, namely wakefulness, non-rapid eye movement (NREM) sleep, and rapid eye movement (REM) sleep. The specific process is as follows:
[0095] Step 5-1: To obtain the sleep stage of the current sample, this invention designs a sleep stage classifier to acquire relevant information. First, the sleep staging task feature map F2, weighted by the signal channel attention module, is specifically used for the sleep stage task. After being flattened by an adaptive average pooling layer, it is then passed through two linear layers with input and output sizes of (512, 128) and (128, 3), respectively. Finally, the softmax function is used to obtain the output class probability value, and the class with the highest probability value is taken as the sleep staging result.
[0096] Step 5-2: The model sleep staging results are measured using Accuracy, Precision, and Recall, which will not be elaborated here.
[0097] Step 6: Train the MCAQN model using the preprocessed data, and combine it with the outputs of steps 4 and 5 to achieve the identification and quantification of epileptic electrical activity during children's sleep. The specific process is as follows:
[0098] Step 6-1: Optimize the MCAQN model using a combination of segmentation loss and classification loss. The joint loss function is defined as:
[0099] L jiont =λL seg +μL stage (9)
[0100] Wherein, λ and μ are the weights of each loss, and in this invention, both are taken as 0.5.
[0101] Step 6-2, Segmentation Loss L Seg Using binary cross-entropy loss, the calculation is as follows:
[0102]
[0103] Where n is the number of samples, y i It is a binary label value of 0 or 1. This represents the actual output value. When training is complete, the network can analyze a signal X of length L and output a segmentation result: It can be used The SWI of a sample can be simply obtained by counting the number of 1s in the sample.
[0104] Step 6-3, Classification Loss L stage The settings are as follows:
[0105]
[0106] Where n is the number of samples in each batch, m is the number of predicted labels, and p(x) ij ) and q(x ij ) represent the true probability and the predicted probability, respectively.
[0107] Step 6-4: Combining the results of steps 4 and 5, we can obtain the sleep stage category of all samples and the discharge index of each sample, thereby realizing the quantitative analysis of the patient's epileptiform electrical activity during sleep and providing a tool for studying the evolution of epileptiform discharges in different patients at different sleep stages.
[0108] A system for quantifying epileptic electrical persistence during sleep based on multi-task deep networks includes a preprocessing module, a feature extraction module, a feature map acquisition module, an epileptiform activity segmentation module, and a sleep staging module.
[0109] Preprocessing module: Performs preprocessing operations on the signal. The preprocessed 19-channel EEG signal is segmented to obtain 30-second samples of equal length, and the sleep period and epileptiform activity events of each sample are labeled.
[0110] Feature extraction module: The preprocessed 19-channel EEG signal is input into the shared feature extraction network for feature extraction to obtain task-shared features.
[0111] Feature map acquisition module: Input the shared features of the tasks into the attention module of the task-specific signal channel to obtain the task-independent adaptive weighted feature map.
[0112] Epileptiform Activity Segmentation Module: The feature map of the epileptiform activity segmentation task is input into the epileptiform activity segmentation decoder. This decoder classifies each sampling point to obtain a fine-grained label output for the epileptiform activity of a single sample. The total discharge time length is obtained from the fine-grained label output, and the spike-and-wave discharge index of a single sample is obtained.
[0113] Sleep staging module: Input the feature map of the sleep staging task into the sleep staging classifier to obtain the sleep stage of each sample, namely wake, non-rapid eye movement sleep (NREM), and rapid eye movement sleep (REM).
[0114] This invention extracts 19 channels of EEG data from patients 30 minutes before sleep to 30 minutes after wakefulness, and performs preprocessing operations such as filtering and detrending on the raw signals. A task-sharing network is used to extract common features, and each task-specific network can extract more useful features from the task-sharing network by incorporating channel information differences. Through multi-task learning, the effective information learned by each task can be shared, thereby improving model performance. Then, a multi-task learning loss is designed to balance these two tasks by combining the SWI quantization loss based on semantic segmentation and the sleep classification loss function. Studies show that the proposed multi-task learning model achieves good performance, outperforming existing single-task learning methods. For the SWI quantization task, this method does not rely on thresholds or expert experience, accurately and reliably quantizing SWI, with an average SWI... Error The accuracy was 2.406%. In the sleep staging task, the accuracy was 97.134%, and the F1 score was 96.935%. The experimental results show that this method can effectively identify and quantify epileptiform activity during sleep in patients with ESES syndrome, and can reliably perform sleep staging.
[0115] Based on this, an accurate and efficient system for identifying and quantifying epileptiform activity during sleep can be established for patients with ESES syndrome. This will facilitate long-term EEG monitoring of ESES patients and assist doctors in diagnosis and treatment, enabling patients to receive effective treatment earlier.
[0116] The above description, in conjunction with specific / preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. Those skilled in the art can make various substitutions or modifications to these described embodiments without departing from the inventive concept, and all such substitutions or modifications should be considered within the scope of protection of the present invention.
[0117] The parts of this invention not described in detail are well-known to those skilled in the art.
Claims
1. A method for quantifying epileptic electrical persistence during sleep based on multi-task deep networks, characterized in that, The steps include the following: Step 1: Preprocess the signal; divide the preprocessed 19-channel EEG signal into equal-length 30s samples, and label the sleep period and epileptiform activity events of each sample. The specific process of step 1 is as follows: Step 1-1: Preprocess the original signal: Use a 0.5-70Hz bandpass filter and a 50Hz notch filter to filter out power frequency electrical interference and perform detrending operation to filter out the interference components in the signal; Steps 1-2: The preprocessed data is segmented into 30-second data samples. Each data segment is labeled with sleep phase and epileptiform activity events to obtain the data sample labels. Sleep phase is labeled as wakefulness, non-rapid eye movement (NREM) sleep, and rapid eye movement (REM) sleep. Epileptiform activity events are labeled as a combination of start time and duration. Steps 1-3: Convert the labels of epileptiform activity events into fine-grained labels. Specifically, convert the original combination of start time and duration into characters 0 and 1; define epileptiform activity data points as character 1 and non-epileptiform activity data points as character 0; the length of each sample is 30s and the sampling rate is 500Hz, so the resulting fine-grained label is a 1*15000 vector. Step 2: Input the preprocessed 19-channel EEG signal into the shared feature extraction network of the MCAQN model for feature extraction to obtain task-shared features; The specific process is as follows: Step 2-1: The 19-channel EEG signal, along with sleep labels and fine-grained labels for epileptiform activity, are used as inputs to the MCAQN model. First, the shared feature extraction network learns rich task-shared features from the input multi-channel signals. The shared feature extraction network adopts a one-dimensional version of the typical feature extraction network ResNet34, which consists of four encoding blocks. The first encoding block uses 32 convolutional layers with a kernel size of 5 to convolve the input of size 19B*1*15000. After batch normalization and ReLU layers, a feature map of size 19B*32*5000 is obtained, where B represents the batch size of training. After that, the number of feature channels doubles with each encoding block, and the output size of the layer is halved. After the last encoding block, a feature map of size 19B*512*312 is obtained. Step 2-2: Adjust the feature map size to B*19*512*312, and input the feature map F of a single batch into the signal channel attention module in each specific task network for use by the dedicated signal channel attention module of each task. Step 3: Input the shared features of the tasks into the attention module of the task-specific signal channel to obtain the task-independent adaptive weighted feature map; The specific process is as follows: Step 3-1: Transfer the feature map obtained in the previous step... Each task-specific network's dedicated signal channel attention module is input separately, where D, C, and L represent the number of EEG channels, the number of feature channels, and the feature length, respectively. First, convolution is performed using task-specific convolutional blocks, consisting of two two-dimensional convolutional layers. After batch normalization, the feature maps are obtained. ; Step 3-2: Use a two-dimensional AvgPooling layer to obtain the feature map. , Each element is calculated as follows: in for The One element, for The One element; The global distribution of features is described by combining feature channel and feature length information; the correlation between EEG signal channels is modeled by two fully connected layers; The attention weight (ECW) of the EEG signal channel is defined as follows: in, and For network parameters, It is the ReLU activation function. The softmax function is used, where r is the upsampling ratio; finally, the ECW of each EEG signal channel is obtained through the softmax function; finally, the feature map is used... Weighted operations are performed, and the size of the feature maps is adjusted to obtain the final weighted feature maps. , ;in , These are the epileptiform activity quantitative feature map and the sleep stage task feature map, respectively. Step 4: Input the feature map of the epileptiform activity segmentation task into the epileptiform activity segmentation decoder. The decoder performs category determination for each sampling point to obtain a fine-grained label output of the epileptiform activity of a single sample. The total discharge time length is obtained through the fine-grained label output, and the spike-and-slow-wave discharge index of a single sample is obtained. The specific process is as follows: Step 4-1: To obtain epileptiform activity segmentation from the original signal, an epileptiform activity segmentation decoder was designed to perform sample point-level segmentation. The decoder consists of multiple cascaded upsampling operations, thereby decoding the high-level feature map and outputting the final segmentation result; the epileptiform activity quantization feature map is then used. An upsampling operation is performed to 32*5000. Each step of the upsampling path consists of a transposed convolutional layer of feature maps, which doubles the input size and halves the number of feature channels. Finally, a transposed convolution with a stride of 3 and a kernel size of 3, along with a 1 × 1 convolution, is used to map each of the 32 component feature vectors to the required number of classes, resulting in fine-grained epileptiform activity label output. Step 4-2: After obtaining the fine-grained epileptiform activity (ESES) tag output, calculate the spike-and-wave discharge index (SWI) of the sample signal. SWI is a parameter used to quantify ESES, defined as the total duration of all spike-and-wave discharges divided by the total duration of non-rapid eye movement (NREM) sleep, then multiplied by 100%. The specific calculation formula is as follows: in, This indicates the number of epileptiform activity events in the sample. This indicates the duration of each epileptiform activity event. This indicates the duration of non-rapid eye movement (NREM) sleep. It is always equal to 30 seconds; Step 4-3: Use time estimation error and event detection error to measure the effect; time estimation error refers to the difference between the actual SWI and the SWI estimated by the method for a single 30s signal segment, calculated as follows: in, This refers to the actual discharge index. The absolute value of the difference between the predicted discharge index and the actual discharge index is taken as the discharge index error. The discharge index error (PCT) (Q%) within the range was used to measure different levels. The distribution of the error, where Q represents different error levels, if If the proportion of samples less than 5% to the total sample is 10%, then the value of PCT(5%) is 10%, and so on. For detecting epileptiform activity, a joint cross-IoU comparison is used to measure the degree to which detected epileptiform activity events match the doctor-labeled events, i.e., the gold standard events. IoU is typically used to quantify the overlap between two events in a detection task, defined as the ratio of their intersection size to their union size. If two events completely overlap, the IoU equals 1; conversely, if they do not overlap at all, the IoU is obviously 0. To determine whether two events match, a threshold iou_th (0-1) needs to be set. If the IoU between the detected event and the gold standard event is greater than or equal to the threshold, they are considered to be matched. There may be multiple epileptiform activities in the gold standard event because when labeling epileptiform activity, two events with an interval of less than 0.3s are merged into one event. Therefore, if multiple detected events overlap with the gold standard event, the detected events are merged, and the matching degree is calculated using the gold standard event. The number of detected events that match the gold standard event is TP, otherwise it is FP. The number of events that identify the gold standard event as a normal event is FN. Precision and Recall are used to evaluate the effectiveness of event detection, as shown in the following formula: Precision represents the proportion of truly correct predictions out of all positive predictions; Recall represents the proportion of truly correct predictions out of all actual positive predictions. The higher the value, the lower the false negative rate. Step 5: Input the feature map of the sleep staging task into the sleep staging classifier to obtain the sleep stage of each sample, namely, wakefulness, non-rapid eye movement sleep, and rapid eye movement sleep. The specific process is as follows: Step 5-1: To obtain the sleep stage of the current sample, a sleep stage classifier was designed to acquire relevant information; firstly, the signal channel attention module weighted... For tasks in the sleep stage, the data is flattened by an adaptive average pooling layer, then passed through two linear layers with input and output sizes of (512, 128) and (128, 3) respectively. Finally, the softmax function is used to obtain the class probability value of the output, and the class with the highest probability value is taken as the result of sleep staging. Step 5-2: The model sleep staging results are measured using Accuracy, Precision, and Recall. Step 6: Train the MCAQN model using the preprocessed data, and combine it with the outputs of Steps 4 and 5 to achieve the identification and quantification of epileptic electrical activity during children's sleep.
2. The method for quantifying epileptic electrical persistence during sleep based on multi-task deep networks according to claim 1, characterized in that, r is set to 16.
3. The method for quantifying epileptic electrical persistence during sleep based on multi-task deep networks according to claim 1, characterized in that, The specific process of step 6 is as follows: Step 6-1: Optimize the MCAQN model using a combination of segmentation loss and classification loss; the joint loss function is defined as: wherein, , are the weights of the respective losses, both taken as 0.5; Step 6-2, split loss The binary cross-entropy loss is calculated as follows: Where n is the number of samples. It is a binary label value of 0 or 1. Indicates the actual output value; Step 6-3, Classification Loss The settings are as follows: Where n is the number of samples in each batch, and m is the number of predicted labels. and These are the true probability and the predicted probability, respectively.