An intelligent emotional state recognition and regulation method based on EEG signals

By combining CNN and Transformer models for EEG emotion recognition, and using the method of combining contextual multi-armed bandits with music, we solve the problem of limited computational complexity and effect in EEG signal emotion recognition and regulation in the existing technology, and achieve high efficiency. Emotion recognition and regulation effects.

CN114384998BActive Publication Date: 2024-10-29NANJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111339456.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-12
Publication Date
2024-10-29
Estimated Expiration
2041-11-12

AI Technical Summary

Technical Problem

Existing technologies have problems such as high computational complexity and poor performance in emotion recognition and regulation of EEG signals. Moreover, traditional methods have limited effects on emotion regulation and lack practical significance.

Method used

Using the Transformer model that combines convolutional neural network (CNN) and natural language processing, the EEG emotion recognition results are obtained through adaptive weighted fusion, and the context multi-armed bandit is combined with music to construct the user's EEG emotion-song feature matrix. Dynamically updated for emotional regulation.

Benefits of technology

It achieves accurate feature extraction and emotion recognition of EEG data, achieves effective emotional relief through music adjustment, and improves the accuracy of emotion recognition and the effectiveness of adjustment, which has practical significance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114384998B_ABST
    Figure CN114384998B_ABST
Patent Text Reader

Abstract

An intelligent emotional state recognition and regulation method based on EEG signals integrates music and EEG signals, focuses on objective and real emotional states to perform emotion recognition and regulation, uses an emotional state recognition model that integrates CNN and Transformer in an adaptive parameter weighted manner to process EEG data and obtain the current real emotional state, and uses the characteristics of the context slot machine of reinforcement learning to form a closed-loop regulation process for EEG emotions and music selection. The context feature information is the user's EEG emotion-song feature matrix, and the real-time EEG emotional state is used as the feedback for regulation. The music selection engine will select music based on the feedback, and the context feature information will also be updated based on the feedback, thereby participating in the next cycle process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of brain-computer interface and artificial intelligence technology, and specifically relates to an intelligent emotional state recognition and regulation method based on electroencephalogram signals. Background Art

[0002] Brain waves are the most direct way to express the state of the human brain, and are also the most objective information that reflects a person's true emotions at the moment. Many psychological or mental illnesses are closely related to human emotions. In most cases, the condition worsens due to the inability to effectively regulate emotions. The intelligent emotional state recognition and regulation method based on EEG signals can recognize a person's true emotions at the moment, and regulate them through the recognition results, achieving a virtuous cycle.

[0003] Traditional EEG emotion recognition research adjusts model performance by processing EEG signal features and building classifiers. The main methods are machine learning and deep learning. Although machine learning algorithms are simple and easy to operate, they will increase computational complexity and perform poorly when faced with large data sets, especially EEG data. Deep learning can fully extract features and achieve good recognition results, but there is still a problem of network complexity.

[0004] Emotion regulation is generally carried out through music, movies, meditation, etc., and there are few existing studies using EEG as a regulatory factor. Some studies have shown that EEG state activity has a significant correlation with the emotion regulation process, but for regulation, they often only focus on one regulation change process, while emotion regulation can only achieve significant results through multiple adjustments, so it still lacks practical significance.

[0005] With the development of computer technology, deep learning and natural language Transformer models can complement each other in a sense. For EEG emotion recognition, we can take advantage of the convolution calculation to extract local features and the attention mechanism to extract correlation features to extract useful feature maps from high-dimensional data. In terms of performance, the two models can be combined for adaptive weighting. The network can be trained to obtain a suitable weight to achieve better performance. Therefore, the model does not need to increase the network depth to improve accuracy.

[0006] According to the research on emotional states, emotional regulation focuses more on people's real emotions at the moment. Therefore, the contextual multi-armed bandit in reinforcement learning can integrate EEG into the cycle of emotional regulation. When music is used as a regulation method, this method uses the context feature matrix to record the effect of the user after each listening to music, and uses EEG emotions and listening time as feedback after regulation. The regulation system will select music for the next regulation based on the new feedback, so as to achieve a positive regulation effect in this cycle. Summary of the invention

[0007] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide an intelligent emotional state recognition and regulation method based on EEG signals, which integrates music and EEG signals, can fully extract features of EEG data and accurately identify them, and focus on objective and real emotional states to perform emotion recognition and regulation.

[0008] The present invention provides an intelligent emotional state recognition and regulation method based on EEG signals, comprising the following steps:

[0009] Step S1. Constructing an emotion state recognition model based on EEG signals;

[0010] Step S2. Obtaining the user's real-time EEG data;

[0011] Step S3. Preprocess the collected EEG data to obtain EEG DE features;

[0012] Step S4. Perform emotion recognition on the processed DE data through the emotion state recognition model to obtain the user's current emotion label;

[0013] Step S5. In the adjusted initial state, construct the user EEG emotion-song feature matrix. If it is not the initial state, update the user EEG emotion-song feature matrix according to the emotion label and the listening time;

[0014] Step S6. Select music based on the user's EEG emotion-song feature matrix and feed it back to the user, and repeat steps S2-S6 until the EEG emotion is calm.

[0015] As a further technical solution of the present invention, the emotional state recognition model based on EEG signals is constructed in step S1 as follows:

[0016] The EEG samples were divided into training sets and test sets, and an emotion recognition model was constructed. Emotion recognition included a CNN model and a Transformer model. The CNN model contained four blocks, each of which included 2D-CNN, BatchNormalization, LeakyReLU, and AvgPooling. Dropout layers were added to the last two blocks, and the model optimizer was Adam. The Transformer model included an encoder and a decoder. The decoder was a linear layer and a softmax layer, and the encoder included an 8-head self-attention layer and a feedforward layer.

[0017] The training data is input into two models at the same time, the EEG signals are recognized and classified respectively, and the final classification result is obtained through the adaptive weighted fusion of the two models;

[0018] The model was verified using the test set to obtain the emotional state recognition model with the best accuracy, F1 value, precision and recall.

[0019] Furthermore, the specific process of adaptive weighted fusion is to perform adaptive weighted fusion before classification, and the weighting parameter σ is obtained by network training; the EEG data is obtained through the CNN model out1 = [a1, a2, a3], and the Transformer model is used to obtain out2 = [b1, b2, b3], where a i (i=1, 2, 3) and b i (i=1, 2, 3) are the scores of the three emotion categories obtained after calculation by the model; the two outputs will be calculated through the formula Output=σ×out1+(1-σ)×out2 to obtain the final emotion label Output.

[0020] Furthermore, the preprocessing in step S3 is to process the EEG signal using frequency domain analysis and linear dynamic system LDS to obtain smooth EEG DE features. The specific steps are:

[0021] Step S31. Obtain a segment of EEG data;

[0022] Step S32. Downsample the EEG signal to 200 Hz using a 1-75 Hz bandpass filter;

[0023] Step S33. Use short-time Fourier transform and Hanning window to transform the EEG into frequency domain and extract frequency domain features:

[0024]

[0025] Where x(m) is the time series signal, ω(m) is the window function, which is reversed in time and has an offset of n samples; k = 0, 1, 2, 3...N, k is the sample point number, N is the number of time series sampling points, ω k =2πk / N is the angular frequency;

[0026] Step S34: Perform time-frequency analysis on the signal to obtain the frequency band energy spectral density E(n, ω)=|X(n, ω) corresponding to each frequency band k )| 2 ;

[0027] Step S35: Estimate the differential entropy characteristics of the frequency band according to the energy spectrum density of the frequency band

[0028] Step S36: Perform LDS processing on the EEG sequence after feature extraction to obtain smoother EEG DE features.

[0029] Further, in step S5, the specific steps of constructing the user EEG emotion-song feature matrix and updating the user EEG emotion-song feature matrix according to the emotion label and the listening time are as follows:

[0030] Step S51. Use the user's EEG emotion-song feature matrix as the context feature matrix to construct the context feature matrix u t =[s1,s2,s3,......s f ],s f is the user's preference for song f, and its initial state is 0;

[0031] Step S52: In order to make the selected song available for selection again after a certain period of time, the context feature matrix becomes Among them, t_sf is the number of rounds that the song was selected last time, and B is the interval hyperparameter. If the interval of song f exceeds B, the possibility of being selected next time will become greater;

[0032] Step S53. After each adjustment, the user's EEG emotion-song feature matrix update function Among them, U t' is the matrix before adjustment, r t The feedback after this adjustment is obtained; the songs needed for the next adjustment are selected through the updated user EEG emotion-song feature matrix.

[0033] Further, in step S6, the specific process of selecting music according to the user's EEG emotion-song feature matrix is ​​as follows:

[0034] Step S61. Use the contextual multi-armed bandit to learn the user's emotional state towards music and select the song the user wants. t After that, the action set A t Select an action to select music; Action Set A t Indicated as A t =[a t,1 , a t,2 , ..., a t,f ];

[0035] Step S62: Use a linear function to calculate the expected return of this round by using the returns received in all previous rounds.

[0036] Step S63. Using the ε-greedy algorithm as the strategy for selecting actions, in T recommendation rounds, the agent will select the arm a with the greatest expectation with a probability of 1-ε * t, randomly select an arm with a probability of ε, and finally update the user's EEG emotion-song feature matrix according to the user's real emotional feedback; adjust the exploration intensity through ε, when the recommendation round t>k, ε is a constant l to maintain exploration; ε is expressed as

[0037]

[0038] Step S64. In each round, the optimal action strategy is Benefits t It is determined by the EEG emotion e_tag and the user's listening time s-time; when the EEG emotion is happy and calm, e_tag = 1, and when the EEG emotion is sad, e_tag = -1; the influence of EEG emotion on emotion regulation will increase as the round t increases, and rt is

[0039] Step S65. Return the selected music with the greatest expected benefit to the user, and obtain the user's emotional feedback on the music again, and repeat this cycle until the EEG emotions are stable and calm.

[0040] The advantages of the present invention are:

[0041] 1. Integrate EEG emotions into emotion regulation, use music as a way of regulation, pay attention to the user's current state, select the music required by the user for regulation, and achieve effective emotion relief.

[0042] 2. Use the complementarity of convolutional neural networks and the Transformer model in natural language processing to perform EEG emotion recognition, fully extract EEG spatiotemporal features, and perform model fusion by adaptively adjusting weights. The weight adjustment process is performed during training, which is faster and more accurate than manual parameter adjustment. At the same time, the model is more lightweight while ensuring performance.

[0043] 3. Use the contextual multi-armed bandit machine to perfectly integrate real-time EEG emotions with music. The two influence each other and jointly promote positive emotional regulation.

[0044] 4. It has achieved excellent results on both public EEG datasets and local emotion experimental data. Compared with other methods, the accuracy of EEG recognition and the effectiveness of emotion regulation have shown obvious advantages. This method is more practical in reality. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a schematic diagram of the process of the present invention;

[0046] Figure 2 It is a structural diagram of the emotional state recognition model of the present invention. DETAILED DESCRIPTION

[0047] See also Figure 1 This embodiment provides a natural language reasoning method for an intelligent question answering system of the present invention, and the specific steps are as follows:

[0048] Step 1: Build an emotional state recognition model;

[0049] The EEG data is divided into training set and test set, and the CNN model and Transformer model are built as follows Figure 2 As shown in the figure, the two models train the data at the same time, and the performance is tested every n training times. At the same time, the best adaptive weight σ is trained. The final emotion state recognition model is:

[0050] Output=σ×out1+(1-σ)×out2

[0051] Step 2: Obtain the user's real-time EEG data;

[0052] EEG signals are spontaneous potential activities of the central nervous system, which contain rich information about brain activities. The present invention uses existing EEG recording equipment to collect the user's EEG signals in real time. The EEG signal format is as follows:

[0053] [-11.62290573 -16.21246338 -17.13633537 ... -46.10419273 -51.05137825 -43.6604023]

[0054] Step 3: Preprocess the collected EEG data to obtain EEG DE features;

[0055] The present invention uses short-time Fourier transform and Hanning window to perform frequency domain transformation on EEG to extract frequency domain features; and further performs time-frequency analysis on EEG to obtain the frequency band energy spectrum density corresponding to each frequency band;

[0056] According to the energy spectrum density of the frequency band, the differential entropy feature DE of the frequency band is estimated; [[28.23224513 27.06461679 23.22665201 18.84287386 18.05756243][29.34750519 25.39820461 21.42098819 18.75340012 17.50319028][29.7454774920.98537702 20.0344921 17.60777294 17.48946017]...[28.0975926925.0344653120.42639499 17.98869508 16.22530561][27.85209882 24.86370014 20.4503821817.63034986 16.13263936][28.11149815 24.15378672 20.25027853 17.5838106716.17474008]]

[0058] The EEG sequence after feature extraction is processed by LDS to obtain smooth EEG DE features. [[28.2134122 23.35981044 20.51525207 18.16684024 17.0527004][28.21729617 23.35570993 20.5130418 18.1666351 17.05314969][28.2200499223.34956694 20.50992358 18.16584321 17.05314894]...[27.92576178 23.7023815420.52143686 18.05485202 16.78921765][27.92746766 23.70042617 20.5213285518.05366244 16.78769799][27.93035621 23.69962645 20.52057729 18.0531825216.78688855]]

[0060] Step 4: Use the emotional state recognition model to perform emotion recognition on the processed DE data to obtain the user's current emotional label;

[0061] EEG data is obtained through CNN model out1 = [a1, a2, a3], a i (i=1, 2, 3) represents the scores of three emotion categories; for example: out1=[0.7, 0.2, 0.1].

[0062] The EEG data is obtained through the Transformer model out2 = [b1, b2, b3], b i (i=1, 2, 3) represents the scores of three emotion categories; for example: out2=[0.2, 0.6, 0.2].

[0063] out1 and out2 are calculated by the formula:

[0064] Output=0.6×out1+(1-0.6)×out2

[0065] The final emotion label Output = [0.5, 0.36, 0.14] is obtained. The scores of positive, calm, and negative emotions are 0.5, 0.36, and 0.14 respectively. The next step is to label the emotion as positive.

[0066] Step 5: In the initial state of adjustment, construct the user EEG emotion-song feature matrix. If it is not the initial state, update the user EEG emotion-song feature matrix according to the emotion label and the listening time;

[0067] The song set is: [Song 1, Song 2, Song 3, ..., Song F]

[0068] In the initial state, the user EEG emotion-song feature matrix is ​​constructed as follows:

[0069]

[0070] Assume that the instance is not in the initial state, and the last user EEG emotion-song feature matrix is:

[0071]

[0072] The emotion tag obtained in step 3 is positive, e_tag = 1;

[0073] Get the user's listening time time =15s

[0074] Calculate the profit r of round t = 10 t :

[0075] Benefits t It depends on the EEG emotion e_tag and the user's listening time s_time. When the EEG emotion is happy and calm, e_tag = 1, and when the EEG emotion is sad, e_tag = -1. The influence of EEG emotion on emotion regulation will increase as the round t increases, and rt is expressed as follows:

[0076]

[0077] Update the formula based on the user's EEG emotion-song feature matrix:

[0078] update[U t |U t' , r t ]=U t' +r t

[0079] U t' represents the matrix before adjustment, r t represents the feedback after this adjustment. The user EEG emotion-song feature matrix is ​​updated as:

[0080]

[0081] Use a linear function to pass the rewards received from all previous rounds To calculate the expected return of the next adjustment round for each song:

[0082] where θ t,a represents a strategy coefficient for selecting arm (song) a, through θ t,a =(U T t,a U t,a +I)U t,a R t,a , we get θ t,a =[0.00362, 0.046, ..., 0.0477]. The expected benefit of each song is as follows,

[0083]

[0084] Using the ε-greedy algorithm as the strategy for selecting actions (music), in T recommendation rounds, the agent will select the arm (music) with the maximum expectation with a probability of 1-ε * t , randomly select an arm (music) with a probability of ε, and finally update the user's EEG emotion-song feature matrix based on the user's real emotional feedback. The exploration intensity is adjusted by ε. When the recommendation round t>k (assuming k=5), ε is a constant l (assuming 1=0.2) to maintain exploration. ε is expressed as follows:

[0085]

[0086] according to The song 11 with the highest expected return is selected as the song for the next adjustment.

[0087] Step 6: Select the music and return it to the user, and repeat steps 2-6 until the EEG emotions are calm.

[0088] After the user listens to the music, the user's EEG emotions will be obtained again. This cycle will be repeated to learn the user's emotional habits and which song is more beneficial to the user's emotional regulation in a negative state.

[0089] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above specific embodiments. The above specific embodiments and the description in the specification are only for further illustrating the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of the present invention to be protected is defined by the claims and their equivalents.

Claims

1. An intelligent emotional state recognition and regulation method based on EEG signals, characterized in that: The following steps are included: Step S1. Constructing an emotional state recognition model based on EEG signals; Step S2. Obtaining the user's real-time EEG data; Step S3. Preprocess the collected EEG data to obtain EEG DE features; Step S4. Perform emotion recognition on the processed DE data through the emotion state recognition model to obtain the user's current emotion label; Step S5. In the adjusted initial state, construct the user EEG emotion-song feature matrix. If it is not the initial state, update the user EEG emotion-song feature matrix according to the emotion label and the listening time; Step S6. Select music according to the user's EEG emotion-song feature matrix and feed it back to the user, and repeat steps S2-S6 until the EEG emotion is calm; The step S1 of constructing an emotional state recognition model based on EEG signals is specifically as follows: The EEG samples were divided into training sets and test sets, and an emotion recognition model was constructed. Emotion recognition included a CNN model and a Transformer model. The CNN model contained four blocks, each of which included 2D-CNN, BatchNormalization, LeakyReLU, and AvgPooling. Dropout layers were added to the last two blocks, and the model optimizer was Adam. The Transformer model included an encoder and a decoder. The decoder was a linear layer and a softmax layer, and the encoder included an 8-head self-attention layer and a feedforward layer. The training data is input into two models at the same time, the EEG signals are recognized and classified respectively, and the final classification result is obtained through the adaptive weighted fusion of the two models; The model was verified using the test set to obtain the best emotion state recognition model with the best accuracy, F1 value, precision and recall: In step S5, the specific steps of constructing the user's EEG emotion-song feature matrix and updating the user's EEG emotion-song feature matrix according to the emotion label and the listening time are as follows: Step S51. Use the user's EEG emotion-song feature matrix as the context feature matrix to construct the context feature matrix u t =[s1,s2,s3,......s f ],s f is the user's preference for song f, and its initial state is 0; Step S52: In order to make the selected song available for selection again after a certain period of time, the context feature matrix becomes Among them, t_s f is the number of rounds that the song was last selected, and B is the interval hyperparameter. If the interval of song f exceeds B, the possibility of being selected next time will become greater; Step S53. After each adjustment, the user's EEG emotion-song feature matrix update function update|U t' ,r t ]=U t' +r t , where U t' is the matrix before adjustment, r t This is the feedback after this adjustment; the song needed for the next adjustment is selected through the updated user EEG emotion-song feature matrix.

2. The intelligent emotional state recognition and regulation method based on EEG signals according to claim 1 is characterized in that: The specific process of the adaptive weighted fusion is as follows: Adaptive weighted fusion is performed before classification, and the weighting parameter σ is obtained by network training; the EEG data is obtained through the CNN model out1 = [a1, a2, a3], and the Transformer model is used to obtain out2 = [b1, b2, b3], where a i (i=1, 2, 3) and b i (i=1, 2, 3) are the scores of the three emotion categories obtained after calculation by the model; the two outputs will be calculated through the formula Output=σ×out1+(1-σ)×out2 to obtain the final emotion label Output.

3. The intelligent emotional state recognition and regulation method based on EEG signals according to claim 1 is characterized in that: The preprocessing in step S3 is to process the EEG signal using frequency domain analysis and linear dynamic system LDS to obtain smooth EEG DE features. The specific steps are: Step S31. Obtain a segment of real-time EEG data; Step S32. Downsample the EEG signal to 200 Hz using a 1-75 Hz bandpass filter; Step S33. Use short-time Fourier transform and Hanning window to perform frequency domain transformation on the EEG to extract frequency domain features; Where x(m) is the time series signal, ω(m) is the window function, which is reversed in time and has an offset of n samples; k=0, 1, 2, 3...N, k is the sample point number, N is the number of time series sampling points, ω k =2πk / N is the angular frequency; Step S34: Perform time-frequency analysis on the signal to obtain the frequency band energy spectral density E(n,ω)=|X(n,ω k )| 2 ; Step S35. Estimate the differential entropy characteristics of the frequency band according to the frequency band energy spectral density Step S36: Perform LDS processing on the EEG sequence after feature extraction to obtain smoother EEG DE features.

4. The method for intelligent emotional state recognition and regulation based on EEG signals according to claim 1, It is characterized in that In step S6, the specific process of selecting music according to the user's EEG emotion-song feature matrix is ​​as follows: Step S61. Use the contextual multi-armed bandit to learn the user's emotional state towards music and select the song the user wants. t After that, the action set A t Select an action to select music; Action Set A t Indicated as A t =[a t,1 , a t,2 , ..., a t,f ]; Step S62: Use a linear function to calculate the expected return of this round by using the returns received in all previous rounds. Step S63. Using the ε-greedy algorithm as the strategy for selecting actions, in T recommendation rounds, the agent will select the arm a with the greatest expectation with a probability of 1-ε * t , randomly select an arm with a probability of ε, and finally update the user's EEG emotion-song feature matrix according to the user's real emotional feedback; adjust the exploration intensity through ε, when the recommendation round t>k, ε is a constant l to maintain exploration; ε is expressed as Step S64. In each round, the optimal action strategy is Benefits t It is determined by the EEG emotion e_tag and the user's listening time s_time; when the EEG emotion is happy and calm, e_tag = 1, and when the EEG emotion is sad, e_tag = -1; the influence of EEG emotion on emotion regulation will increase as the round t increases, and rt is Step S65. Return the selected music with the greatest expected benefit to the user, and obtain the user's emotional feedback on the music again, and repeat this cycle until the EEG emotions are stable and calm.

Citation Information

Patent Citations

  • Device and method for adjusting driver emotional state through different affective characteristic music

    CN104548309A

  • Vocal music performance teaching method and system

    CN112734946A