Emotion recognition method and system based on brain waves and electronic equipment

By constructing a mapping relationship between the training and testing domains of the EEG emotion recognition system, and applying principal component analysis and subspace alignment transformation matrix, adaptive online emotion recognition was achieved, solving the problem of cross-individual and temporal distribution offset, and improving recognition accuracy and robustness.

CN121370167APending Publication Date: 2026-01-23SHENZHEN LONGGANG DISTRICT OTOLARYNGOLOGY HOSPITAL (SHENZHEN OTOLARYNGOLOGY RES INST SHENZHEN LONGGANG DISTRICT ORAL MEDICINE RES INST)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511509862.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-22
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

Existing EEG emotion recognition systems are ill-suited to the real-world online monitoring needs characterized by streaming data, scarce annotations, and limited computing resources. In particular, in real-time applications such as mental health intervention, driver fatigue warning, and human-machine collaboration, cross-individual/cross-time distribution shifts lead to insufficient model generalization capabilities.

Method used

By acquiring labeled training domains and unlabeled test domains, a mapping relationship is constructed. Principal component analysis is applied to construct source and target domain subspaces. Based on the subspace alignment transformation matrix, source domain features are mapped to the target domain, thus constructing an adaptive subspace feature matching emotion recognition model to achieve online emotion recognition.

Benefits of technology

It effectively solves the problem of insufficient model generalization ability caused by individual differences and non-stationarity of EEG signals, improves the accuracy and robustness of emotion recognition across individuals and time scenarios, and meets the real-time requirements of online applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121370167A_ABST
    Figure CN121370167A_ABST
Patent Text Reader

Abstract

The invention provides an emotion recognition method and system based on brain waves and electronic equipment. The method comprises the following steps: acquiring brain wave data to be analyzed; taking the brain wave data with the label as a training domain, and taking the brain wave data without the label as a test domain; constructing a mapping relationship between the training domain and the test domain; constructing a source domain subspace and a target domain subspace by applying principal component analysis; constructing a subspace alignment transformation matrix according to the source domain subspace and the target domain subspace to map source domain features to the target domain subspace so as to align the edge distribution of the source domain subspace and the edge distribution of the target domain subspace; constructing an emotion recognition model based on adaptive subspace feature matching; and carrying out online emotion recognition on the brain wave data according to the emotion recognition model, reducing the distribution difference between a source domain and a target domain through a subspace alignment technology, and improving the emotion recognition accuracy and robustness in cross-individual and cross-time scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of emotion recognition technology, and in particular to an emotion recognition method, system and electronic device based on brainwaves. Background Technology

[0002] Emotion, as a core component of higher-level human cognition and psychological activities, profoundly influences not only an individual's decision-making, social interactions, learning, and behavioral performance, but is also closely related to various mental and neurological disorders. Therefore, achieving objective, real-time, and accurate identification of emotional states has become an important research direction in psychology, neuroscience, human-computer interaction, and intelligent healthcare. Among numerous physiological signals, electroencephalograms (EEGs) are widely regarded as ideal biomarkers for emotion recognition due to their high temporal resolution, non-invasiveness, and direct response to emotion-related neural activity in the brain. In recent years, EEG emotion recognition methods based on machine learning and deep learning have made significant progress, with some models achieving high classification accuracy in controlled laboratory environments.

[0003] However, most existing EEG emotion recognition systems employ offline batch processing, relying on large amounts of labeled data for model training. This makes them ill-suited to the real-world online monitoring demands characterized by streaming data, scarce annotations, and limited computing resources. Especially in real-time applications such as mental health intervention, driver fatigue warning, and human-machine collaboration, there is an urgent need for an online emotion recognition mechanism that can effectively handle cross-individual / cross-time distribution shifts while possessing low latency and adaptive update capabilities. Summary of the Invention

[0004] In view of this, it is necessary to provide a brainwave-based emotion recognition method, system, and electronic device that can overcome at least one of the above-mentioned shortcomings.

[0005] In a first aspect, embodiments of this application provide an emotion recognition method based on brainwaves, the method comprising: acquiring brainwave data to be analyzed; The labeled EEG data is used as the training domain, and the unlabeled EEG data is used as the test domain. Construct a mapping relationship between the training domain and the test domain; Principal component analysis was used to construct the source domain subspace and the target domain subspace; A subspace alignment transformation matrix is ​​constructed based on the source subspace and the target subspace to map the source subspace features to the target subspace, thereby aligning the edge distributions of the source subspace and the target subspace. Construct an emotion recognition model based on adaptive subspace feature matching; Online emotion recognition is performed on EEG data based on the emotion recognition model.

[0006] In one embodiment, constructing an emotion recognition model based on adaptive subspace feature matching includes: An initial emotion recognition model is constructed based on the mapping relationship between the source domain features and the target domain subspace; The initial emotion recognition model is used to generate pseudo-labels for the EEG data in the training domain, and pseudo-label samples with high confidence are selected according to the confidence strategy. Correct the pseudo-labeled samples with high confidence; The emotion recognition model is trained iteratively by jointly training the corrected pseudo-labeled samples and source domain samples.

[0007] In one embodiment, the method further includes: The EEG data to be analyzed is divided into multiple EEG time segment samples according to a preset time window; Features are extracted from each of the aforementioned EEG time segment samples to form a sample feature vector; The sample feature vectors are represented in the source domain subspace and the target domain subspace respectively, and the subspace basis is obtained by principal component analysis.

[0008] In one embodiment, feature extraction for each of the EEG time segment samples includes: Calculate the differential entropy of the EEG time segment sample in the five sub-bands δ, θ, α, β, and γ; For each of the C acquisition channels, the differential entropy of five sub-bands is calculated for each channel, which together form a 5×C dimensional feature vector.

[0009] In one embodiment, constructing the emotion recognition model based on adaptive subspace feature matching further includes: Two sets of EEG time series samples are selected from the EEG data to be analyzed, one set for training domain acquisition and the other set for test domain acquisition. The expression for the training domain is:

[0010] in, For the training domain, For the EEG sample data of the nth time segment in the training domain, To determine the shape of the training data matrix X, Where n is the number of channels and n is the number of time segments; the label corresponding to the training domain X is Y is the vector of labels for all samples in the training domain. For the nth sample Emotion category tags; The test domain is obtained by performing sample segmentation feature calculation processing on multiple frequency bands of EEG using a preset differential entropy method; In the training domain and the test domain, each EEG sample is converted into a 5×C-dimensional feature vector to represent the energy distribution characteristics of different frequency bands.

[0011] In one embodiment, the method further includes: The two sets of EEG time series samples are divided into a training phase and a testing phase according to application requirements; The training phase is based on a set of labeled EEG samples. A classification decision function is learned. ,in The feature set of the training set samples already labeled. The set of emotion labels corresponding to the training set. For classification decision functions; The testing phase applies the knowledge gained during the training phase to predict the unlabeled sample set in order to obtain the output prediction value of the classification model. ,in For an unlabeled sample set, For the sentiment labels of the test set, This will output the predicted value.

[0012] In one embodiment, the application of principal component analysis to construct the source domain subspace and the target domain subspace includes: Principal component analysis is used to reduce the dimensionality of the feature matrices of the training domain and the test domain respectively; let the original feature matrix be... Principal component analysis is used to obtain the eigenvectors corresponding to the k largest eigenvalues, which form the basis matrix of the subspace. And define the projection relationship as ; The covariance matrices before and after projection satisfy the following relationship:

[0013] in, Original feature matrix The covariance matrix is ​​used to characterize the correlation between features of different channels; Indicates the number of samples; Represents the transpose of the original characteristic matrix X; Representing the projected features The covariance matrix represents the characteristic distribution relationship of the samples in the subspace; It is the projected feature matrix transpose; It is a subspace basis matrix The transpose of .

[0014] In one embodiment, the correction of the pseudo-labeled samples with high confidence includes: The original source domain sample features are weighted and fused with the sample features after conditional distribution correction; The magnitude of the correction is controlled by adjusting the balance factor, wherein the value of the balance factor is between 0 and 1. When the balance factor is 0, the original features are completely preserved; when the balance factor is 1, the corrected features are completely adopted.

[0015] Secondly, embodiments of this application provide an emotion recognition system based on brainwaves, applied to implement the emotion recognition method based on brainwaves as described in the first aspect, the system comprising: The data acquisition module is used to acquire the EEG data to be analyzed. The data processing module is used to use the labeled EEG data as a training domain and the unlabeled EEG data as a test domain. The data mapping module is used to construct the mapping relationship between the training domain and the test domain; apply principal component analysis to construct the source domain subspace and the target domain subspace; construct a subspace alignment transformation matrix based on the source domain subspace and the target domain subspace to map the source domain features to the target domain subspace, so as to align the edge distribution of the source domain subspace and the target domain subspace. The model building module is used to build an emotion recognition model based on adaptive subspace feature matching. The result output module is used to perform online emotion recognition on EEG data based on the emotion recognition model.

[0016] Thirdly, embodiments of this application provide an electronic device, including: Processor; and A memory having computer-readable instructions stored thereon for controlling the processor to perform the brainwave-based emotion recognition method as described in the first aspect.

[0017] This application provides a method, system, and electronic device for emotion recognition based on electroencephalograms (EEGs). It acquires EEG data to be analyzed and divides it into a labeled training domain and an unlabeled test domain, establishing a mapping relationship between the two. Principal component analysis is applied to construct source and target domain subspaces, and a subspace alignment transformation matrix is ​​used to map source domain features to the target domain subspace, achieving edge distribution alignment. An adaptive subspace feature matching emotion recognition model is then constructed, ultimately achieving online emotion recognition. This method effectively solves the problem of insufficient model generalization ability caused by individual variability and non-stationarity in EEG signals. By reducing the distribution difference between the source and target domains through subspace alignment technology, it improves the accuracy and robustness of emotion recognition across individuals and time scenarios, while meeting the real-time requirements of online applications. This provides a reliable technical means for monitoring emotional states and assisting in the diagnosis of mental health based on physiological signals. Attached Figure Description

[0018] Figure 1 This is a schematic flowchart of an emotion recognition method based on brainwaves provided in an embodiment of this application.

[0019] Figure 2 This is a schematic diagram illustrating the effect of conditional distribution adaptation and class statistical alignment provided in an embodiment of this application.

[0020] Figure 3 This is a schematic diagram of an emotion recognition system module based on electroencephalograms provided in an embodiment of this application.

[0021] Figure 4 A schematic diagram of an electronic device provided in an embodiment of this application.

[0022] Explanation of main component symbols Emotion recognition system based on brain waves 10 Data Acquisition Module 11 Data processing module 12 Data mapping module 13 Model building module 14 Result Output Module 15 Electronic devices 20 Processor 21 Memory 22 Method steps S100-700 Detailed Implementation

[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them.

[0024] It should be noted that, in the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the specification of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application.

[0025] It should be noted that in the embodiments of this application, the terms "first," "second," etc., are used only for descriptive purposes and should not be construed as indicating or implying relative importance, nor as indicating or implying order. Features specified as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0026] Based on the embodiments described in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0027] Emotion, as a core component of higher-level human cognition and psychological activities, profoundly influences not only an individual's decision-making, social interactions, learning, and behavioral performance, but is also closely related to various mental and neurological disorders. Therefore, achieving objective, real-time, and accurate identification of emotional states has become an important research direction in psychology, neuroscience, human-computer interaction, and intelligent healthcare. Among numerous physiological signals, electroencephalograms (EEGs) are widely regarded as ideal biomarkers for emotion recognition due to their high temporal resolution, non-invasiveness, and direct response to emotion-related neural activity in the brain. In recent years, EEG emotion recognition methods based on machine learning and deep learning have made significant progress, with some models achieving high classification accuracy in controlled laboratory environments.

[0028] However, most existing EEG emotion recognition systems employ offline batch processing, relying on large amounts of labeled data for model training. This makes them ill-suited to the real-world online monitoring demands characterized by streaming data, scarce annotations, and limited computing resources. Especially in real-time applications such as mental health intervention, driver fatigue warning, and human-machine collaboration, there is an urgent need for an online emotion recognition mechanism that can effectively handle cross-individual / cross-time distribution shifts while possessing low latency and adaptive update capabilities.

[0029] This application provides a method, system, and electronic device for emotion recognition based on electroencephalograms (EEGs). It acquires EEG data to be analyzed and divides it into a labeled training domain and an unlabeled test domain, establishing a mapping relationship between the two. Principal component analysis is applied to construct source and target domain subspaces, and a subspace alignment transformation matrix is ​​used to map source domain features to the target domain subspace, achieving edge distribution alignment. An adaptive subspace feature matching emotion recognition model is then constructed, ultimately achieving online emotion recognition. This method effectively solves the problem of insufficient model generalization ability caused by individual variability and non-stationarity in EEG signals. By reducing the distribution difference between the source and target domains through subspace alignment technology, it improves the accuracy and robustness of emotion recognition across individuals and time scenarios, while meeting the real-time requirements of online applications. This provides a reliable technical means for monitoring emotional states and assisting in the diagnosis of mental health based on physiological signals.

[0030] Figure 1 This is a flowchart illustrating an embodiment of an emotion recognition method based on electroencephalograms provided in this application, as shown below. Figure 1 The emotion recognition method based on EEG shown includes at least the following steps: S100: acquiring EEG data to be analyzed; S200: using labeled EEG data as the training domain and unlabeled EEG data as the test domain; S300: constructing a mapping relationship between the training domain and the test domain; S400: applying principal component analysis to construct source domain subspaces and target domain subspaces; S500: constructing a subspace alignment transformation matrix based on the source domain subspace and the target domain subspace, mapping source domain features to the target domain subspace to align the edge distributions of the source domain subspace and the target domain subspace; S600: constructing an emotion recognition model based on adaptive subspace feature matching; S700: performing online emotion recognition on the EEG data based on the emotion recognition model.

[0031] S100: Acquire the EEG data to be analyzed.

[0032] In this embodiment of the application, the emotion recognition method based on brainwaves includes, in step S100, acquiring brainwave data to be analyzed.

[0033] Specifically, the acquisition steps include: wearing a headband or patch-type EEG acquisition device on the head or corresponding location of the subject, acquiring EEG signals using a multi-channel electrode array, setting the sampling rate to a range suitable for emotion recognition (e.g., selectable values ​​such as 128Hz, 250Hz, 512Hz, or 1024Hz), and converting analog signals into digital signals through pre-amplification, bandpass filtering, and analog-to-digital converter; simultaneously recording necessary metadata during the acquisition process, including sensor layout (channel identification), sampling timestamps, subject information, and experimental / acquisition scene information; the acquired data can be transmitted to the processing unit in real time or temporarily stored in local memory for subsequent offline processing.

[0034] It is understood that the acquired EEG data is in the form of a multi-channel time series, containing the original time-domain and time-frequency domain information required for constructing features and training models. Furthermore, the data quality (such as electrode contact impedance and motion artifact level) directly affects the subsequent recognition accuracy. Therefore, preliminary quality detection and prompts can be implemented simultaneously during the acquisition process to ensure the effectiveness of the acquisition.

[0035] S200: Labeled EEG data is used as the training domain, and unlabeled EEG data is used as the test domain.

[0036] In this embodiment of the application, the emotion recognition method based on brainwaves includes step S200, which uses labeled brainwave data as a training domain and unlabeled brainwave data as a test domain.

[0037] Specifically, in this embodiment, labeled EEG data typically originates from laboratory settings or annotation processes: in designed emotion-inducing experiments or self-report questionnaire scenarios, emotion labels (e.g., pleasant, calm, anxious, angry, etc.) corresponding to each time segment are recorded; while unlabeled EEG data can come from on-site collection, new subjects, or target scenarios requiring online identification; the former is uniformly used as the training domain to learn classification rules, and the latter is used as the test domain to verify or apply the learned model; when dividing the data, groups can be formed based on subjects, conversations, or devices to construct cross-subject or cross-conversation training / test domain distribution differences.

[0038] It is understandable that the training and testing domains may have different statistical distributions due to individual differences, device differences, or environmental interference. This step of partitioning provides a basis for subsequent domain adaptation and subspace alignment, and supports the evaluation of the model's generalization ability.

[0039] S300: Construct the mapping relationship between the training domain and the test domain.

[0040] In this embodiment of the application, the emotion recognition method based on brainwaves includes, in step S300, constructing a mapping relationship between the training domain and the test domain.

[0041] Specifically, this step constructs a mapping relationship between the two domains through unified feature representation and normalization: First, the original or preprocessed features of the training and test domains are uniformly normalized (e.g., standardized by channel zero mean and unit variance or scaled by interval); then, a linear or nonlinear mapping function (e.g., based on subspace projection, kernel mapping, or neural network mapping) is used to establish a representation transformation from the training domain to the test domain, so that the source domain samples can be mapped to a representation comparable to the target domain samples in subsequent steps; the learning of the mapping can be iteratively optimized based on a small number of paired samples, statistical alignment, or unsupervised target domain information (such as pseudo-labels).

[0042] Understandably, the purpose of constructing the mapping relationship is to narrow the distribution gap between the training domain and the test domain, so that the emotion discrimination rules learned in the training domain can be better transferred to the test domain, thereby achieving robust recognition across subjects, devices, or sessions.

[0043] S400: Principal component analysis is used to construct the source domain subspace and the target domain subspace.

[0044] In this embodiment of the application, the emotion recognition method based on brainwaves includes, in step S400, applying principal component analysis to construct a source domain subspace and a target domain subspace.

[0045] Specifically, this step performs principal component analysis (PCA) on the feature matrices of the training and test domains to reduce dimensionality and compress representations: the covariance of the feature matrix of each domain is calculated and the first few principal components are extracted to form a subspace basis. The number of principal components can be determined by the cumulative variance contribution rate threshold or a fixed dimension. After obtaining the source domain subspace basis and the target domain subspace basis, the samples in the corresponding domains are projected onto the corresponding subspaces to obtain a low-dimensional representation, which facilitates noise reduction, reduces redundant dimensions, and provides a basic representation for subspace alignment.

[0046] Understandably, PCA dimensionality reduction improves computational efficiency and enhances robustness to noise. The resulting subspace basis provides a description of the two domains on a low-dimensional linear manifold, laying the foundation for subsequent domain alignment through transformation.

[0047] S500: Construct a subspace alignment transformation matrix based on the source domain subspace and the target domain subspace to map the source domain features to the target domain subspace, thereby aligning the edge distributions of the source domain subspace and the target domain subspace.

[0048] In this embodiment of the application, the emotion recognition method based on brainwaves includes, in step S500, constructing a subspace alignment transformation matrix according to the source domain subspace and the target domain subspace, mapping the source domain features to the target domain subspace, so as to align the edge distribution of the source domain subspace and the target domain subspace.

[0049] Specifically, based on the source and target domain subspace basis obtained in step S400, the source domain subspace is mapped to the shape of the target domain subspace as much as possible by solving the transformation matrix or mapping function. To this end, numerical methods such as minimizing the subspace basis difference and introducing regularization to prevent overfitting are used to obtain the alignment transformation. After the low-dimensional representation of the source domain in its subspace is mapped to the target subspace through this transformation, the source and target domains can be processed uniformly on the same representation space. The alignment process can be initialized in the offline training stage and re-estimated as needed in the online stage based on newly arrived target samples to achieve dynamic adjustment.

[0050] Understandably, the purpose of subspace alignment is to reduce the difference between two domains at the margin distribution level, so that the classifier trained on the source domain can make more reliable judgments on the target domain samples on the aligned representation, thereby improving the transfer effect.

[0051] S600: Construct an emotion recognition model based on adaptive subspace feature matching.

[0052] In this embodiment of the application, the emotion recognition method based on brainwaves includes, in step S600, constructing an emotion recognition model based on adaptive subspace feature matching.

[0053] Specifically, this step constructs an adaptive emotion recognition framework based on the aligned feature representation: First, an initial classifier (such as logistic regression, LDA, or a lightweight neural network) is trained in the aligned space using labeled source domain samples; second, the classifier is applied to the target domain samples to generate pseudo-labels, and a confidence screening strategy is used to select high-confidence samples to estimate the class statistics of the target domain (such as class mean, intra-class divergence); then, the source domain and target domain statistics are fused and the classification decision or sample weights are corrected accordingly; the model includes an online adaptive unit, which iteratively performs pseudo-label updates, subspace reestimation, and classifier fine-tuning as target domain data continues to arrive, to achieve joint adaptation of conditional distribution and marginal distribution.

[0054] Understandably, adaptive subspace feature matching models, by combining subspace alignment with pseudo-label-driven statistical correction, gradually improve recognition accuracy in unsupervised or weakly supervised target domains, thereby adapting to individual differences and time drift.

[0055] S700: Performs online emotion recognition based on EEG data using an emotion recognition model.

[0056] In this embodiment of the application, the emotion recognition method based on brainwaves includes, in step S700, performing online emotion recognition on brainwave data according to an emotion recognition model.

[0057] Specifically, in the online phase, the same preprocessing and feature extraction process as in the training phase is performed on the arriving raw EEG data. Then, the generated features are projected onto the target subspace (or alignment space) and input into the trained and fine-tuned classifier to obtain the probability of the emotion category for each time window. For the output of multiple consecutive time windows, sliding window fusion, confidence weighting, or temporal smoothing strategies can be used to obtain stable emotion judgment results. The recognition results can be displayed in real time on the human-computer interface, used to trigger alarms or downstream interventions, or recorded for offline analysis and subsequent model retraining.

[0058] Understandably, online recognition not only provides emotion determination for a single sample, but also ensures the continuity and reliability of the output through time series fusion and real-time updates, supporting real-time responses in emotion monitoring, mental health assessment, or interactive application scenarios.

[0059] In this embodiment, step S600 constructs an emotion recognition model based on adaptive subspace feature matching, including: constructing an initial emotion recognition model according to the mapping relationship between source domain features and target domain subspace; applying the initial emotion recognition model to generate pseudo-labels for EEG data in the training domain, and selecting pseudo-label samples with high confidence according to a confidence strategy; correcting pseudo-label samples with high confidence; and jointly iteratively training the emotion recognition model with corrected pseudo-label samples and source domain samples.

[0060] Specifically, the construction and iteration process is as follows: First, the source domain samples are mapped to the alignment space through a subspace alignment transformation and used to train an initial classifier. The initial classifier can be a lightweight model such as logistic regression, linear discriminant analysis, lightweight feedforward neural network, or support vector machine. Then, the initial classifier is applied to the target domain samples to obtain the class probability distribution of each target sample. The probabilities are filtered according to a preset confidence threshold, and predictions higher than the threshold are regarded as high-confidence pseudo-label samples. Correction operations are performed on the high-confidence pseudo-label samples. Correction may include class imbalance resampling or reweighting, label leveling based on time continuity, etc. The process involves sliding (using consistent predictions from adjacent time windows as a correction basis) and temperature scaling or probability calibration based on model confidence to reduce overconfidence. Then, the corrected high-confidence pseudo-label samples are combined with source domain labeled samples in a certain proportion for retraining or incremental fine-tuning of the classifier. The iterative process of pseudo-label generation, screening, correction, and retraining is repeated until the preset stopping criteria are met (e.g., number of iterations, validation set performance no longer improving, or pseudo-label set convergence). In the online phase, the subspace basis and alignment transformation are periodically updated in a sliding window or incremental manner to maintain adaptation to the target domain distribution drift.

[0061] Understandably, this adaptive process gradually reduces the difference in conditional distribution between the source and target domains without increasing the cost of manual annotation by utilizing pseudo-label information from unlabeled data in the target domain, thereby improving the practical effectiveness of emotion recognition in new subjects or new scenarios. At the same time, it controls pseudo-label noise through mechanisms such as confidence screening and correction, balancing adaptive speed and stability. In terms of implementation, the specific algorithms, confidence thresholds, and iteration strategies of each step can be adjusted or replaced with equivalent methods according to the application scenario (such as real-time requirements or sample size).

[0062] In this embodiment, the emotion recognition method based on brainwaves further includes: segmenting the brainwave data to be analyzed into multiple brainwave time segment samples according to a preset time window; extracting features from each brainwave time segment sample to form a sample feature vector; representing the sample feature vector in both the source domain subspace and the target domain subspace, and obtaining the subspace basis through principal component analysis.

[0063] Specifically, the time window setting and segmentation are implemented as follows: Based on the required time resolution and real-time response delay, the continuous EEG signal is divided into short time windows ranging from 0.5 seconds to 5 seconds in length. These time windows can be non-overlapping or have a fixed overlap ratio (e.g., 25%–50%) to balance time-frequency resolution and smooth output. For each time window, necessary quality checks are performed (e.g., detection of channel impedance, saturation, or obvious artifacts). Time windows containing severe artifacts are eliminated or repaired by interpolation. For qualified time windows, baseline correction and normalization are performed along the channel dimension (e.g., removing the mean and dividing by the standard deviation by the channel) to eliminate scale differences across channels and sessions. Then, the features are calculated for each normalized time window and concatenated into a single feature vector, which is projected into the subspace representations of the source and target domains for subsequent alignment and classification.

[0064] Understandably, segmenting continuous signals into time segments can capture short-term changes in emotion while limiting the amount of computation per operation to meet real-time requirements. The choice between time window length and overlap ratio can be traded between different application scenarios (such as clinical monitoring, interactive control, or offline analysis). Short windows improve response speed but may reduce the stability of spectral estimation, while long windows improve feature stability but increase latency.

[0065] In this embodiment, feature extraction for each EEG time segment sample includes calculating the differential entropy of the EEG time segment sample in five sub-frequency bands: δ, θ, α, β, and γ. Specifically, for C acquisition channels, the differential entropy of each of the five sub-frequency bands is calculated, collectively forming a 5×C dimensional feature vector.

[0066] Specifically, the feature calculation steps are as follows: For the multi-channel signal of each time window, a preset bandpass filter is first applied to extract the signal components of each frequency band (δ, θ, α, β, γ). The power spectrum or probability density distribution of each frequency band is estimated using short-time Fourier transform, Welch method, or wavelet transform. Then, the differential entropy value is calculated based on the power spectral density as a measure of the complexity of the frequency band. The above process is repeated for each channel, and the differential entropy of the five frequency bands is concatenated in channel order to form the feature part of the channel. The features of all channels are concatenated in parallel to obtain a vector of size 5×C. If necessary, normalization or z-score standardization can be performed on the obtained feature vector to suppress the energy difference between channels. Periodic statistics (such as relative power of each frequency band and frequency band ratio) can also be calculated as supplementary features.

[0067] Understandably, differential entropy reflects the complexity and information content of a signal within a given frequency band and has been proven to have the ability to discriminate emotional states. Using a multi-band and multi-channel parallel approach preserves both frequency band-level discriminative information and brain region distribution information, which is beneficial for subsequent subspace representation and domain adaptation processing. In addition, the details of feature preprocessing (such as power spectrum estimation methods, window length, and overlap ratio) can be adapted according to hardware sampling rate and real-time requirements.

[0068] In this embodiment of the application, the construction of an emotion recognition model based on adaptive subspace feature matching further includes: selecting two sets of EEG time series sample sets from the EEG data to be analyzed, one set for training domain acquisition and the other set for test domain acquisition.

[0069] The expression for the training domain is:

[0070] in, For the training domain, For the EEG sample data of the nth time segment in the training domain, To determine the shape of the training data matrix X, Where n is the number of channels and n is the number of time segments; the label corresponding to training domain X is... Y is the vector of labels for all samples in the training domain. For the nth sample Emotion category tags.

[0071] The test domain is obtained by performing sample segmentation feature calculation on multiple frequency bands of EEG using a pre-defined differential entropy method. In both the training and test domains, each EEG sample is transformed into a 5×C-dimensional feature vector to represent the energy distribution characteristics of different frequency bands.

[0072] Specifically, the key points for selecting and preprocessing training and testing sets include: ensuring consistency in sensor layout and sampling parameters during the data collection phase, such as consistent sampling rate, channel order, and reference electrode configuration; aligning the test domain by resampling, channel mapping, or interpolation methods if hardware or sampling rate differences exist; addressing class imbalance by using undersampling or oversampling strategies for sample size, and introducing data augmentation (e.g., random window pruning, additive noise, or frequency band perturbation) during the training phase to improve model generalization; and ensuring consistency in inter-domain representation and effectiveness of subspace alignment by performing labeling, artifact removal, and standardization on all samples before they enter the subspace construction process.

[0073] It is understandable that clearly distinguishing between the training domain and the test domain and unifying the preprocessing process are prerequisites for achieving subsequent domain adaptation and subspace alignment. Even if there are differences in the acquisition conditions between the two domains, the above alignment and standardization steps can still reduce the differences between the domains at the representation level, thereby enabling the discriminative information learned from the source domain to be transferred and play a role in the target domain scenario. In addition, the way the training / test sets are organized also affects the efficiency and stability of subsequent pseudo-label strategies and online adaptation.

[0074] In this embodiment, the method further includes: dividing the two sets of EEG time series sample sets into a training phase and a testing phase according to application requirements. During the training phase, the method is based on a labeled EEG sample set. A classification decision function is learned. ,in The feature set of the training set samples already labeled. The set of emotion labels corresponding to the training set. This is the classification decision function.

[0075] During the testing phase, the knowledge gained during training is applied to predict the unlabeled sample set to obtain the output prediction value of the classification model. ,in For an unlabeled sample set, For the sentiment labels of the test set, This will output the predicted value.

[0076] Specifically, the implementation of the training phase includes: first, performing a unified preprocessing and feature construction process (such as artifact removal, bandpass and notch filtering, and windowed extraction of differential entropy) on the labeled training samples; then, dividing the training data into training and validation subsets according to a preset data partitioning strategy; employing an appropriate classifier structure (such as logistic regression, linear discriminator, lightweight feedforward neural network, or support vector machine) and using cross-entropy or other suitable loss functions as the training objective, and learning the model parameters through batch or mini-batch optimization algorithms (such as stochastic gradient descent or its variants); during training, using the validation subset for hyperparameter tuning (including learning rate, regularization strength, subspace dimension, etc.), early stopping rules, and model selection, and taking measures to address class imbalance (such as weighted loss, resampling, or synthetic samples) to improve minority class performance; after training, saving the model parameters and training statistics (such as class means, variances, and subspace basis) for use in the online phase. The testing phase includes: generating input features from the arriving unlabeled samples using the same preprocessing and feature extraction procedures as the training phase; and inputting these features into the training-obtained classification decision function. To obtain the class probability distribution of each test sample (i.e. It can output the final sentiment judgment based on probability thresholds or sequence smoothing strategies; when needed, the output of the test phase can be used to drive subsequent unlabeled adaptive mechanisms (such as pseudo-label screening and fine-tuning).

[0077] Understandably, the above training / testing division and operation process not only ensures the robustness of model learning in the offline stage (avoiding overfitting through validation and early stopping), but also provides a repeatable preprocessing and inference interface for online or cross-domain deployment. The statistics and subspace basis obtained in the training stage provide basic information for subsequent domain adaptation, subspace alignment and pseudo-label strategies, thereby supporting the transfer and adaptation of the model under new subject or collection conditions.

[0078] In this embodiment of the application, principal component analysis is used to construct the source domain subspace and the target domain subspace, including: performing dimensionality reduction processing on the feature matrices of the training domain and the test domain respectively using principal component analysis; assuming the original feature matrix is... Principal component analysis is used to obtain the eigenvectors corresponding to the k largest eigenvalues, which form the basis matrix of the subspace. And define the projection relationship as The covariance matrices before and after projection satisfy the following relationship:

[0079] in, Original feature matrix The covariance matrix is ​​used to characterize the correlation between features of different channels; Indicates the number of samples; Represents the transpose of the original characteristic matrix X; Representing the projected features The covariance matrix represents the characteristic distribution relationship of the samples in the subspace; It is the projected feature matrix transpose; It is a subspace basis matrix The transpose of .

[0080] Specifically, the steps for constructing the subspace are as follows: First, the input feature matrix is ​​centered (mean is removed from each feature dimension) and scaled as needed to eliminate dimensional differences between different channels or frequency bands; then, the centered feature covariance matrix is ​​calculated or the eigenvectors and eigenvalues ​​are solved directly using the singular value decomposition (SVD) method; based on predetermined selection criteria (e.g., cumulative variance explanation rate reaches a certain threshold, Elbow's rule, or fixed dimensionality limit), the first few principal components are selected to form the subspace basis; the original features are projected onto the selected subspace basis to obtain a low-dimensional representation. The projection result can be numerically obtained through matrix multiplication or efficient SVD projection calculation; this step is completed offline to obtain the initial source and target domain subspace basis. In online or incremental scenarios, the subspace basis can be periodically updated using sliding window reestimation or incremental PCA algorithms to cope with distribution drift; at the same time, the projected low-dimensional features can be whitened or standardized as needed for subsequent alignment and classification.

[0081] Understandably, PCA subspaces provide a means of denoising and compressing representation, enabling high-dimensional multi-channel, multi-band EEG features to be described on a low-dimensional linear manifold, thereby reducing computational complexity and enhancing robustness to noise. The choice of subspace basis directly affects the degree of preservation of important signal components. Therefore, in practical applications, a trade-off can be made between representational capability and real-time performance, and the number of principal components can be set accordingly. In addition, periodically re-evaluating the subspace basis can make the method better adapt to changes in subject status or acquisition conditions. Combined with subspace alignment transformation, more stable cross-domain transfer effects can be achieved.

[0082] In this embodiment of the application, a preset conditional distribution constraint method is introduced on the basis of the edge distribution adaptation method to achieve alignment of the source domain and the target domain at the category level, thereby improving the generalization ability of cross-domain classification.

[0083] In this embodiment of the application, after edge distribution alignment, the features of the source domain and target domain samples in the new subspace are respectively In order to estimate the conditional distribution of the target domain, since the target domain samples lack true labels, a pseudo-label strategy is adopted: the classifier trained on the source domain is used to predict the target domain samples, and the prediction result is used as an approximate label.

[0084] in, It is the new feature representation of the source domain sample after feature space transformation, that is, the feature matrix of the source domain sample in the aligned subspace; It is a subspace transformation matrix, also known as an alignment matrix, used to align the feature spaces of the source and target domains, so that the distribution of the source domain samples projected onto this transformation space is closer to that of the target domain samples. The target domain sample is based on its subspace basis. Projection features are represented on the surface.

[0085] Specifically, based on the alignment representation obtained in step S500 (Source Domain) and (Target domain), first in Train the discriminant model and perform... Calculate the predicted probability of each category for each sample; record the maximum predicted probability and corresponding category for each target sample as candidate pseudo-label information; then, according to the confidence screening strategy described below, high-confidence samples are included in the pseudo-label set; to reduce the impact of single pseudo-label error on subsequent statistical estimation, a higher threshold can be used in the initial iteration and gradually relaxed, or a sliding window can be used to accumulate high-confidence samples; before pseudo-labels are incorporated into training, calibration operations such as label smoothing or temperature scaling can be performed on pseudo-label samples to mitigate model overconfidence and reduce the weight of misleading samples.

[0086] It is understandable that the pseudo-labeling strategy, in unsupervised target domain scenarios, is used to estimate the conditional distribution. This provides a feasible path, but the pseudo-labels themselves are noisy, so confidence screening, calibration and iterative mechanisms must be used to achieve a balance between adaptive speed and stability; the quality of the pseudo-label set directly affects the effectiveness of subsequent category statistic estimation and conditional distribution correction.

[0087] In this embodiment of the application, a preset logistic regression (LR) model is used to model the class probabilities:

[0088] in, This represents the feature vector of a sample in the subspace. For the category label of the sample, take value, This is the parameter vector of the logistic regression model, used to characterize the discriminant hyperplane; It is the transpose of the weight vector of the Logistic Regression (LR) classifier, used to perform an inner product with the sample feature u to obtain the classification score during classification prediction.

[0089] Specifically, regarding the application of the logistic regression (LR) model: in the alignment space... and To construct an LR binary or multi-class classifier for training data, the input features are first normalized or standardized during training. A cross-entropy cost function with a regularization term (e.g., L2 regularization) is used, and the parameter vector is solved using batch or mini-batch optimization algorithms (e.g., Adam, SGD). To prevent overfitting, the regularization strength and learning rate can be determined through cross-validation, and the validation set performance can be monitored during training to enable early stopping.

[0090] Understandably, logistic regression is chosen as the initial discriminant model because of its advantages of simplicity, interpretability, low computational cost, and ease of incremental updates. Lightweight neural networks can be used as alternatives when higher discriminant power is required, but logistic regression has good engineering adaptability in online updates and pseudo-label-driven conditional distribution estimation.

[0091] In this embodiment, the optimal parameters are learned by minimizing the cross-entropy loss function. Minimize the cross-entropy loss function:

[0092] in, The number of samples in the source domain. These represent the features and labels of the source domain, respectively. It is the true label of the j-th sample in the source domain, with the emotion category. It is the feature vector of the j-th sample in the source domain, and it is the sample... After subspace transformation The new features obtained later.

[0093] Specifically, regarding the minimization of the cross-entropy loss function: using the source domain sample set... Construct a cross-entropy loss and add a regularization term, then obtain the optimal loss by solving a loss minimization problem. In actual training, gradient descent with momentum or a second-order approximate solver can be used. The training process includes learning rate scheduling, batch standardization (if applicable), and early stopping mechanism. The training output is parameters. Along with the class statistics during training (such as the number of samples per class, mean, etc.), this information will be saved for subsequent conditional distribution correction and pseudo-label screening.

[0094] Understandably, minimizing the cross-entropy loss ensures that the discriminative model has good classification performance in the source domain, while regularization terms and validation monitoring help improve the robustness of the model during cross-domain transfer.

[0095] In this embodiment of the application, for the target domain, since the true label is unknown, a pseudo-label confidence function is introduced:

[0096] in, The confidence threshold is used to include the pseudo-label of a sample in the conditional distribution fitting only when the predicted probability of the target domain sample is greater than the threshold. This effectively avoids the noise brought by unreliable pseudo-labels to the distribution estimation. It uses a classifier with predetermined weights w, trained in the source domain, to predict the probability of belonging to class Y on a sample Ut in the target domain. The subscript s indicates that this prediction model is trained from the "source domain" data.

[0097] Specifically, regarding the target domain pseudo-label confidence function Implementation and thresholding strategy: For each target sample, calculate the thresholding strategy based on the model trained in the source domain. Given the class probabilities, set a global or class-adaptive confidence threshold. (For example, the initial value can be set to 0.9 or 0.95), only those with a probability higher than 0.95 will be selected. The samples are included in the high-confidence set; to improve flexibility, temperature scaling can be used to calibrate the probability output, or soft thresholding and sample weighting can be used (mapping the probability to sample weights instead of binary adoption), and a minimum sample size threshold can be set to avoid a certain category having too few samples due to a high threshold, making it impossible to reliably estimate the statistics.

[0098] Understandably, setting the confidence threshold requires a trade-off between pseudo-label accuracy and sample coverage: a high threshold can guarantee pseudo-label quality but may result in too few samples; a low threshold results in more samples but more noise. Therefore, methods such as gradually relaxing the threshold, class-adaptive thresholds, or combining them with temporal consistency (consistency in predictions between adjacent time windows) are often used to improve the reliability of pseudo-labels.

[0099] In this embodiment of the application, after obtaining the category predictions for the source and target domains, the statistics of the category conditional distribution are calculated: source domain category The characteristic mean and variance are respectively and ;in, Let be the feature vector of a sample belonging to class k in the source domain; Corresponding category label. Target domain category The characteristic mean and variance are respectively and The mean and variance were estimated from high-confidence pseudo-label samples; The feature vector of samples belonging to category (k, k, k) in the target domain is obtained through pseudo-labels according to preset standards; The corresponding pseudo-tags.

[0100] Specifically, after obtaining the class predictions for the source and target domains, the steps for estimating the statistics of the class conditional distribution are as follows: For the source domain... The mean and variance (or covariance matrix) of the features of each class of samples are calculated as... , ; For the target domain The class only computes the corresponding value on its set of high-confidence pseudo-labels. , When the sample size is insufficient or the estimated variance is unstable, the target domain statistic can be estimated using a contraction method or proportionally merged with the source domain statistic (i.e., using a balance coefficient). To obtain a more robust estimate, in practice, to prevent the influence of extreme values, sample characteristics can be truncated in advance or robust mean / variance estimates (such as median and MAD) can be used.

[0101] Understandably, accurate class-conditional statistics are crucial for achieving conditional distribution alignment: by comparing or fusing source / target class means and divergence information, the classifier's discrimination boundary can be shifted or reweighted, thereby reducing... and The deviation between the two can be reduced to improve classification performance in the target domain; at the same time, the shrinkage and robust estimation strategy can mitigate the negative impact of noise from false labels on the estimation of statistics.

[0102] In this embodiment of the application, correcting pseudo-labeled samples with high confidence includes: weighted fusion of the original source domain sample features and the sample features corrected by conditional distribution. The magnitude of the correction is controlled by adjusting a balance factor, wherein the value of the balance factor is between 0 and 1. When the balance factor is 0, the original features are completely retained; when the balance factor is 1, the corrected features are used completely.

[0103] To reduce the difference between the conditional distributions of the two domains, the categorical conditional statistics are aligned, and a balancing factor is introduced. :

[0104] in, Indicates the first after alignment The conditional distribution statistic for feature representation of a class is the statistic of the k-th class in the source domain. and the target domain Class statistics The result after weighted fusion according to the balance factor μ∈[0,1]; and Representing the source and target domains in terms of category The following statistics, Used to adjust the contributions of the source and target domains; when When it depends entirely on the source domain distribution; when In this case, it depends entirely on the distribution of pseudo-labels in the target domain; in practical applications, it is usually taken as... To balance robustness and adaptability.

[0105] Specifically, several optional implementations of conditional distribution correction and model updating using the above statistics include: First, modifying the bias term or class prior of the classifier so that the discriminant output reflects the class-conditional characteristics of the target domain; second, constructing an intra-class distance metric (such as Mahalanobis distance) based on class mean and covariance and using it to reweight the sample loss or as an auxiliary discriminant score to be integrated into the final decision; third, adding a conditional alignment term to the training objective function (e.g., making the means of source / target samples of the same class closer in the alignment space) and balancing the classification loss and alignment loss with weight coefficients; and fourth, jointly using the corrected high-confidence pseudo-label samples with source domain samples for the next round of iterative training or incremental update, thereby forming a cyclical adaptive learning mechanism.

[0106] It is understandable that the above correction and update methods can be used individually or in combination, depending on the requirements of real-time performance, computing resources, and stability. For example, lightweight bias correction or sample weighting strategies can be used first on edge devices, while batch optimization with conditional alignment terms can be used to obtain better global alignment results when retraining in the cloud or offline.

[0107] In this embodiment, the overall process of online EEG emotion recognition based on adaptive subspace feature matching (ASFM) includes data input, subspace construction and alignment, initial supervised training, pseudo-label generation and confidence screening, category statistic estimation and conditional distribution correction, smoothing shrinkage and iterative update, and final training and inference.

[0108] Specifically, the input includes: source domain training features and labels. (in For the original feature dimension, (Number of samples in the source domain) and features of the target domain to be tested Hyperparameters include subspace dimension. False label confidence threshold Learning rate Smoothing coefficient Similar to the maximum number of iterations (maxepoch); the output is the target domain prediction / pseudo-label. The algorithm executes in an iterative manner: first, it iterates through... PCA was performed separately to obtain the subspace basis. Construct the alignment matrix And project to obtain the alignment space representation Training the source domain set in the alignment space An initial logistic regression classifier is trained and iteratively subjected to pseudo-label filtering, class statistic estimation, source domain sample standardization and smoothing shrinkage until the stopping criterion is met; finally, the final classifier is trained and analyzed. Output .

[0109] Understandably, this overall process combines edge distribution alignment with category conditional distribution correction, gradually approximating the target distribution in a target domain with few or no labels using pseudo-label information, thereby improving cross-domain generalization ability; various hyperparameters (such as...) The iteration strategy can be adjusted according to the requirements of real-time performance and robustness to achieve an appropriate trade-off in online deployment scenarios.

[0110] In this embodiment, the subspace construction and alignment module is used to map high-dimensional original EEG features to a low-dimensional alignment space, thereby reducing noise and computational burden and achieving edge distribution alignment between domains.

[0111] Specifically, respectively Perform PCA and take the previous step The principal components yield the subspace basis matrix. Subspace alignment is achieved using matrix transformations, as shown in the example implementation below. Then, the source and target domain samples are projected into an aligned representation. , Subsequent training, pseudo-label generation, and statistical estimation are all performed in this low-dimensional alignment space.

[0112] Understandably, PCA dimensionality reduction removes redundant dimensions and enhances robustness to noise; by "rotating / mapping" the source subspace to the target subspace (i.e., the Z_trans operation), the difference between the two domains can be reduced at the edge distribution level, providing a better starting point for subsequent category-level alignment; in online scenarios, incremental PCA or sliding window re-estimation of the subspace can be used to cope with the drift of the distribution over time.

[0113] In this embodiment, the supervised training and pseudo-label generation steps are used to initialize a discriminative model in the alignment space using source domain label information and generate target domain pseudo-labels using the model to estimate the conditional distribution.

[0114] Specifically, source domain samples are used in the alignment space. Train a logistic regression (LR) or other lightweight discriminator using cross-entropy loss and a fixed learning rate. Alternatively, an adaptive optimizer can be used to update the parameters; the trained classifier can be applied to each target domain sample. Calculate class probability and use confidence function Filter out the set of high-confidence pseudo-labels .

[0115] Understandably, the quality of the pseudo-labels determines the reliability of subsequent conditional distribution estimation; therefore, the confidence threshold... The setting should be high in the initial iteration to ensure the accuracy of the pseudo-label, and then can be appropriately relaxed according to the number of high-confidence samples collected and the model performance; models such as logistic regression have low computational cost and are easy to implement in online incremental updates, making them suitable for embedded or edge real-time inference environments.

[0116] In this embodiment, the conditional distribution adaptation and class statistics alignment steps adjust the sample distribution by estimating and fusing class statistics of the source / target domains, thereby enabling... There is greater consistency between the two domains.

[0117] Specifically, for each category Calculate the class mean of the source domain respectively. Within-class standard deviation / covariance (or ), and use a set of high-confidence pseudo-labels Estimate the corresponding mean over the target domain. With divergence Subsequently, the categories belonging to the source domain were analyzed. Each sample is first standardized (i.e., based on...) (After eliminating scale differences) then perform a center shift to the target mean, i.e. This is done to adjust the source domain samples so that their class centers and shapes are closer to the target domain. Please refer to [further details]. Figure 2 , Figure 2 This is a schematic diagram illustrating the effect of conditional distribution adaptation and class statistical alignment provided in an embodiment of this application.

[0118] It is understandable that by performing edge alignment first and then conditional alignment for each class, the class aliasing problem caused by relying solely on edge alignment can be effectively avoided. When performing class statistical estimation, if the number of high-confidence samples in the target domain is insufficient, shrinkage estimation, proportional fusion with source domain statistics, or robust estimation strategies can be used to avoid noise introducing errors.

[0119] In the embodiments of this application, the smooth contraction strategy is used to balance robustness and adaptability in adaptive updates, thereby improving the robustness of the online iteration process.

[0120] Specifically, for the source domain belonging to a category The sample, its original alignment representation Aligned with standardized and translated samples Construct convex combinations: The smoothing coefficient Control the degree to which the statistics converge towards the target domain; after each iteration, use the updated... Retrain or fine-tune the classifier and proceed to the next round of pseudo-label generation.

[0121] Understandably, when pseudo-labels still contain a small amount of noise, smooth shrinkage avoids shifting the class center significantly in one step (thus reducing the risk of misleading). The value of can be gradually increased with the number of iterations or adaptively adjusted based on the verification performance, so as to maintain robustness while ensuring convergence speed.

[0122] In this embodiment, the training and inference section integrates the outputs of the above modules to form the final online recognition result and update cycle.

[0123] Specifically, after several rounds of iteration (or until the maximum number of iterations (maxepoch) or the performance improvement criterion is reached), the final aligned training set is used. (Including the original source samples and the incorporated high-confidence target samples) Train the final classifier classifier(·); During online inference, preprocess and extract features from the EEG of each arriving time window, and project it to the target subspace / alignment space. Then, the classifier(·) outputs the probability of the sentiment category and obtains a stable determination based on the sequence fusion or window smoothing strategy. .

[0124] Understandably, this closed-loop mechanism of training-pseudo-labeling-correction-retraining enables unsupervised target domain adaptation; in resource-constrained edge scenarios, the iteration frequency, pseudo-label threshold, and model complexity can be constrained to meet real-time requirements, while larger-scale retraining can be performed periodically in the cloud to further improve performance.

[0125] In the embodiments of this application, the mathematical minimization of the subspace alignment further illustrates the construction of the alignment matrix and its role in the projection representation.

[0126] Specifically, the subspace basis is obtained via PCA. Then, a minimization target can be defined. To obtain the optimal transformation matrix In an example implementation of an analytical solution, it is possible to take... Thus constructing the aligned subspace basis. And the representations of the source and target domain samples in the aligned subspace are written as follows: This mapping significantly reduces the distribution of the two domains at the edge. The differences in these aspects facilitate subsequent category-level alignment.

[0127] Understandably, the above-described minimization formulation and analytical construction is a commonly used and computationally efficient subspace alignment method in engineering, which can achieve good geometric alignment results while maintaining low computational cost. In scenarios requiring finer alignment, it can also be replaced with alignment methods with regularization terms or iterative optimization solutions to adapt to different noise levels and sample size conditions.

[0128] The following exemplary embodiment describes the specific deployment process and related parameters of the EEG-based emotion recognition method provided in this application. This embodiment uses the SEED EEG public database as the data source. The EEG signals collected in each experiment are sliced ​​into 1-second non-overlapping windows, yielding approximately 3300 time-segment samples per experiment. Differential entropy features are extracted from each time segment to form a labeled sample set for the training phase and an unlabeled feature set for the testing phase, thus constructing a complete feature representation system.

[0129] In the online emotion recognition process, the system first needs to collect a number of preparatory samples, no less than the number of subspace dimensions, to complete PCA dimensionality reduction and subspace initialization. Then, it enters the streaming processing stage, continuously receiving new test samples at fixed 10-second time steps. At each time step, an adaptive subspace feature matching algorithm is run once. This process includes two key steps: first, subspace alignment is used to adapt the source and target domains at the edge distribution level; then, high-confidence pseudo-labels are used to further complete conditional distribution adaptation. The system synchronously updates the classifier parameters and predicts the emotion of newly arrived samples. The entire algorithm executes in a cyclical rhythm of "new samples → distribution adaptation → classification prediction," effectively simulating the real-world scenario of limited calibration time and streaming data arrival in an online environment.

[0130] To verify the effectiveness of this method, comprehensive comparative experiments were conducted. The baseline classifiers used were Support Vector Machine (linear kernel) and Logistic Regression (L2 regularization). The domain adaptation method was compared with the subspace alignment method that only performs edge distribution alignment and the edge + conditional joint adaptation method proposed in this application. Key parameters were set as follows: subspace dimension g = 310, confidence threshold τ = 0.41, candidate selection rounds 2, and balance coefficient μ = 0.3. Experimental results show that, in online settings, this method achieved an average recognition accuracy of 80.9%, significantly higher than the SVM baseline's 52.7%, the LR baseline's 54.0%, and the edge distribution alignment method's 77.2%. In terms of computational efficiency, the combined time for the entire online adaptation and classification process is approximately 1.58 seconds per round, significantly lower than traditional offline feature adaptation methods, fully meeting the real-time requirements of online scenarios.

[0131] This embodiment fully demonstrates that the method proposed in this application can effectively improve the accuracy of emotion recognition across individuals and time scenarios while maintaining high computational efficiency, providing a reliable technical solution for real-time emotion monitoring based on EEG signals.

[0132] Figure 3 This is a schematic diagram of a module of an emotion recognition system based on electroencephalograms provided in an embodiment of this application. Figure 3 As shown, the EEG-based emotion recognition system 10 includes at least the following components: a data acquisition module 11, a data processing module 12, a data mapping module 13, a model building module 14, and a result output module 15.

[0133] In this embodiment, the data acquisition module 11 is used to acquire the EEG data to be analyzed; please refer to the specific method for details. Figure 1 , 2 The details and their corresponding descriptions are not repeated here.

[0134] In this embodiment, the data processing module 12 is used to use the labeled EEG data as the training domain and the unlabeled EEG data as the test domain. Please refer to the following for details. Figure 1 , 2 The details and their corresponding descriptions are not repeated here.

[0135] In this embodiment, the data mapping module 13 is used to construct the mapping relationship between the training domain and the test domain; apply principal component analysis to construct the source domain subspace and the target domain subspace; construct a subspace alignment transformation matrix based on the source domain subspace and the target domain subspace, and map the source domain features to the target domain subspace to align the edge distributions of the source domain subspace and the target domain subspace. For details, please refer to the accompanying documentation. Figure 1 , 2 The details and their corresponding descriptions are not repeated here.

[0136] In this embodiment, the model building module 14 is used to build an emotion recognition model based on adaptive subspace feature matching. Please refer to the documentation for details. Figure 1 , 2 The details and their corresponding descriptions are not repeated here.

[0137] In this embodiment, the result output module 15 is used to perform online emotion recognition on EEG data based on the emotion recognition model. Please refer to the documentation for details. Figure 1 , 2 The details and their corresponding descriptions are not repeated here.

[0138] Figure 4 This is an electronic device 20 provided in one embodiment of this application. For example... Figure 4 As shown, the electronic device 20 includes at least the following components: a processor 21 and a memory 22.

[0139] In this embodiment, the memory 22 is used to store executable instructions of the processor 21, which, when configured to execute instructions, implement... Figure 1 The emotion recognition method based on brainwaves is shown.

[0140] In one embodiment of this application, the program operating in the electronic device 20 may be a program that controls a central processing unit (CPU) or similar device to achieve the functions of the above-described embodiments of the present invention (a program that enables the computer to function). The information processed by these devices is then temporarily stored in random access memory (RAM) during processing, and subsequently stored in various ROMs such as read-only memory (Flash ROM) and hard disk drives (HDDs), and read, corrected, and written by the CPU as needed.

[0141] It should be noted that a portion of the electronic device 20 described above can also be implemented using a computer. In this case, the program for implementing the control function can be recorded on a computer-readable recording medium, and the program recorded on the recording medium can be read into the computer and executed.

[0142] It should be noted that the term "computer" as used here refers to a computer built into electronic device 20, employing hardware including an operating system and peripheral devices. Furthermore, "computer-readable recording media" refers to removable media such as floppy disks, magneto-optical disks, ROMs, and CD-ROMs, as well as storage devices such as hard drives built into the computer.

[0143] Furthermore, a "computer-readable recording medium" can include: a medium that dynamically stores a program for a short period of time, such as a communication line used when transmitting a program via a network such as the Internet or a communication line such as a telephone line; or a medium that stores a program for a fixed period of time, such as volatile memory inside a computer that serves as a server or client in this case. In addition, the aforementioned program can be a program used to implement the above-mentioned functions, or it can be a program that can implement the above-mentioned functions by combining with programs already recorded in the computer.

[0144] Furthermore, the electronic device 20 in the above embodiments can also be implemented as an assembly (device group) composed of multiple devices. Each device constituting the device group can possess some or all of the functions or functional blocks of the electronic device 20 in the above embodiments. As a device group, it is sufficient to have all the functions or functional blocks of the electronic device 20.

[0145] It is understood that the emotion recognition method, system 10, and electronic device based on EEG provided in this application acquire EEG data to be analyzed and divide it into a labeled training domain and an unlabeled test domain, constructing a mapping relationship between the two; principal component analysis is applied to construct source and target domain subspaces, and the source domain features are mapped to the target domain subspace based on the subspace alignment transformation matrix to achieve edge distribution alignment; then, an adaptive subspace feature matching emotion recognition model is constructed, ultimately achieving online emotion recognition. This method effectively solves the problem of insufficient model generalization ability caused by individual differences and non-stationarity of EEG signals. By reducing the distribution difference between the source and target domains through subspace alignment technology, it improves the accuracy and robustness of emotion recognition across individuals and time scenarios, while meeting the real-time requirements of online applications, providing a reliable technical means for emotion state monitoring and mental health auxiliary diagnosis based on physiological signals.

[0146] Those skilled in the art should recognize that the above embodiments are only used to illustrate this application and are not intended to limit this application. Any appropriate changes and variations made to the above embodiments within the essential spirit and scope of this application fall within the scope of protection claimed in this application.

Claims

1. A brainwave-based emotion recognition method, characterized in that, The method includes: Acquire the brainwave data to be analyzed; The labeled EEG data is used as the training domain, and the unlabeled EEG data is used as the test domain. Construct a mapping relationship between the training domain and the test domain; Principal component analysis was used to construct the source domain subspace and the target domain subspace; A subspace alignment transformation matrix is ​​constructed based on the source subspace and the target subspace to map the source subspace features to the target subspace, thereby aligning the edge distributions of the source subspace and the target subspace. Construct an emotion recognition model based on adaptive subspace feature matching; Online emotion recognition is performed on EEG data based on the emotion recognition model.

2. The emotion recognition method based on brainwaves according to claim 1, characterized in that, The construction of the emotion recognition model based on adaptive subspace feature matching includes: An initial emotion recognition model is constructed based on the mapping relationship between the source domain features and the target domain subspace; The initial emotion recognition model is used to generate pseudo-labels for the EEG data in the training domain, and pseudo-label samples with high confidence are selected according to the confidence strategy. Correct the pseudo-labeled samples with high confidence; The emotion recognition model is trained iteratively by jointly training the corrected pseudo-labeled samples and source domain samples.

3. The emotion recognition method based on brainwaves according to claim 2, characterized in that, The method further includes: The EEG data to be analyzed is divided into multiple EEG time segment samples according to a preset time window; Features are extracted from each of the aforementioned EEG time segment samples to form a sample feature vector; The sample feature vectors are represented in the source domain subspace and the target domain subspace respectively, and the subspace basis is obtained by principal component analysis.

4. The emotion recognition method based on brainwaves according to claim 3, characterized in that, The feature extraction for each of the aforementioned EEG time segment samples includes: Calculate the differential entropy of the EEG time segment sample in the five sub-bands δ, θ, α, β, and γ; For each of the C acquisition channels, the differential entropy of five sub-bands is calculated for each channel, which together form a 5×C dimensional feature vector.

5. The emotion recognition method based on brainwaves according to claim 4, characterized in that, The construction of the emotion recognition model based on adaptive subspace feature matching also includes: Two sets of EEG time series samples are selected from the EEG data to be analyzed, one set for training domain acquisition and the other set for test domain acquisition. The expression for the training domain is: ; in, For the training domain, For the EEG sample data of the nth time segment in the training domain, To determine the shape of the training data matrix X, Where n is the number of channels and n is the number of time segments; the label corresponding to the training domain X is Y is the vector of labels for all samples in the training domain. For the nth sample Emotion category tags; The test domain is obtained by performing sample segmentation feature calculation processing on multiple frequency bands of EEG using a preset differential entropy method; In the training domain and the test domain, each EEG sample is converted into a 5×C-dimensional feature vector to represent the energy distribution characteristics of different frequency bands.

6. The emotion recognition method based on brainwaves according to claim 5, characterized in that, The method further includes: The two sets of EEG time series samples are divided into a training phase and a testing phase according to application requirements; The training phase is based on a set of labeled EEG samples. A classification decision function is learned. ,in The feature set of the training set samples already labeled. The set of emotion labels corresponding to the training set. For classification decision functions; The testing phase applies the knowledge gained during the training phase to predict the unlabeled sample set in order to obtain the output prediction value of the classification model. ,in For an unlabeled sample set, For the sentiment labels of the test set, This will output the predicted value.

7. The emotion recognition method based on brainwaves according to claim 5, characterized in that, The application of principal component analysis to construct the source domain subspace and the target domain subspace includes: Principal component analysis is used to reduce the dimensionality of the feature matrices of the training domain and the test domain respectively; let the original feature matrix be... Principal component analysis is used to obtain the eigenvectors corresponding to the k largest eigenvalues, which form the basis matrix of the subspace. And define the projection relationship as ; The covariance matrices before and after projection satisfy the following relationship: ; in, Original feature matrix The covariance matrix is ​​used to characterize the correlation between features of different channels; Indicates the number of samples; Represents the transpose of the original characteristic matrix X; Representing the projected features The covariance matrix represents the characteristic distribution relationship of the samples in the subspace; It is the projected feature matrix transpose; It is a subspace basis matrix The transpose of .

8. The emotion recognition method based on brainwaves according to claim 2, characterized in that, The correction of the pseudo-labeled samples with high confidence includes: The original source domain sample features are weighted and fused with the sample features after conditional distribution correction; The magnitude of the correction is controlled by adjusting the balance factor, wherein the value of the balance factor is between 0 and 1. When the balance factor is 0, the original features are completely preserved; when the balance factor is 1, the corrected features are completely adopted.

9. An emotion recognition system based on brainwaves, characterized in that, The system includes: The data acquisition module is used to acquire the EEG data to be analyzed. The data processing module is used to use the labeled EEG data as a training domain and the unlabeled EEG data as a test domain. The data mapping module is used to construct the mapping relationship between the training domain and the test domain; apply principal component analysis to construct the source domain subspace and the target domain subspace; construct a subspace alignment transformation matrix based on the source domain subspace and the target domain subspace to map the source domain features to the target domain subspace, so as to align the edge distribution of the source domain subspace and the target domain subspace. The model building module is used to build an emotion recognition model based on adaptive subspace feature matching. The result output module is used to perform online emotion recognition on EEG data based on the emotion recognition model.

10. An electronic device, characterized in that, include: processor; as well as A memory having computer-readable instructions stored thereon for controlling the processor to perform the brainwave-based emotion recognition method as described in any one of claims 1 to 8.