Electroencephalogram signal detection method and device, electronic equipment and storage medium
By dividing the frequency band of EEG signals and classifying the XGBoost model, the problem of insufficient accuracy of EEG signals in the prior art is solved, and higher classification accuracy and computing efficiency are achieved.
Patent Information
- Application Number
- CN202510679248.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-08-19
AI Technical Summary
In the prior art, the detection accuracy and explanatory nature of EEG signals for emotional recognition based on traditional decision trees or random forests is insufficient.
By obtaining the signals collected by the EEG electrodes and performing frequency band division, using band power spectral density calculation and XGBoost model for signal classification, determine the changes in each frequency band and improve the accuracy of classification results.
It improves the accuracy of EEG signal classification, can capture signal change information more accurately, and provides a basis for the classification results of each frequency band, reducing the computational complexity.
Smart Images

Figure CN120501440A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electroencephalogram (EEG) signal processing, and in particular to an EEG signal detection method, device, electronic device, and storage medium. Background Art
[0002] As our understanding of brain function continues to deepen, more and more research has begun to focus on the relationship between EEG activity during sleep, especially during the rapid eye movement (REM) stage, and emotional states. The REM stage is a special stage in the sleep cycle during which the human body experiences rapid eye movements, muscle relaxation, and the occurrence of dreams. In recent years, studies have shown that EEG activity during the REM stage may be closely related to an individual's emotional experience. However, existing technologies often use traditional decision tree or random forest methods for emotion recognition, which have shortcomings in accuracy and interpretability. Summary of the Invention
[0003] The present invention provides an EEG signal detection method, device, electronic device and storage medium to solve the problem of inaccurate detection results caused by directly detecting emotions based on EEG signals.
[0004] According to one aspect of the present invention, there is provided a method for detecting an electroencephalogram signal, comprising:
[0005] Acquiring a first signal collected by an EEG electrode; the first signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrode;
[0006] Performing frequency band division on the first signal to obtain multiple groups of second signals; wherein the first signal segments in different groups of the multiple groups of second signals correspond to different frequency bands, and the first signal segments in the same group belong to the same frequency band interval;
[0007] Signal classification is performed on the first signal according to the multiple groups of second signals to obtain a first classification result; the first classification result is used to characterize the value of a preset feature in the first signal.
[0008] According to another aspect of the present invention, there is provided an electroencephalogram (EEG) signal detection device, comprising:
[0009] A first signal acquisition module is configured to acquire a first signal acquired by an EEG electrode; the first signal is an electrical signal within a preset frequency range that is acquired and amplified by the EEG electrode;
[0010] a second signal division module configured to divide the first signal into frequency bands to obtain a plurality of groups of second signals; wherein the first signal segments in different groups of the plurality of second signals correspond to different frequency bands, and the first signal segments in the same group belong to the same frequency band interval;
[0011] The first classification result determination module is used to perform signal classification on the first signal according to the multiple groups of second signals to obtain a first classification result; the first classification result is used to characterize the value of a preset feature in the first signal.
[0012] According to another aspect of the present invention, an electronic device is provided, comprising:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the EEG signal detection method described in any embodiment of the present invention.
[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the EEG signal detection method according to any embodiment of the present invention when executed.
[0017] The technical solution of the embodiment of the present invention obtains a first signal collected by an EEG electrode; divides the first signal into frequency bands to obtain multiple groups of second signals, which can reduce the complexity of the calculation while more accurately capturing the signal change information; classifies the first signal according to the multiple groups of second signals to obtain a first classification result, which can improve the accuracy of the classification result. This method divides the first signal into frequency bands, which can determine the change details of each frequency band and provide a basis for determining the influence of each frequency band on the classification result of the first signal; classifies the first signal according to the multiple groups of second signals, which can improve the accuracy of the classification result of the first signal and obtain the influence of each frequency band on the classification result of the first signal.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A flowchart of an EEG signal detection method provided by an embodiment of the present invention;
[0021] Figure 2 A classification result diagram of a first model provided in an embodiment of the present invention;
[0022] Figure 3 A flowchart of another EEG signal detection method provided by an embodiment of the present invention;
[0023] Figure 4 A second signal contribution value distribution diagram provided by an embodiment of the present invention;
[0024] Figure 5 A schematic structural diagram of an electroencephalogram (EEG) signal detection device provided by an embodiment of the present invention;
[0025] Figure 6 A schematic diagram of the structure of an electronic device for implementing the EEG signal detection method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Figure 1This is a flowchart of an EEG signal detection method provided by an embodiment of the present invention. This embodiment is applicable to the case where detection is performed based on the content represented by the EEG signal. The method can be executed by an EEG signal detection device, which can be implemented in the form of hardware and / or software. The EEG signal detection device can be configured in any electronic device with network communication function. Figure 1 As shown, the method includes:
[0029] S110, obtaining a first signal collected by the EEG electrode; the first signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrode.
[0030] The EEG electrodes use a non-invasive method to record the electrical signals generated by the contact object in different states. Non-invasive methods refer to contacting the contact object without damaging the contact object.
[0031] The preset frequency range is used to represent the variation range of the electrical signal under a preset state. The preset frequency range is obtained by performing an experimental analysis on the contact object. The preset state may be that the contact object is in a sleeping state.
[0032] Furthermore, the experimental analysis can first classify the subject's sleep state into at least one of the following sleep stages: light sleep, deep sleep, or rapid eye movement sleep. Using EEG electrodes and physiological data acquisition devices, the subject's sleep behavior is monitored to obtain data representative of various sleep states, such as the subject's sleep onset time, total sleep duration, changes in movement during sleep, and muscle activity. Comprehensive analysis of the various state data obtained reveals the frequency ranges of the electrical signals corresponding to different sleep stages.
[0033] Furthermore, the comprehensive analysis is to determine the sleep state of the contact object based on the time the contact object falls asleep, the movement state during sleep and the muscle activity, and to correspond to the changes in the electrical signals under the sleep state according to the duration of sleep, so as to obtain the frequency change range of the electrical signals corresponding to different sleep stages.
[0034] When the EEG electrode collects the first signal, the authorized use permission of the contact object has been obtained.
[0035] Specifically, the EEG electrodes collect the electrical signals transmitted by the contact object, amplify the signals after collection, filter the amplified signals according to a preset frequency range, retain the signals within the preset frequency range, and obtain the first signal.
[0036] Furthermore, the signal is amplified by an amplifier, that is, the collected microvolt-level electrical signal is amplified to the millivolt level by a high-gain amplifier.
[0037] Exemplarily, six-channel electrical signals are collected through EEG electrodes (EEG electrode positions: F3, F4, FT7, FT8, T7, T8), the sampling rate is 200 Hz, the length of each signal segment is 10 seconds, and the signals do not overlap.
[0038] In the above steps, collecting electrical signals from 6 channels can obtain a first signal with a higher time resolution, and can also reflect the changes in electrical signals in different areas of the contact object to a certain extent, so that the collected first signal can represent the changes in the state of the contact object, thereby improving the accuracy of the first signal classification.
[0039] S120. Divide the first signal into frequency bands to obtain multiple groups of second signals; among the multiple groups of second signals, first signal segments in different groups correspond to different frequency bands, and first signal segments in the same group belong to the same frequency band interval.
[0040] Specifically, the first signal is divided into frequency bands according to preset frequency band information, and signals belonging to the same frequency band range are put into the same group to obtain multiple groups of second signals.
[0041] Among them, the preset frequency band information includes: Delta wave, frequency range is 0.5-4Hz; Theta wave, frequency range is 4-8Hz; Alpha wave, frequency range is 8-13Hz; Beta wave, frequency range is 13-30Hz; Gamma wave, frequency range is 30-100Hz.
[0042] In the above steps, the preset frequency band information is used to divide the first signal into frequency bands, which can ensure that when the first signal is subsequently classified, the first model can capture subtle signal change information, thereby improving the accuracy of the first signal classification.
[0043] S130. Classify the first signal according to the multiple groups of second signals to obtain a first classification result; the first classification result is used to represent the value of a preset feature in the first signal.
[0044] The preset feature is a value corresponding to a frequency band that affects the first classification result.
[0045] Furthermore, the first classification result is used to represent a score obtained by quantifying the features of the current state of the contact object represented by the first signal.
[0046] Specifically, multiple groups of second signals are input into the first model. The first model calculates the frequency band power spectrum density of each group of signals based on the multiple groups of second signals, extracts features of the frequency band power spectrum density, and classifies the first signal according to the acquired feature information to obtain a first classification result.
[0047] Furthermore, after obtaining the first classification result, the corresponding state stage is matched from the state correspondence according to the value of the first classification result, and the current state of the contact object is determined according to the obtained state stage.
[0048] Among them, the current state of the contact object is used to represent the strength of the contact object's ability to perceive changes caused by the objects or itself in the area where it is located at the first signal acquisition moment. Furthermore, the contact object state can be mainly divided into three stages: the first state stage, denoted as Class 0, represents that the contact object's ability to perceive changes caused by the objects or itself in the area where it is located is between the first intensity and the second intensity. Furthermore, the first state stage is also called neutral emotion; the second state stage, denoted as Class 1, represents that the contact object's ability to perceive changes caused by the objects or itself in the area where it is located is less than the first intensity. Furthermore, the second state stage is also called negative emotion; the third state stage, denoted as Class 2, represents that the contact object's ability to perceive changes caused by the objects or itself in the area where it is located exceeds the second intensity. Furthermore, the third state stage is also called positive emotion.
[0049] The first strength is lower than the second strength, and the first strength and the second strength are obtained through experimental testing.
[0050] Furthermore, when the contact object is in the first state stage, the contact object can process information and problems, but the processing efficiency is not high; when the contact object is in the second state stage, the contact object's ability to process information and problems will be inhibited; when the contact object is in the third state stage, the contact object has the ability to process information and problems efficiently.
[0051] Furthermore, the state correspondence is determined by quantizing the contact object state to obtain quantized value ranges corresponding to the three state stages, and matching the obtained value ranges with the corresponding state stages to obtain the state correspondence.
[0052] For example, assuming that the first classification result is 23; the first stage state quantization interval is [0, 9]; the second stage state quantization interval is [15, 25]; and the third stage state quantization interval is [30-41], then the current state of the contact object corresponding to the first classification result is the third state stage.
[0053] For example, the result diagram of the first model is as follows: Figure 2As shown in the figure, for the first-stage state 0, 422 first signals were correctly predicted, 64 were predicted as the second-stage state, and 63 were predicted as the third-stage state. For the second-stage state 1, 1044 first signals were correctly predicted, 23 were predicted as the first-stage state, and 67 were predicted as the third-stage state. For the third-stage state 2, 619 first signals were correctly predicted, 65 were predicted as the first-stage state, and 98 were predicted as the second-stage state. The figure also shows that the darker the diagonal line, the higher the prediction accuracy. This shows that the first model has a high accuracy rate for classifying first signals and can meet the classification requirements.
[0054] Furthermore, the frequency band power spectral density calculation process is as follows: the first model selects any one set of second signals from multiple sets of second signals and performs segmented processing on the selected second signal. The segmented processed signal is weighted using a window function and subjected to a Fourier transform to obtain multiple power spectrum information. The multiple power spectrum information obtained is averaged to obtain the frequency band power spectral density of the selected signal. The frequency band power spectral density of the remaining second signals in the multiple sets of second signals is calculated in the same manner to obtain the frequency band power spectral density of the multiple sets of second signals.
[0055] The first model consists of a frequency band power spectral density calculation model and a classification model. The frequency band power spectral density calculation model is used to calculate the frequency band power spectral density of the signal in each group of second signals and generate sample data based on the obtained frequency band power spectral density. The classification model classifies the first signals based on the sample data. The frequency band power spectral density calculation model can use the Welch method.
[0056] Furthermore, the classification model was selected by conducting functional comparison experiments with different classifiers. Specifically, the sixth signal was classified using the power spectral density of the frequency band using different classifiers, and the classification model was determined based on the accuracy of the obtained classification results. The classification accuracy of the different classification models is shown in Table 1.
[0057] Table 1 Accuracy of classification results of different classification models
[0058]
[0059] Furthermore, as shown in Table 1, Category 0 (first stage status): XGBoost model, random forest and Stacking performed well in recall (79%, 76% and 78% respectively), while KNN, decision tree, Bagging and Boosting performed poorly. Category 1 (second stage status): All models performed well in this category, especially the XGBoost model and random forest (F1 scores of 90% and 87% respectively). Category 2 (third stage status): XGBoost model and random forest performed better than other models in this category (F1 scores of 81% and 78% respectively). Model complexity and performance: XGBoost model and random forest: These two models are ensemble learning methods that can capture complex patterns in the data well. Considering the classification effects of the above models on the sixth signal, the XGBoost model is adopted as the classification model.
[0060] Furthermore, the classification model optimizes its hyperparameters through the Bayesian optimizer. That is, the search space and objective function of the Bayesian optimizer are first defined. A set of hyperparameter combinations are selected in the search space, the classification model is trained and the classification accuracy is evaluated through the hyperparameter combination, the evaluation results are fed back to the Bayesian optimizer, and the hyperparameter combination is updated. Until the number of iterations or the convergence condition is reached. Based on the obtained evaluation results, the Bayesian classifier selects a hyperparameter combination whose accuracy meets the objective function. Among them, the objective function is defined as a preset mean square error or a preset accuracy. The purpose of defining the objective function is to find the corresponding hyperparameter combination when the classification result error is minimized or the accuracy is maximized on the validation set.
[0061] Furthermore, the classification model can be optimized through grid search and cross-validation. Specifically, within a preset parameter grid, randomly generate hyperparameter combinations. Select any one of the generated hyperparameter combinations. Divide the sixth signal into a randomly divided training set and a validation set. Train the selected hyperparameter combination on the randomly divided training set and validate it on the validation set to obtain multiple groups of classification accuracy. The obtained multiple groups of classification accuracy are averaged to obtain an evaluation result for the selected hyperparameter combination. Select the hyperparameter combination with the highest accuracy from all hyperparameter combinations.
[0062] Furthermore, the first model is equipped with a key feature selection model. After obtaining the first classification result, it determines the actual state of the contact object, quantifies the actual state, and compares it with the first classification result to determine the current prediction accuracy. If the accuracy does not meet the preset requirements, the first model is modified based on the contribution of each second signal group and the proportion of the second signal groups analyzed according to the first classification result.
[0063] For example, Figure 3As shown, after acquiring a first signal, the first signal is first divided into frequency bands according to preset frequency band information to obtain multiple groups of second signals. The frequency band power spectral density of the multiple groups of second signals is calculated. Feature extraction is performed on the obtained frequency band power spectral density using a classification model, and the first signal is classified based on the feature information to obtain a first classification result. The contribution value of each frequency band in the first classification result is determined to obtain a contribution value distribution. The first model is modified based on the contribution value distribution, and the obtained contribution value distribution is displayed in the SHAP visualization module.
[0064] The SHAP (SHapley Additive exPlanations) module quantifies the contribution of each frequency band to the first model's predictions. By visualizing SHAP values, you can intuitively understand model behavior, identify important frequency bands, and discover underlying patterns in the first signal.
[0065] Optionally, obtaining a first signal collected by an EEG electrode includes steps A1-A2:
[0066] Step A1: Acquire a third signal collected by the EEG electrodes; the third signal is an electrical signal collected and amplified by the EEG electrodes.
[0067] Specifically, the electrical signal generated by the contact object is collected from the EEG electrodes, and the collected electrical signal is amplified to obtain the third signal.
[0068] Step A2: Select the third signal according to the preset frequency range to obtain the first signal.
[0069] The preset frequency range is used to represent the variation range of the electrical signal in a preset state. The preset state may be that the contact object is in a sleeping state.
[0070] Specifically, the third signal is screened according to a preset frequency range, and the third signal within the preset frequency range is used as the first signal.
[0071] Optionally, performing signal classification on the first signal according to the multiple groups of second signals to obtain a first classification result includes steps B1-B2:
[0072] Step B1: The first model determines frequency band power spectrum density according to the multiple groups of second signals; the power spectrum density is used to characterize the energy distribution of the multiple groups of second signals in the frequency domain.
[0073] Specifically, the first model selects any one of the multiple sets of second signals and performs segmented processing on the selected second signal. The segmented processed signal is weighted using a window function and subjected to a Fourier transform to obtain multiple power spectrum information. The multiple power spectrum information is averaged to obtain the frequency band power spectral density of the selected signal. The frequency band power spectral density of the remaining second signals in the multiple sets of second signals is calculated in the same manner to obtain the frequency band power spectral density of the multiple sets of second signals.
[0074] Step B2: The first model classifies the first signal according to the frequency band power spectrum density to obtain a first classification result.
[0075] Specifically, the first model extracts features from the frequency band power spectrum density, and classifies the first signal according to the acquired feature information to obtain a first classification result.
[0076] Optionally, the first model determines the frequency band power spectrum density according to multiple groups of second signals, including steps C1-C4:
[0077] Step C1: Select any one group of second signals from multiple groups of second signals, and perform segmented processing on the selected group of second signals to obtain multiple fourth signals.
[0078] Specifically, one group of second signals is selected from the multiple groups of second signals, and repeated frame segmentation processing is performed on the selected second signal according to a preset length to obtain multiple fourth signals.
[0079] Furthermore, the repeated frame segmentation process is segmentation according to a preset length, and the repetition rate between frames in each segment signal is within a preset repetition rate, wherein the preset repetition rate can be 50%-70%.
[0080] In the above steps, the frame segmentation process is repeated to solve the problem of spectrum leakage in the signal.
[0081] Step C2: weighting the plurality of fourth signals according to a window function to obtain a plurality of fifth signals; the window function is selected according to the frequency band length and frequency band leakage of the fourth signal; the frequency band leakage indicates that the fourth signal has signal diffusion outside the frequency band range.
[0082] The window function is used to ensure that the fourth signal smoothly transitions to 0 at both ends of the frame, so as to reduce spectrum leakage.
[0083] Specifically, weighted processing is performed on the plurality of fourth signals according to the window function, that is, the plurality of fourth signals are multiplied by the window function respectively to obtain a plurality of fifth signals.
[0084] Furthermore, the fifth signal can be expressed by the following formula:
[0085] xi(n)=x(n+iD)w(n);
[0086] Wherein, xi(n) is the i-th fourth signal; D is the frame shift; and w(n) is the window function.
[0087] Step C3: Perform Fourier transform on the multiple fifth signals to obtain multiple power spectrum information.
[0088] Specifically, discrete Fourier transform is performed on the multiple fifth signals respectively to obtain frequency domain signals of the multiple fifth signals in the frequency domain, and power spectrum estimation is performed based on the frequency domain signals to obtain multiple power spectrum information.
[0089] Step C4: determining the frequency band power spectrum density according to the multiple power spectrum information.
[0090] The frequency band power spectrum density is used to express the power distribution of the second signal at different frequencies.
[0091] Specifically, multiple power spectrum information is averaged to obtain the frequency band power spectrum density.
[0092] Furthermore, the power spectrum density of the frequency band can be expressed by the following formula:
[0093] P(fk)=|X(k)| 2 / N;
[0094] Where fk is the frequency corresponding to the kth frequency point, and N is the total number of frequency points.
[0095] Furthermore, the power spectrum densities of the frequency bands corresponding to all the second signals are used to generate sample data, and the first model classifies the first signals according to the sample data.
[0096] For example, assuming that there are 5 groups of second signals, the sample data includes 30-dimensional frequency band power spectrum density and 6-channel second signal means.
[0097] Optionally, at least one construction method of the first model includes steps D1-D5:
[0098] Step D1, determine the sixth signal and the second classification result; the sixth signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrode at a historical moment; the second classification result is used to characterize the value of the preset feature in the sixth signal.
[0099] Specifically, historical signals collected by the EEG electrodes at historical moments are obtained, and the historical signals are filtered according to a preset frequency range to obtain a sixth signal. A second classification result corresponding to the sixth signal is obtained from a storage device.
[0100] The storage device is used to store the sixth signal, the second classification result and the stage state corresponding to the sixth signal. The storage device and the EEG electrodes are configured in the same acquisition device.
[0101] Step D2: divide the sixth signal into frequency bands to obtain multiple groups of seventh signals.
[0102] Specifically, the sixth signal is divided into frequency bands according to the frequency ranges of different electrical signals in the sixth signal to obtain multiple groups of seventh signals.
[0103] Step D3: Input the multiple groups of seventh signals into the second model to perform signal classification on the sixth signal to obtain a third classification result.
[0104] Among them, the second model consists of a frequency band power spectrum density calculation model and a classification model.
[0105] The frequency band power spectrum density calculation model is used to calculate the frequency band power spectrum density of the signal in each group of sixth signals, and generate sample data based on the obtained frequency band power spectrum density. The classification model classifies the first signal according to the sample data.
[0106] Exemplarily, the frequency band power spectrum density calculation model may adopt the Welch method; the classification model may adopt the XGBoost model.
[0107] Specifically, multiple groups of seventh signals are input into the second model, the frequency band power spectrum density is first calculated through the frequency band power spectrum density calculation model, and the obtained frequency band power spectrum density is used to generate sample data, and then the classification model is used to classify the sixth signal according to the sample data to obtain the third classification result.
[0108] Step D4: Determine the first data according to the third classification result and the second classification result.
[0109] Specifically, an error evaluation is performed on the third classification result and the second classification result to obtain the first data.
[0110] Step D5: Modify the second model according to the first data to obtain the first model.
[0111] Specifically, the model structure and model parameters of the second model are modified according to the first data to obtain the first model.
[0112] Exemplarily, the training process of the first model is as follows: the sixth signal is divided into a validation set and a training set, wherein the validation set accounts for 20%, totaling 2,465 samples; and the training set accounts for 80%, totaling 9,860 samples. The first signal is classified using the second model under multiple sets of hyperparameters based on the training set and the validation set, respectively, to obtain a third classification result corresponding to each set of hyperparameters. An error result is determined based on the third classification result and the second classification result. If the error result does not meet a preset error, the error result is used as the first data, and the first model is corrected using the first data.
[0113] Optionally, after classifying the first signal according to the multiple groups of second signals to obtain a first classification result, steps E1 to E5 are further included:
[0114] Step E1: Combine multiple groups of second signals according to a preset combination method to obtain multiple groups of eighth signal combinations.
[0115] Specifically, multiple groups of second signals are combined according to the combination method to obtain multiple groups of eighth signal combinations.
[0116] Furthermore, the preset combination method is: starting from an empty set, gradually adding second signals until all second signals are included.
[0117] For example, assuming that multiple groups of second signals are classified as: x1, x2, x3, x4 and x5, then the preset combination method is: (empty set), {x1}, {x2}, {x3}, {x1,x2},…, {x4,x5},…, {x1, x2, x3, x4, x5}.
[0118] Step E2: Determine multiple fourth classification results based on multiple groups of eighth signal combinations.
[0119] Specifically, the obtained multiple groups of eighth signal combinations are respectively input into the first model to perform first signal classification, and multiple fourth classification results are obtained.
[0120] Further, after obtaining a plurality of fourth classification results, each fourth classification result is matched with its corresponding eighth signal combination.
[0121] Step E3: Select any second signal from the multiple groups of second signals, and determine a fifth classification result and a sixth classification result based on the selected second signal and the multiple fourth classification results.
[0122] The fifth classification result is the classification result corresponding to the eighth signal combination including the selected second signal, and the sixth classification result is the classification result corresponding to the eighth signal combination not including the selected second signal.
[0123] Specifically, a group of second signals is selected from any one of the multiple groups of second signals, and the eighth signal combination containing the selected second signal is matched from the multiple groups of eighth signal combinations based on the selected second signal. The corresponding classification result is matched from the multiple fourth classification results based on the matched eighth signal combination as the fifth classification result, and the remaining classification results are used as the sixth classification result.
[0124] Step E4: Determine the second data according to the fifth classification result and the sixth classification result.
[0125] Specifically, the obtained fifth and sixth classification results are used to determine the boundary contribution value of the selected second signal, and the boundary contribution values are weighted and summed to obtain the contribution value corresponding to the selected signal. The second data is determined based on the contribution values corresponding to all second signals.
[0126] Furthermore, the contribution value is determined by obtaining the eighth signal combination corresponding to the sixth classification result to obtain multiple ninth signal combinations. A ninth signal combination is selected from the obtained multiple ninth signal combinations, and a boundary contribution value of the selected second signal under the ninth signal combination is calculated. The contribution value is determined based on the boundary contribution value of the selected second signal.
[0127] Among them, the contribution value represents the degree of influence of the second signal on the classification result and the interaction relationship between different groups of second signals, that is, the larger the absolute value of the contribution value, the greater the influence of the second signal on the classification result; if the contribution value is positive, the second signal tends to increase the classification result of the first model; a negative SHAP value indicates that the second signal tends to reduce the classification result of the first model.
[0128] Step E5: Modify the first model according to the second data.
[0129] Specifically, the model parameters of the first model are adjusted according to the second data; and the first model is modified according to the interaction relationship between different groups of second signals represented in the second data, such as adding an interaction term.
[0130] Furthermore, adjusting the model parameters of the first model according to the second data includes: if the contribution value of a group of second signals in the second data is positive and the corresponding model coefficient is small, the model parameters need to be increased.
[0131] For example, Figure 4As shown in the figure, Delta_Power_F3 and Theta_Power_F3 both contribute significantly to the classification results for different categories. Therefore, the model parameters corresponding to this information need to be increased. Gamma_Power_T8 has different directional effects on different categories. For example, it contributes oppositely to neutral emotion (Class 0) and the first stage state (Class 2). Therefore, no model parameter adjustment is required, but rather the interaction terms with other signals need to be added.
[0132] Among them, Delta_Power_F3 is the frequency band signal of the delta frequency band collected by the F3 EEG electrode; Theta_Power_F3 is the frequency band signal of the theta frequency band collected by the F3 EEG electrode; Gamma_Power_T8 is the frequency band signal of the gamma frequency band collected by the T8 EEG electrode.
[0133] Optionally, determining the second data according to the fifth classification result and the sixth classification result includes steps F1-F2:
[0134] Step F1: Determine a contribution value based on the fifth classification result and the sixth classification result; the contribution value is used to represent the degree of influence of the eliminated second signal on the classification result.
[0135] Specifically, the eighth signal combination corresponding to the sixth classification result is obtained to obtain multiple ninth signal combinations. Any one of the obtained ninth signal combinations is selected as the tenth signal combination, and the eleventh signal combination is determined based on the tenth signal combination. The boundary contribution value of the selected second signal is determined based on the sixth classification result corresponding to the tenth signal combination and the fifth classification result corresponding to the eleventh signal combination. The contribution value is obtained by performing a weighted summation on all boundary contribution values of the selected second signal.
[0136] Furthermore, the contribution value can be expressed as:
[0137]
[0138] in, is the contribution value of the second signal xi, N is the total number of combinations of multiple groups of eighth signal combinations, S is a plurality of ninth signal combinations that do not contain feature xi, |S| is the size of the signal combination S, and n is the total number of multiple groups of second signals.
[0139] The eleventh signal combination is a signal combination obtained by adding the selected second signal to the tenth signal combination.
[0140] Exemplarily, assuming that the second signal is x2, the tenth signal combination is {x1, x3, x4}, and the eleventh signal combination is {x1, x2, x3, x4}.
[0141] Furthermore, assuming that the second signal is x2, the tenth signal combination is {x1, x3, x4}, denoted as S, and the eleventh signal combination is {x1, x2, x3, x4}, denoted as S∪{x2}. Then, the boundary contribution of the second signal under the tenth signal combination is: f(S∪{x2})-f(S), where f(S) is the sixth classification result corresponding to the tenth signal combination, and f(S∪{x2}) is the fifth classification result corresponding to the eleventh signal combination.
[0142] Step F2: Generate second data according to the contribution value.
[0143] Specifically, the second data is generated according to the contribution values corresponding to the second signals in different frequency bands.
[0144] The technical solution of this embodiment obtains a first signal collected by an EEG electrode; divides the first signal into frequency bands to obtain multiple groups of second signals, which can reduce the complexity of the calculation while more accurately capturing the signal change information; classifies the first signal according to the multiple groups of second signals to obtain a first classification result, which can improve the accuracy of the classification result. This method divides the first signal into frequency bands, which can determine the change details of each frequency band and provide a basis for determining the influence of each frequency band on the classification result of the first signal; classifies the first signal according to the multiple groups of second signals, which can improve the accuracy of the classification result of the first signal and obtain the influence of each frequency band on the classification result of the first signal.
[0145] Figure 5 This is a schematic diagram of the structure of an EEG signal detection device provided by an embodiment of the present invention. This embodiment is applicable to the case where detection is performed based on the content represented by the EEG signal. The EEG signal detection device can be implemented in the form of hardware and / or software, and can be configured in any electronic device with network communication function. Figure 5 As shown, the device includes: a first signal acquisition module 210, a second signal division module 220 and a first classification result determination module 230, wherein:
[0146] First signal acquisition module 210: used to acquire a first signal collected by the EEG electrodes; the first signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrodes;
[0147] The second signal division module 220 is configured to divide the first signal into frequency bands to obtain multiple groups of second signals; the first signal segments in different groups of the multiple groups of second signals correspond to different frequency bands, and the first signal segments in the same group belong to the same frequency band interval;
[0148] The first classification result determination module 230 is configured to perform signal classification on the first signal according to the plurality of groups of second signals to obtain a first classification result; the first classification result is used to characterize the value of a preset feature in the first signal.
[0149] Optionally, the first signal acquisition module 210 includes:
[0150] A third signal determination unit is used to obtain a third signal collected by the EEG electrodes; the third signal is an electrical signal collected and amplified by the EEG electrodes;
[0151] The first signal determining unit is configured to select the third signal according to a preset frequency range to obtain the first signal.
[0152] Optionally, the first classification result determination module 230 includes:
[0153] A frequency band power spectrum density determination unit is used to determine the frequency band power spectrum density according to the multiple groups of second signals using the first model; the power spectrum density is used to characterize the energy distribution of the multiple groups of second signals in the frequency domain;
[0154] The first classification result determining unit is used to perform signal classification on the first signal according to the frequency band power spectrum density using the first model to obtain a first classification result.
[0155] Optionally, the frequency band power spectrum density determination unit includes:
[0156] A fourth signal determination subunit is configured to select any one group of second signals from the plurality of groups of second signals, and perform segmented processing on the selected group of second signals to obtain a plurality of fourth signals;
[0157] a fifth signal determination subunit configured to weight the plurality of fourth signals according to a window function to obtain a plurality of fifth signals; the window function is selected based on a frequency band length and frequency band leakage of the fourth signal; the frequency band leakage indicates signal diffusion in a portion of the fourth signal outside the frequency band;
[0158] A power spectrum information determination subunit is configured to perform Fourier transformation on the plurality of fifth signals to obtain a plurality of power spectrum information;
[0159] The frequency band power spectrum density determination subunit is used to determine the frequency band power spectrum density according to multiple power spectrum information.
[0160] Optionally, the frequency band power spectrum density determination unit includes:
[0161] A sixth signal determination subunit is configured to determine a sixth signal and a second classification result; the sixth signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrodes at a historical moment; the second classification result is used to characterize the value of a preset feature within the sixth signal; and the sixth signal is divided into frequency bands to obtain multiple groups of seventh signals.
[0162] A third classification result determination subunit is configured to input the plurality of groups of seventh signals into the second model to perform signal classification on the sixth signal to obtain a third classification result;
[0163] A first data determination subunit: configured to determine first data according to the third classification result and the second classification result;
[0164] The first model determination subunit is used to modify the second model according to the first data to obtain the first model.
[0165] Optionally, the EEG signal detection device further includes:
[0166] an eighth signal combination determining unit, configured to combine the plurality of second signal groups according to a preset combination method to obtain a plurality of eighth signal combinations;
[0167] a plurality of fourth classification result determining units, configured to determine a plurality of fourth classification results according to a plurality of eighth signal combinations;
[0168] a fifth classification result determining unit configured to select any second signal from the plurality of groups of second signals, and determine a fifth classification result and a sixth classification result based on the selected second signal and the plurality of fourth classification results;
[0169] A second data determining unit: configured to determine second data according to the fifth classification result and the sixth classification result;
[0170] Correction unit: used for correcting the first model according to the second data.
[0171] Optionally, the second data determination unit is specifically configured to:
[0172] Performing a weighted summation on the fifth classification set to obtain a contribution value; the contribution value is used to represent the degree of influence of the eliminated second signal on the classification result;
[0173] Second data is generated according to the contribution value.
[0174] The EEG signal detection device provided in the embodiment of the present invention can execute the EEG signal detection method provided in any embodiment of the present invention mentioned above, and has the corresponding functions and beneficial effects of executing the EEG signal detection method. For detailed process, please refer to the relevant operations of the EEG signal detection method in the aforementioned embodiment.
[0175] Figure 6Schematic diagram of the structure of an electronic device for implementing the EEG signal detection method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0176] like Figure 6 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0177] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0178] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the EEG signal detection method.
[0179] In some embodiments, the EEG signal detection method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the EEG signal detection method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the EEG signal detection method in any other appropriate manner (for example, by means of firmware).
[0180] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0181] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0182] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0183] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0184] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0185] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0186] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0187] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for detecting an electroencephalogram signal, characterized in that: include: Acquiring a first signal collected by an EEG electrode; The first signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrode; Performing frequency band division on the first signal to obtain multiple groups of second signals; wherein the first signal segments in different groups of the multiple groups of second signals correspond to different frequency bands, and the first signal segments in the same group belong to the same frequency band interval; performing signal classification on the first signal according to the plurality of groups of second signals to obtain a first classification result; The first classification result is used to characterize the value of a preset feature in the first signal.
2. The method according to claim 1, characterized in that The step of obtaining a first signal collected by an EEG electrode includes: Acquiring a third signal collected by the EEG electrode; the third signal is an electrical signal collected and amplified by the EEG electrode; Signal selection is performed on the third signal according to a preset frequency range to obtain a first signal.
3. The method according to claim 1, characterized in that The performing signal classification on the first signal according to the multiple groups of second signals to obtain a first classification result includes: The first model determines a frequency band power spectrum density based on the multiple groups of second signals; the power spectrum density is used to characterize the energy distribution of the multiple groups of second signals in the frequency domain; The first model performs signal classification on the first signal according to the frequency band power spectrum density to obtain a first classification result.
4. The method according to claim 3, characterized in that The first model determines the frequency band power spectrum density according to the plurality of groups of second signals, including: Selecting any one group of second signals from the plurality of groups of second signals, and performing segmented processing on the selected group of second signals to obtain a plurality of fourth signals; The plurality of fourth signals are weighted according to a window function to obtain a plurality of fifth signals; the window function is selected according to a frequency band length and a frequency band leakage condition of the fourth signal; the frequency band leakage condition represents a signal diffusion condition occurring in a portion of the fourth signal outside the frequency band range; Performing Fourier transform on the multiple fifth signals to obtain multiple power spectrum information; A frequency band power spectrum density is determined according to the multiple power spectrum information.
5. The method according to claim 3, characterized in that At least one construction method of the first model includes: Determining a sixth signal and a second classification result; the sixth signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrode at a historical moment; the second classification result is used to characterize the value of a preset feature in the sixth signal; dividing the sixth signal into frequency bands to obtain multiple groups of seventh signals; inputting the plurality of groups of seventh signals into a second model to perform signal classification on the sixth signal to obtain a third classification result; determining first data according to the third classification result and the second classification result; The second model is modified according to the first data to obtain a first model.
6. The method according to claim 1, characterized in that After classifying the first signal according to the plurality of groups of second signals to obtain a first classification result, the method further includes: Combining the plurality of second signal groups according to a preset combination method to obtain a plurality of eighth signal combinations; determining a plurality of fourth classification results according to the plurality of eighth signal combinations; Selecting any second signal from the plurality of groups of second signals, and determining a fifth classification result and a sixth classification result based on the selected second signal and the plurality of fourth classification results; determining second data according to the fifth classification result and the sixth classification result; The first model is modified according to the second data.
7. The method according to claim 6, characterized in that The determining of the second data according to the fifth classification result and the sixth classification result includes: Determining a contribution value based on the fifth classification result and the sixth classification result; wherein the contribution value is used to represent the degree of influence of the eliminated second signal on the classification result; Second data is generated according to the contribution value.
8. An electroencephalogram signal detection device, characterized in that: include: A first signal acquisition module, configured to acquire a first signal collected by an EEG electrode; The first signal is an electrical signal within a preset frequency range that is collected and amplified by the EEG electrode; a second signal division module configured to divide the first signal into frequency bands to obtain a plurality of groups of second signals; wherein the first signal segments in different groups of the plurality of second signals correspond to different frequency bands, and the first signal segments in the same group belong to the same frequency band interval; A first classification result determination module, configured to perform signal classification on the first signal according to the plurality of groups of second signals to obtain a first classification result; The first classification result is used to characterize the value of a preset feature in the first signal.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the EEG signal detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the EEG signal detection method according to any one of claims 1 to 7 when executed.