A method for epileptic state recognition based on target similarity distribution adjustment
Through the bidirectional long short-term memory network and the target similarity distribution adjustment method, the positive and negative sample similarity distribution of the epileptic state recognition model is constructed and constrained, which solves the problem of insufficient accuracy in epileptic state recognition in the existing technology and achieves higher recognition sensitivity and accuracy.
Patent Information
- Application Number
- CN202111104344.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2041-09-18
AI Technical Summary
Existing epileptic state recognition models have difficulty effectively processing difficult-to-classify samples at the interface, resulting in insufficient recognition accuracy.
A method based on target similarity distribution adjustment is adopted to extract EEG signal features through a bidirectional long short-term memory network, construct the cosine similarity distribution of positive and negative sample pairs, and constrain the similarity distribution through KL divergence and mean loss function to pull it in opposite directions, thereby improving the model's discriminative ability.
The sensitivity, specificity and accuracy of epileptic state identification are improved, and the reliability of epileptic seizure detection is enhanced.
Smart Images

Figure CN114141356B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an epileptic state recognition method based on target similarity distribution adjustment. Background Art
[0002] In the field of epileptic state recognition, most current optimization work uses loss functions to distinguish different types of signals in order to extract more effective feature vectors. Common loss functions include the following three functions:
[0003] The 0-1 loss function is the simplest loss function. When implemented, if the model prediction value is not equal to the target value, the loss function outputs 1, indicating a loss; if the model prediction value is equal to the target value, the loss function outputs 0, indicating no loss.
[0004] Perceptron Loss function: given an error interval, if the error interval is within the error interval, it is considered correct.
[0005] Cross-entropy loss function: Cross-entropy is mainly used to measure the difference between the true probability distribution and the predicted probability distribution. By introducing the probability distribution difference, it can more accurately represent the difference between the predicted value and the true value.
[0006] The existing recognition model constraint loss function basically uses the cross-entropy loss function based on the classification concept for training. This type of loss function can better distinguish different types of signals, but it cannot process difficult-to-classify samples at the interface. Therefore, how to further improve the accuracy of the recognition model still remains difficult. Summary of the Invention
[0007] To solve the above problems, a method for identifying epileptic states based on target similarity distribution adjustment is provided. The present invention adopts the following technical solutions:
[0008] The present invention provides an epileptic state recognition method based on target similarity distribution adjustment, which is characterized by comprising the following steps: step S1, extracting a corresponding 512-dimensional feature vector according to an electroencephalogram signal through a neural network; step S2, constructing a similarity distribution of positive sample pairs and negative sample pairs through similarity calculation based on the extracted feature vector; step S3, stepwise setting the target similarity distribution, and constraining the positive sample pair distribution and the negative sample pair distribution through KL divergence; step S4, when the means of the positive sample pair distribution and the negative sample pair distribution reach the corresponding target distribution, the positive sample pair distribution increases the mean of the target distribution by a step value, and the negative sample pair distribution decreases the mean of the target distribution by a step value, so that the similarity distributions of the positive sample pair and the negative sample pair are pulled apart in opposite directions; step S5, repeating step S4 until the target distribution is no longer updated, thereby obtaining a trained neural network; step S6, performing epileptic state recognition through the trained neural network, and outputting a 512-dimensional feature vector of the epileptic state recognition state.
[0009] The present invention provides an epileptic state recognition method based on target similarity distribution adjustment, which may also have the following technical features: the neural network adopts a bidirectional long short-term memory network.
[0010] The present invention provides an epileptic state recognition method based on target similarity distribution adjustment, which may also have the following technical features: the positive sample pairs are EEG samples of the same type; and the negative sample pairs are EEG samples of different types.
[0011] The present invention provides an epileptic state recognition method based on target similarity distribution adjustment, which may also have the following technical features: wherein the similarity is the cosine similarity of the calculated samples, and its specific expression is:
[0012] sim(p,q(i,j))=cos sim (F(x p(i) ),F(x q(j) ))
[0013] p,q∈1,…,m,i,j∈1,…,N
[0014] In the formula, F(x p(i) ) is the feature vector of the i-th sample under the p-th category, F(x q(j) ) is the feature vector of the jth sample in the qth category, cos sim Indicates the calculation of cosine similarity, N represents the number of categories contained in the minibatch training within each pytorch software, and M represents the number of samples contained in each category.
[0015] The epileptic state recognition method based on target similarity distribution adjustment provided by the present invention may also have such a technical feature, wherein the step value is actually set to 0.05.
[0016] The present invention provides a method for identifying epileptic states based on target similarity distribution adjustment, which may also have the following technical features: the condition that the target distribution is no longer updated is:
[0017] μ CP ≤μ TP And μ CN ≥μ TN
[0018] Where μ CP is the mean of the similarity distribution of the current positive sample pair, μ TP is the mean of the similarity distribution of the target positive sample pair, μ CN is the mean of the similarity distribution of the current negative sample pair, μ TN is the mean of the similarity distribution of the target negative sample pair.
[0019] Functions and effects of the invention
[0020] According to the present invention, a method for identifying epileptic states based on target similarity distribution adjustment first extracts EEG signal features through a bidirectional long short-term memory neural network, constructs a cosine similarity distribution between samples of the same type (both in the attack period and the non-attack period) and a cosine similarity distribution between samples of different types (in the attack period and the non-attack period), increases the similarity of samples of the same type and decreases the similarity of samples of different types, thereby improving the sensitivity, specificity and accuracy of epileptic state identification.
[0021] Secondly, the present invention introduces the mean loss function, sets the target similarity distribution with steps, and constrains the distribution of positive sample pairs and negative sample pairs through KL divergence. When the means of the positive sample pair distribution and the negative sample pair distribution reach the corresponding target distribution, the positive sample pair distribution increases a step value relative to the target distribution mean, and the negative sample pair distribution decreases a step value relative to the target distribution mean, so that the similarity distributions of the positive sample pairs and the negative sample pairs are pulled in opposite directions, thereby making the model learning more discriminative features, effectively improving the reliability of epileptic seizure detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flow chart of a method for identifying epileptic states based on target similarity distribution adjustment in an embodiment of the present invention;
[0023] Figure 2 is a schematic diagram of a bidirectional long short-term memory network according to an embodiment of the present invention;
[0024] Figure 3is a schematic diagram of an epileptic state recognition method based on target similarity distribution adjustment in an embodiment of the present invention;
[0025] Figure 4 2 is a schematic diagram of the mean loss structure in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the technical means, creative features, objectives and effects of the present invention easier to understand, the following is a detailed description of an epileptic state recognition method based on target similarity distribution adjustment of the present invention in combination with embodiments and drawings.
[0027] <Example>
[0028] Figure 1 This is a flowchart of an epileptic state recognition method based on target similarity distribution adjustment in an embodiment of the present invention.
[0029] like Figure 1 As shown, a method for identifying epileptic states based on target similarity distribution adjustment includes the following steps:
[0030] Step S1: extracting the corresponding 512-dimensional feature vector based on the EEG signal through a neural network.
[0031] The epileptic EEG signals used are the multi-channel long-term EEG signal dataset CHB-MIT collected by Boston Children's Hospital in the United States. The CHB-MIT dataset uses bipolar reference electrodes to record EEG of children with severe epilepsy. The database contains EEG data of 23 patients, and for each subject, EEG signals were recorded continuously for dozens of hours. All EEG signals are sampled at a frequency of 256Hz with a resolution of 16 bits. According to the 10-20 standard electrode placement system published by the International Federation of Clinical Neurophysiology, 23 bipolar electrodes are placed to record EEG signals, and the recorded data contains 23 channels (24 or 26 in a few cases).
[0032] Figure 2 Schematic diagram of a bidirectional long short-term memory network in an embodiment of the present invention.
[0033] like Figure 2As shown in the figure, a Bilateral Long Short Term Memory (BiLSTM) neural network (F) is used to extract deep features from 0.5-second window EEG signals. The BiLSTM network can be viewed as a two-layer neural network. The first layer processes input from front to back, which, from the perspective of EEG signal processing, means the model input starts from the beginning of the EEG signal. The second layer processes input from back to front, using the end of the EEG signal as the model input. The same processing is performed as in the first layer, and the results of both layers are combined to obtain the extracted feature vector.
[0034] Step S2: construct the similarity distribution of the positive sample pairs and the negative sample pairs through similarity calculation based on the extracted feature vectors.
[0035] These extracted feature vectors are divided into positive sample pairs and negative sample pairs according to the category labels. Each sample pair consists of two samples, and the similarity between the two samples is the cosine similarity of the samples, which is expressed as:
[0036] sim(p,q(i,j))=cos sim (F(x p(i) ),F(x q(j) ))
[0037] p,q∈1,…,m,i,j∈1,…,N
[0038] In the formula, F(x p(i) ) is the feature vector extracted from the i-th sample under the p-th category, F(x q(j) ) is the extracted feature vector of the jth sample in the qth category, cos sim Indicates the calculation of cosine similarity, N represents the number of categories contained in the minibatch training within each pytorch software, and M represents the number of samples contained in each category.
[0039] When p=q, i≠j, the similarity of the positive sample pair is expressed as sim P , when p≠q, the similarity of the negative sample pair is expressed as sim N .
[0040] Similar to histogramloss, this embodiment constructs similarity distribution according to the following method: when the label m ij =1 indicates a positive sample pair, m ij =-1 label indicates a negative sample pair; thus, this study can obtain the similarity of the c-th positive sample as SIM P ={sim p (i,j)|m ij =1}c, the similarity of the negative sample pair is SIMN ={sim N (i,j)|m ij =-1}. The similarity score range of each sample pair is [-1:1]. Then this study uses the T-dimensional histogram node hn1 = -1,hn2,…,hn T =1 to fill the range [-1,1], and the step size is set to The value of each node of the histogram is calculated by the following formula:
[0041]
[0042] Where (i, j) contains all positive sample pairs. Different from histgram, δ i,j,t The weight is calculated by the following formula:
[0043]
[0044] Where θ represents the expansion parameter of the Gaussian kernel function, hn t Represents the tth node of the histogram. Histogram H N The construction of is similar to this.
[0045] Figure 3 3 is a schematic diagram of an epileptic state recognition method based on target similarity distribution adjustment in an embodiment of the present invention.
[0046] like Figure 3 As shown in the figure, Group A and Group B represent EEG signals during epileptic seizures and non-seizures, respectively. The blue backbone represents the feature extraction network, namely the BiLSTM network, which is used to extract 512-dimensional features from the EEG signals. These features serve as the input to the loss function. Group A and Group B represent EEG signals during epileptic seizures and non-seizures, respectively. The blue backbone represents the feature extraction network, namely the BiLSTM network, which is used to extract 512-dimensional features from the EEG signals. These features serve as the input to the loss function.
[0047] By constraining the current distribution, the gap between it and the target distribution will be reduced. The target distribution is given by and The current distribution is also composed of two parts, and
[0048] Step S3: progressively set the target similarity distribution, and constrain the distribution of positive sample pairs and negative sample pairs through KL divergence.
[0049] This embodiment uses KL divergence to constrain the gap between the current distribution and the target distribution. The specific calculation formula is as follows:
[0050]
[0051] Where α1 and α2 are weight parameters.
[0052] Step S4: When the mean of the positive sample pair distribution and the negative sample pair distribution reach the corresponding target distribution, the mean of the positive sample pair distribution relative to the target distribution is increased by a step value, and the mean of the negative sample pair distribution relative to the target distribution is decreased by a step value, so that the similarity distributions of the positive sample pair and the negative sample pair are pulled apart in opposite directions.
[0053] Figure 4 Schematic diagram of the meanloss structure in an embodiment of the present invention.
[0054] like Figure 4 As shown, in order to further expand the distance between distributions, this embodiment introduces a simple and effective Mean loss function, which is composed of the mean difference of the similarity distributions of positive sample pairs and negative sample pairs. and The calculation formula is as follows:
[0055]
[0056] Where E is the expectation operator and α3 is the weight parameter.
[0057] Then the final loss function of the progressive target similarity distribution is:
[0058] Loss PTD =Loss KL +Loss Mean .
[0059] The progressive target similarity distribution adjustment loss function is set as follows. The step size of each target similarity distribution mean update is pr. Based on pr, the distribution mean after each target similarity distribution update is:
[0060]
[0061]
[0062] Where, and Represent the mean of the similarity distribution of the i+1th positive sample pair and negative sample pair, and Represent the means of the similarity distributions of the i-th positive sample pair and negative sample pair, respectively.
[0063] Step S5, repeat step S4 until the target distribution is no longer updated, and a trained neural network is obtained.
[0064] For the i-th step update, the target similarity distribution of the positive sample pair is set to have a mean of Gaussian distribution with standard deviation std; the target distribution of negative sample pairs is set to mean Gaussian distribution with standard deviation std.
[0065] μ CP and μ CN Set to the mean of the similarity distribution of the current positive sample pair and the negative sample pair. For the positive sample pair, once μ CP ≥μ TP , this step ends, the next step starts immediately, and the mean of the target similarity distribution will also be updated. For the similarity distribution of negative sample pairs, the condition for entering the next step is μ CN ≤μ TN In other words, the movement of positive and negative samples to target similarity is not synchronized. In addition, if μ CP ≤μ TP And μ CN ≥μ TN The training ends after k epochs.
[0066] Step S6: epileptic state recognition is performed using the trained neural network, and a 512-dimensional feature vector of the epileptic state recognition state is output.
[0067] Example Function and Effect
[0068] According to a method for identifying epileptic states based on target similarity distribution adjustment in this embodiment, first, this embodiment extracts EEG signal features through a bidirectional long short-term memory neural network, constructs a cosine similarity distribution between samples of the same type (the same seizure period and the same non-seizure period) and a cosine similarity distribution between samples of different types (seizure period and non-seizure period), increases the similarity of samples of the same type and decreases the similarity of samples of different types, thereby improving the sensitivity, specificity and accuracy of epileptic state identification.
[0069] Secondly, this embodiment introduces the mean loss function, sets the target similarity distribution with steps, and constrains the positive sample pair distribution and the negative sample pair distribution through KL divergence. When the mean of the positive sample pair distribution and the negative sample pair distribution reaches the corresponding target distribution, the positive sample pair distribution increases the target distribution mean by a step value, and the negative sample pair distribution decreases the target distribution mean by a step value, so that the similarity distributions of the positive sample pair and the negative sample pair are pulled in opposite directions, thereby making the model learning more discriminative features, effectively improving the reliability of epileptic seizure detection.
[0070] The above embodiments are only used to illustrate specific implementations of the present invention, and the present invention is not limited to the description scope of the above embodiments.
Claims
1. A method for identifying epileptic states based on target similarity distribution adjustment, characterized in that: The following steps are involved: Step S1, extracting the corresponding 512-dimensional feature vector based on the EEG signal through a neural network; Step S2, constructing a similarity distribution of positive sample pairs and negative sample pairs by similarity calculation based on the extracted feature vectors; Step S3, progressively setting the target similarity distribution, and constraining the distribution of the positive sample pairs and the distribution of the negative sample pairs by KL divergence; Step S4: When the means of the positive sample pair distribution and the negative sample pair distribution reach the corresponding target distribution, the positive sample pair distribution increases the mean of the target distribution by a step value, and the negative sample pair distribution decreases the mean of the target distribution by a step value, so that the similarity distributions of the positive sample pair and the negative sample pair are pulled apart in opposite directions; Step S5, repeating step S4 until the target distribution is no longer updated, thereby obtaining the trained neural network; Step S6: epileptic state recognition is performed through the trained neural network, and a 512-dimensional feature vector of the epileptic state recognition state is output. Wherein, the neural network adopts a bidirectional long short-term memory network, The similarity is the cosine similarity of the calculated samples, and its specific expression is: sim(p,q(i,j))=cos sim (F(x p(i) ),F(x q(j) )) p,q∈1,…,m,i,j∈1,…,N In the formula, F(x p(i) ) is the feature vector of the i-th sample under the p-th category, F(x q(j) ) is the feature vector of the jth sample in the qth category, cos sim Indicates the calculation of cosine similarity, N represents the number of categories contained in the minibatch training in each pytorch software, m represents the number of samples contained in each category, when p = q, i ≠ j, the similarity of the positive sample pair is expressed as sim P , when p≠q, the similarity of the negative sample pair is expressed as sim N , The similarity distribution is constructed as follows: when the label m ij =1 indicates a positive sample pair, m ij =-1 label indicates a negative sample pair; thus the similarity of the c-th positive sample is SIM P ={sim p (i,j)|m ij =1}c, the similarity of the negative sample pair is SIM N ={sim N (i,j)|m ij =-1}, the similarity score range of each sample pair is [-1:1], and then the T-dimensional histogram node hn1 = -1,hn2,…,hn T =1 to fill the range [-1,1], and the step size is set to The value of each node of the histogram is calculated by the following formula: Where (i, j) contains all positive sample pairs, δ i,j,t The weight is calculated by the following formula: Where θ represents the expansion parameter of the Gaussian kernel function, hn t represents the tth node of the histogram, Use KL divergence to constrain the gap between the current distribution and the target distribution. The specific calculation formula is as follows: Where α1 and α2 are weight parameters, In order to further expand the distance between distributions, the Mean loss function is introduced, which is the mean difference between the similarity distributions of positive and negative sample pairs. and The calculation formula is as follows: Where E is the expectation operator, α3 is the weight parameter, Then the final loss function of the progressive target similarity distribution is: Loss PTD =Loss KL +Loss Mean , The progressive target similarity distribution adjustment loss function is set as follows. The step size of each target similarity distribution mean update is pr. Based on pr, the distribution mean after each target similarity distribution update is: Where, and Represent the mean of the similarity distribution of the i+1th positive sample pair and negative sample pair, and Represent the means of the similarity distributions of the i-th positive sample pair and negative sample pair, respectively.
2. The epileptic state recognition method based on target similarity distribution adjustment according to claim 1, characterized in that: in, The positive sample pairs are EEG samples of the same type; The negative sample pairs are EEG samples of different types.
3. The epileptic state recognition method based on target similarity distribution adjustment according to claim 1, characterized in that: in, The step value is actually set to 0.
05.
4. The epileptic state recognition method based on target similarity distribution adjustment according to claim 1, characterized in that: in, The condition under which the target distribution is no longer updated is: μ CP ≤μ TP And μ CN ≥μ TN Where μ CP is the mean of the similarity distribution of the current positive sample pair, μ TP is the mean of the similarity distribution of the target positive sample pair, μ CN is the mean of the similarity distribution of the current negative sample pair, μ TN is the mean of the similarity distribution of the target negative sample pair.
Citation Information
Patent Citations
Recognition method of epileptic electroencephalograph based on two-dimensional time-frequency image depth convolution neural network
CN106909784A
Radar target recognition method based on serial secondary reinforcement training
CN112684427A