Resting electroencephalogram quality assessment method and system based on double-branch contrast learning

By extracting time-domain and time-frequency domain features of EEG using a bi-branch contrastive learning method and combining it with self-supervised learning, the problem of EEG signal quality control in online scenarios is solved, achieving low-latency, high-efficiency quality assessment and artifact recognition, which is suitable for brain-computer interface systems.

CN121421559BActive Publication Date: 2026-04-17ANHUI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ANHUI UNIV
Filing Date
2025-12-31
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively control the quality of EEG signals in online, real-time scenarios. In particular, the complexity of artifacts and individual differences lead to a decline in signal quality, affecting the interpretation of neural signals and the performance of deep learning decision-making.

Method used

A resting EEG quality assessment method based on bibranch contrastive learning is adopted. The method extracts time-domain and time-frequency domain features through a bibranch encoder, and uses a self-supervised contrastive learning mechanism for feature fusion and optimization. Fine-tuning is performed with a small amount of labeled data to achieve efficient quality control.

Benefits of technology

It achieves low-latency real-time EEG quality assessment, reduces reliance on manually labeled data, improves feature discrimination capability and robustness, and meets the needs of online BCI systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121421559B_ABST
    Figure CN121421559B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for assessing resting EEG quality based on bi-branch contrastive learning. The method includes acquiring raw EEG signals X, performing data preprocessing and data augmentation to generate two different augmented views, which are then fed in parallel into a bi-branch encoder. Time-domain waveform and time-frequency rhythm features are extracted and deeply fused. The fused features X1 and X2 are fed into a projection head. A self-supervised contrastive learning mechanism is used to optimize network weights using contrastive loss. A small, labeled fine-tuning dataset containing X and its corresponding label y is used. After passing through the pre-trained bi-branch encoder, it is directly fed into a classification head connected to the bi-branch encoder to output the prediction result of the input data segment. The optimization process uses a hybrid loss function including classification loss and contrastive loss for training. This invention establishes a complete online real-time quality control system, achieving an end-to-end real-time closed loop from data acquisition to quality assessment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data quality control technology in the standardized modeling of electroencephalogram (EEG) signal analysis, and in particular to a method and system for assessing the quality of resting EEG based on bi-branch contrastive learning. Background Technology

[0002] Electroencephalography (EEG), a non-invasive brain imaging technique, has been widely used in neuroscience research, clinical diagnosis, and brain-computer interface (BCI) systems due to its excellent millisecond-level temporal resolution, low cost, and ease of operation. EEG technology can capture the electrical activity of the cerebral cortex in real time, providing a unique window into understanding human cognitive processes, emotional states, and diagnosing neurological diseases. From traditional sleep staging monitoring to emerging driver fatigue warnings and intelligent human-computer interaction, the application scenarios of EEG technology are rapidly expanding. However, during signal acquisition, EEG is highly susceptible to contamination by physiological artifacts (such as eye movements and electromyography) and environmental interference (such as electrode displacement and power frequency noise), leading to a significant decrease in signal quality and severely affecting the interpretation of neural mechanism signals and the performance of deep learning decision-making.

[0003] Artifacts originate from a variety of complex sources. Physiological artifacts (such as electrooculography, electromyography, and electrocardiography) and environmental artifacts (such as contact noise and power line interference) often overlap with EEG signals generated by real neural sources in both the time and frequency domains, making them difficult to separate. In traditional laboratory environments, strictly controlled experimental conditions can reduce artifact generation to some extent. However, as EEG technology expands into dynamic and unconstrained scenarios such as mobile EEG (MoBI), the dynamic changes in the subject's body movement, environmental electromagnetic variations, and electrode contact states collectively create a complex and non-stationary noisy environment. In this context, artifact generation is the norm rather than accidental and is highly coupled with neural signals, making existing traditional artifact processing methods insufficient.

[0004] Traditional artifact removal schemes typically rely on offline processing after signal acquisition, primarily including methods such as filtering and Independent Component Analysis (ICA). Filtering can effectively remove noise within a specific frequency range, but its effectiveness is limited for broadband physiological artifacts. For example, the frequency range of electrooculogram (EOG) signals overlaps with low-frequency EEG signals, and simple filtering may inadvertently remove useful EEG information. ICA attempts to separate artifacts and EEG signals by assuming they are independent. However, this method has high data quality requirements, cannot handle nonlinear or non-independent artifacts, and requires tedious manual component analysis, making the process subjective and difficult to fully automate. The fundamental problem is that these offline methods cannot meet the requirements for unified, online, and real-time quality control of massive amounts of data in the standardized construction of EEG norms. In online BCI systems, the signal quality of every millisecond is crucial; a command signal contaminated by an artifact can lead to system misinterpretation and serious consequences.

[0005] In recent years, automated algorithms, represented by deep learning, have demonstrated certain performance in artifact detection tasks. However, these methods typically belong to the supervised learning paradigm, relying on massive amounts of high-quality labeled data for training. Furthermore, their generalization ability is limited in online acquisition scenarios due to individual differences, equipment variations, and environmental uncertainties. Particularly when constructing large-scale, cross-center EEG norm databases, efficient and automated quality control of massive amounts of data is a prerequisite for ensuring the accuracy of norm models, and existing methods face bottlenecks in both label dependency and processing efficiency. Self-supervised learning (SSL), as an emerging machine learning paradigm, leverages the structural information inherent in unlabeled data to learn general feature representations, offering breakthrough potential for solving the problem of scarce labeled data. However, existing self-supervised learning research largely focuses on offline analysis scenarios, failing to address the critical challenge of real-time quality control during EEG acquisition.

[0006] Therefore, there is an urgent need to provide a novel method and system for assessing resting EEG quality based on bibranch contrastive learning to solve the above problems. Summary of the Invention

[0007] The technical problem to be solved by the present invention is to provide a method and system for assessing the quality of resting EEG based on bi-branch contrastive learning, which can achieve efficient online EEG quality control.

[0008] To solve the above-mentioned technical problems, one technical solution adopted by the present invention is: to provide a method for assessing resting EEG quality based on bi-branch contrastive learning, comprising the following steps:

[0009] S1: Acquire the raw EEG signal X for data preprocessing, perform data augmentation on the preprocessed data, and generate two different augmented views as the raw data input to the dual-branch encoder;

[0010] S2: The two different enhanced views are fed into the dual-branch encoder in parallel to extract time-domain waveform and time-frequency domain rhythm features respectively, and then deeply fused. The fused features X1 and X2 are fed into the projection head, and the network weights are optimized by using contrast loss through a self-supervised contrastive learning mechanism.

[0011] S3: A small number of labeled fine-tuning datasets containing X and corresponding labels y are used. After passing through a two-branch encoder loaded with pre-trained weights, the dataset is directly fed into a classification head connected to the two-branch encoder to output the quality prediction results of the input data segment. The optimization process uses a hybrid loss function including classification loss and contrastive loss for training.

[0012] In a preferred embodiment of the present invention, step S1, the process of preprocessing the raw EEG signal X, includes:

[0013] S101: Divide the acquired raw EEG signal X into discrete segments of fixed duration, segmented by one second;

[0014] S102: Each segment is bandpass filtered from 0.5 to 45 Hz to remove low-frequency drift and high-frequency electromyography artifacts;

[0015] S103: Perform Z-score normalization to scale the signal amplitudes of different channels and different acquisition segments to a uniform scale.

[0016] In a preferred embodiment of the present invention, in step S2, the dual-branch encoder includes a time-domain waveform branch, a time-frequency domain rhythm branch, and a feature fusion module;

[0017] The time-domain waveform branch uses a one-dimensional residual network, and the input data is a pre-processed enhanced one-dimensional time-series signal, which is used to extract the fine time dynamic information of the data.

[0018] The time-frequency domain rhythm branch adopts a two-dimensional convolutional neural network. The input data is a one-dimensional time-series signal, which is converted into a logarithmic spectrum through short-time Fourier transform to extract the topological structure information of the data.

[0019] The feature fusion module concatenates the feature vectors extracted from the time-domain waveform branch and the time-frequency domain rhythm branch to form a unified comprehensive feature X1 or X2, providing a robust combined feature vector with complementary cross-modal information.

[0020] Furthermore, the temporal waveform branch includes an initial convolutional layer, an initial batch normalization layer, an activation function, a first convolutional layer, a first batch normalization layer, and a max pooling layer connected in sequence. Then, a deep network is constructed through four residual layers and basic modules to extract abstract features from different levels. Then, through adaptive average pooling, the variable-length time dimension output by the fourth residual layer is aggregated into a single dimension to generate a fixed-size channel feature vector. This channel feature vector is flattened into a one-dimensional feature vector, and finally, features are reconstructed through a fully connected layer.

[0021] Furthermore, the basic module includes an initial convolutional layer, a first batch normalization layer, an activation function, a second convolutional layer, a second batch normalization layer, and an SE attention module. The internal batch normalization is used to continuously stabilize the distribution of deep features, and the SE attention module dynamically calibrates the channel feature weights.

[0022] Furthermore, the time-frequency domain rhythm branch includes a first convolutional layer, a first batch of normalized layers, a first pooling layer, a second convolutional layer, a second batch of normalized layers, and a second pooling layer connected in sequence. Then, the two-dimensional data is converted into a one-dimensional vector through adaptive two-dimensional average pooling to prepare for mapping; finally, it is mapped by a fully connected layer.

[0023] In a preferred embodiment of the present invention, in step S2, the contrast loss is a standardized temperature-adjusted cross-entropy loss. In this way, the encoder is trained to cluster semantically similar signals, i.e., pure signals under different artifact interference, at close positions in the feature space, as shown in the following formula:

[0024] ,

[0025] in, and Let sim(·) be the feature vector of the positive sample pairs output by the projection head, and let cosine similarity be the similarity. This is the temperature parameter, and N is the batch size. and It represents any two feature vectors from all 2N samples in the current batch.

[0026] In a preferred embodiment of the present invention, the classification head consists of a linear layer and a Softmax activation function, used to output the probabilities of two categories: resting state and artifact.

[0027] In a preferred embodiment of the present invention, in step S3, the formula for the hybrid loss function is as follows:

[0028]

[0029] in, It is a classification loss, using focus loss, which introduces a modulation factor and balanced weights to make the model pay more attention to samples that are difficult to classify; λ is the contrast loss term, and λ is a balancing hyperparameter.

[0030] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is: to provide a resting EEG quality assessment system based on bi-branch contrastive learning, comprising:

[0031] The data acquisition and preprocessing module is used to acquire the raw EEG signal X, perform data preprocessing, and augment the preprocessed data to generate two different augmented views as the raw data input to the self-supervised learning pre-training module.

[0032] The self-supervised learning pre-training module is used to feed the two different augmented views into the dual-branch encoder in parallel, extract time-domain waveform and time-frequency domain rhythm features respectively, and perform deep fusion. The fused features X1 and X2 are fed into the projection head, and the network weights are optimized by using contrastive loss through a self-supervised contrastive learning mechanism.

[0033] The self-supervised fine-tuning module is used to take a small number of labeled fine-tuning datasets containing X and corresponding labels y, which are fed into a two-branch encoder loaded with pre-trained weights and then directly into a classification head connected to the two-branch encoder to output the quality prediction results of the input data segment. The optimization process uses a hybrid loss function including classification loss and contrastive loss for training.

[0034] The beneficial effects of this invention are as follows: To address the shortcomings of existing EEG artifact processing techniques in online and real-time scenarios, which fail to meet the demands and rely heavily on manually labeled data, and to overcome the stringent requirements of standardized modeling on the purity and cross-sample consistency of large-scale resting-state data, this invention proposes a novel dual-branch contrastive self-supervised learning framework (DBC-SSL) aimed at achieving efficient online EEG quality control. By designing a sophisticated self-supervised learning objective, the model jointly learns the multi-channel temporal dynamic features and multi-channel time-frequency topological features of EEG signals. By comparing "normal" and "abnormal" spatiotemporal patterns in the feature space, the self-supervised framework can learn a robust representation of "clean" EEG signals. Advantages include:

[0035] (1) Achieving deep fusion of cross-domain features: For the first time in EEG quality assessment, a dual-branch encoder (1D-ResNet and 2D-CNN) was used to extract time-domain and time-frequency domain features in parallel, breaking the bottleneck of traditional single-branch (time-series or frequency-domain) feature extraction and significantly improving the discriminative ability and robustness of features;

[0036] (2) Significantly reduce reliance on manual annotation: By introducing self-supervised contrastive learning for pre-training, the model can efficiently learn general feature representations from large-scale unlabeled data, greatly reducing the need for expensive and sparse manually labeled data;

[0037] (3) Real-time evaluation capability (low latency): The model is lightweight and efficient. Experiments have verified that its single inference latency is extremely low. This performance fully meets the requirements of the BCI system for millisecond-level instant feedback, providing a solid foundation for the deployment of the model to online and real-time quality control applications. Attached Figure Description

[0038] Figure 1 This is a schematic diagram of the framework of the resting EEG quality assessment method based on bi-branch contrastive learning of this invention;

[0039] Figure 2 This is an architecture diagram of the dual-branch encoder;

[0040] Figure 3 This is a schematic diagram illustrating the results of visual analysis of the learned feature embeddings using two dimensionality reduction methods, t-SNE and UMAP.

[0041] Figure 4 This is a structural block diagram of the resting EEG quality assessment system based on bi-branch contrastive learning. Detailed Implementation

[0042] The preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby providing a clearer and more explicit definition of the scope of protection of the present invention.

[0043] Please see Figure 1 The embodiments of the present invention include:

[0044] A resting EEG quality assessment method based on bibranch contrastive learning includes the following steps:

[0045] S1: Acquire the raw EEG signal X for data preprocessing, perform data augmentation on the preprocessed data, and generate two different augmented views as the raw data input to the dual-branch encoder;

[0046] Specifically, the data preprocessing process includes: segmenting the data stream into second-by-second segments, transforming the continuous acquisition data into discrete input units of a fixed time length acceptable to the model. Then, it undergoes a 0.5-45Hz bandpass filter to remove low-frequency drift and high-frequency electromyography artifacts. Finally, Z-score normalization is performed to uniformly scale the signal amplitudes of different channels and acquisition segments to the same scale, which helps stabilize model training, accelerate convergence, and improve the model's generalization ability. This data serves as the original input data for data augmentation.

[0047] The data augmentation strategy randomly selects one application, including: time warp, Gaussian noise, frequency filtering, random pruning, and amplitude scaling.

[0048] S2: The two different enhanced views are fed into the dual-branch encoder in parallel to extract time-domain and time-frequency domain features respectively, and then deeply fused. The fused features X1 and X2 are fed into the projection head, and the network weights are optimized by using the contrast loss through a self-supervised contrastive learning mechanism.

[0049] This invention employs a unique dual-branch encoder architecture for deep fusion and enhancement of cross-domain features, overcoming the limitations of single-feature modeling. The input data comes from preprocessed enhanced data. Combined with... Figure 2 The architecture of the dual-branch encoder will now be described in detail.

[0050] The dual-branch encoder includes a time-domain waveform branch, a time-frequency domain rhythm branch, and a feature fusion module.

[0051] The time-domain waveform branch employs a one-dimensional residual network, with input data being a preprocessed one-dimensional time-series signal [B,C,T] (B representing batch size, C representing the number of channels, and T representing the dimension), used to extract fine-grained temporal dynamic information from the waveform data; the specific process includes:

[0052] First, the 35-dimensional channels are reduced to a standard 32-dimensional channel through initial convolutional layers and initial batch normalization layers, resulting in a shape of [B, 32, 1024]. This channel dimensionality reduction and feature mapping preserves cross-channel semantics (such as information about the collaborative work of different brain regions) while unifying channel dimensions. Batch normalization stabilizes the initial feature distribution, accelerates the convergence speed of neural network training, and overcomes the gradient vanishing problem. Next, long-term dependency capture and downsampling are performed through the first convolutional layer, outputting [B, 64, 512]. In this example, the first convolutional layer uses a large kernel convolution. Then, pooling layers further compress the sequence to 256, reducing computation and sequence length, and providing some translation invariance to the features. Finally, a deep network is constructed using four residual layers and a base module to extract abstract features at different levels. The base module is the smallest core building block of the one-dimensional residual network architecture, responsible for the iterative extraction and optimization of deep features. The basic module integrates key components: batch normalization continuously stabilizes the distribution of deep features, and the SE attention module dynamically and adaptively calibrates channel feature weights to enhance the model's representational ability. The core mechanism of the temporal waveform branch is the residual connection, which directly adds the module's input features to the SE module's output via a shortcut path, effectively solving the gradient vanishing problem in deep network training. Specifically, residual layers 2, 3, and 4 perform a downsampling operation with a stride of 2 in the first basic module of residual layer 1, halving the sequence length and doubling the number of channels (ultimately reaching 512 dimensions) to extract higher-level abstract features. Therefore, the basic module's internal batch normalization continuously stabilizes the distribution of deep features, the SE attention module dynamically calibrates channel feature weights, and the residual connection solves the gradient vanishing problem. Then, through adaptive average pooling, the variable-length time dimension output of residual layer 4 is aggregated into a single dimension (length 1), generating a fixed-size channel feature vector. The output features are then flattened to [B, 512]. Finally, features are reconstructed through a fully connected layer, which is used to improve the model's generalization ability and enhance the robustness of features.

[0053] The time-frequency domain rhythm branch employs a two-dimensional convolutional neural network. The input data is a one-dimensional time-series signal [B, 35, 1024]. First, the time-series data of the 35 electrodes is converted into a time-frequency matrix through a short-time Fourier transform (STFT). These time-frequency matrices are logarithmically processed and uniformly scaled to a fixed size of 64×64. The final input data dimension is [B, 1, 64, 64], where 1 represents a single-channel grayscale spectrum, used to extract the average frequency domain dynamics and macroscopic time-frequency structure features across channels. The specific process includes:

[0054] The processed data [B,1,64,64] is obtained. The data [B,32,32,32] is output through the first convolutional layer and the first pooling layer to extract low-level local patterns and texture features in the time-frequency domain, and to provide translation invariance of the features. Then, the output [B,64,16,16] is output through the second convolutional layer and the second pooling layer to capture higher-level, discriminative time-frequency topology and spatial patterns, ensuring the robustness of feature extraction. Then, the feature map size is standardized to a fixed size [B, 64, 4, 4] through adaptive two-dimensional average pooling. This data is flattened to [64×16×16] through feature flattening, converting the two-dimensional data into a one-dimensional vector to prepare for mapping. Finally, the linear layer maps the data, and the output feature shape is [B,512].

[0055] The feature fusion module concatenates the feature vectors extracted from the time-domain waveform branch and the time-frequency domain rhythm branch to form a unified 1×1024 comprehensive feature X1 or X2, providing a robust combined feature vector with cross-modal information complementarity.

[0056] The combined feature vectors are mapped to a low-dimensional latent space via a projection head, which in this example employs a multilayer perceptron. In the latent space, a normalized temperature-scaled cross-entropy loss (NT-Xent loss) is applied. This loss function aims to maximize the similarity (e.g., cosine similarity) between the projected representations of a positive sample pair (i.e., X1 and X2, the outputs of two augmented views from the same original signal via a dual-branch encoder), while minimizing its similarity to the representations of all other samples (negative samples) within the batch. In this way, the encoder is trained to cluster semantically similar signals (i.e., clean signals under different artifact interference) at close proximity in the feature space. The formula is as follows:

[0057]

[0058] in, and Let sim(·) be the feature vector of the positive sample pairs output by the projection head, and let cosine similarity be the similarity. This is the temperature parameter, and N is the batch size. and It represents any two feature vectors from all 2N samples in the current batch.

[0059] The self-supervised learning pre-trained model utilizes a large amount of unlabeled EEG data to learn robust feature representations. The data stream begins with a raw EEG segment (X), which generates two distinct "views" through random data augmentation techniques (such as temporal warping and noise), forming a positive sample pair. These two views are then fed in parallel into a dual-branch encoder to extract temporal and time-frequency domain features, respectively, and then deeply fused. The fused features are fed into a projection head, and finally, a self-supervised contrastive learning mechanism is used to optimize the network weights using a contrastive loss (normalized temperature-adjusted cross-entropy loss). The goal of this process is to maximize the similarity between the two views from the same raw segment while minimizing their similarity to other samples within the batch, thereby constructing a well-structured feature distribution in the latent space, making the model invariant to artifacts and noise perturbations.

[0060] S3: A small number of labeled fine-tuning datasets containing X and corresponding labels y are used. After passing through a two-branch encoder loaded with pre-trained weights, the dataset is directly fed into a classification head connected to the two-branch encoder to output the quality prediction results of the input data segment. The optimization process uses a hybrid loss function including classification loss and contrastive loss for training.

[0061] The self-supervised fine-tuning model loads all the weights of the pre-trained dual-branch encoder, meaning the model has mastered the ability to extract robust, general features from EEG. The data input source is switched to a small, labeled fine-tuning dataset (containing X and its corresponding label y). This data stream, after passing through the dual-branch encoder which inherits the pre-trained weights, is directly fed into a new classification head to output predictions. Specifically, the model architecture freezes the pre-trained dual-branch encoder weights, removes the projection head, and connects a new, lightweight classification head after the dual-branch encoder. This classification head typically consists of a linear layer and a softmax activation function, used to output the probabilities of the two classes ("resting", "artifact").

[0062] During the optimization process, the model employs a hybrid loss: it includes a dominant focus loss to guide classification and retains a small, temperature-adjusted cross-entropy loss as a regularization term, ensuring that the intrinsic quality of the feature representation does not degrade while learning specific classification boundaries, ultimately achieving efficient and accurate quality assessment.

[0063] Figure 1 The center-focus loss is an improvement on the standard cross-entropy loss. By introducing a modulation factor and balancing weights, it can effectively solve the problem of high class imbalance, prompting the model to focus its training on those hard-to-classify samples.

[0064]

[0065] It represents the probability that the model correctly predicts the true label. It is a modulation factor that reduces the loss contribution of easily classified samples. It involves balancing the weights to account for the difference in the number of positive and negative samples. Typically, the weights of the majority class (such as the negative class) in the dataset are reduced to prevent them from dominating the training process.

[0066] The hybrid loss function is used for end-to-end training of the entire model using a small amount of labeled EEG data, and the optimization process employs a hybrid loss function:

[0067]

[0068] in, It is a classification loss, specifically a focus loss. Focus loss addresses the data imbalance problem by making the model focus more on samples that are difficult to classify. λ is the contrastive loss term, which acts as a regularization term to ensure that, during supervised training, the features learned by the model in the latent space still maintain good intra-class aggregation and inter-class separation properties. λ is a balancing hyperparameter.

[0069] In practical applications, the trained model is deployed to an online system. This system receives data streams in real time from EEG acquisition devices (such as the Curry8 software server) via protocols such as TCP / IP, buffers the data, and segments it into fixed-length segments (e.g., 1 second). Each segment undergoes standardized preprocessing (e.g., filtering, Z-score normalization) before being fed into the trained DBC-SSL model. The model performs rapid forward propagation, instantly outputting the quality label ("resting state" or "artifact") for that data segment. Due to the model's lightweight and efficient design, the latency for a single inference is extremely low (e.g., 6.05ms), fully meeting the requirements for online real-time feedback.

[0070] To demonstrate the effectiveness of the DBC-SSL framework of this invention, its performance is compared with several state-of-the-art deep learning methods in this example. Given the lack of standardized public datasets for the specific task of this invention, this invention selects methods that address different downstream tasks, such as motor imagery classification (MI), automatic sleep stages (ASS), emotion detection (ED), and automatic detection of schizophrenia patients (CAD) in brain-computer interfaces, but which share common classification task objectives and methodological foundations with the resting-apocryphal recognition (AC) task of this invention in terms of deep learning and time-frequency analysis. See Table 1.

[0071] Table 1 Performance Comparison

[0072]

[0073] To comprehensively evaluate the effectiveness of the DBC-SSL framework of this invention in EEG signal quality assessment tasks, it was compared with several mainstream and representative artifact detection / removal models as baselines. These included the classic semi-supervised method IClable based on Independent Component Analysis (ICA), the commonly used end-to-end temporal signal recognition network UNet, CNN-LSTM combining convolutional networks and long short-term memory networks, and the lightweight and efficient deep supervised model EEGNet. Validation was performed on the same dataset, and the results clearly demonstrate that the DBC-SSL framework of this invention exhibits superiority across all key performance indicators, as shown in Table 2.

[0074] Table 2 Baseline Comparison

[0075]

[0076] This invention also includes a comprehensive ablation study, systematically evaluating the contribution of each network module. The results, shown in Table 3, reveal a significant synergistic effect of the dual-branch encoder architecture. When using the one-dimensional ResNet (1D-ResNet) and two-dimensional CNN (2D-CNN) branches individually, the F1 scores are 84.24 and 86.65, respectively. Their combination significantly boosts the F1 score to 91.91. This indicates that fusing the temporal dynamic features from 1D-ResNet with the time-frequency topological features from 2D-CNN comprehensively improves the model's performance. Furthermore, the integration of self-supervised pre-training significantly enhances the model's performance, increasing the F1 score of the dual-branch encoder architecture from 91.91 to 94.93.

[0077] Table 3 Ablation Experiment

[0078]

[0079] To demonstrate the effectiveness of the example pre-training of this invention, the learned feature embeddings were visualized using two dimensionality reduction methods: t-SNE and UMAP. The results are as follows: Figure 3 As shown, the UMAP results in the left figure demonstrate that the model clearly separates "resting" and "artifact" samples into two main and well-defined clusters at the global scale, while the t-SNE results in the right figure verify the compactness and high consistency of the model's features for similar samples at the local scale. Both results strongly demonstrate that the DBC-SSL encoder can learn robust feature representations with good artifact discrimination capabilities.

[0080] Compared with the prior art, the present invention has the following significant advantages:

[0081] 1. Real-time online quality control is achieved: The model proposed in this invention has extremely low inference latency (experimentally verified to be 6.05ms), enabling real-time quality assessment and labeling of the acquired EEG data stream second by second. This solves the problem that traditional methods cannot be applied online, providing technical support for data quality at the application level for application scenarios requiring low calibration time, plug-and-play functionality, and instant feedback (such as closed-loop brain-computer interfaces and real-time neurofeedback training).

[0082] 2. Significantly reduces reliance on manually labeled data: Through an innovative self-supervised pre-training phase, the model can learn deep and robust feature representations of resting EEG signals from a large amount of unlabeled data. Subsequent fine-tuning requires only a very small amount of labeled data, greatly reducing the cost and time required for model development and solving the most significant "labeled data bottleneck" problem in supervised learning methods.

[0083] 3. Higher classification accuracy and robustness: The invention's unique dual-branch encoder structure can simultaneously extract and deeply fuse complementary feature information from EEG signals in both the time and time-frequency domains. Compared to models relying on only a single feature domain, this scheme can form a more comprehensive and discriminative feature representation, thus achieving higher accuracy in artifact recognition tasks (experimentally verified to reach 94.99%), and the model has stronger robustness to various signal perturbations.

[0084] See Figure 4 This invention also provides a resting EEG quality assessment system based on bi-branch contrastive learning, including a data acquisition and preprocessing module, a self-supervised learning pre-training module, and a self-supervised fine-tuning module.

[0085] The data acquisition and preprocessing module is used to acquire the original EEG signal X, perform data preprocessing, perform data augmentation on the preprocessed data, and generate two different augmented views as the original data input to the self-supervised learning pre-training module.

[0086] The self-supervised learning pre-training module is used to feed the two different augmented views into the dual-branch encoder in parallel, extract time-domain waveform and time-frequency domain rhythm features respectively, and perform deep fusion. The fused features X1 and X2 are fed into the projection head, and the network weights are optimized by using contrastive loss through a self-supervised contrastive learning mechanism.

[0087] The self-supervised fine-tuning module is used to take a small number of labeled fine-tuning datasets containing X and corresponding labels y, which are fed into a dual-branch encoder loaded with pre-trained weights and then directly fed into a classification head connected to the dual-branch encoder to output the quality prediction results of the input data segment. The optimization process uses a hybrid loss function including classification loss and contrastive loss for training.

[0088] This example illustrates a resting EEG quality assessment system based on bi-branch contrastive learning, which can execute the resting EEG quality assessment method based on bi-branch contrastive learning provided by this invention. It can perform any combination of the steps in the method example and possesses the corresponding functions and beneficial effects of the method.

[0089] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for assessing resting EEG quality based on bibranch contrastive learning, characterized in that, Includes the following steps: S1: Acquire the raw EEG signal X for data preprocessing, perform data augmentation on the preprocessed data, and generate two different augmented views as the raw data input to the dual-branch encoder; S2: The two different enhanced views are fed into the dual-branch encoder in parallel to extract time-domain waveform and time-frequency domain rhythm features respectively, and then deeply fused. The fused features X1 and X2 are fed into the projection head, and the network weights are optimized by using contrast loss through a self-supervised contrastive learning mechanism. S3: A small number of labeled fine-tuning datasets containing X and corresponding labels y are used. After passing through a two-branch encoder loaded with pre-trained weights, the dataset is directly fed into a classification head connected to the two-branch encoder to output the quality prediction results of the input data segment. The optimization process uses a hybrid loss function including classification loss and contrastive loss for training.

2. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 1, characterized in that, In step S1, the data preprocessing of the raw EEG signal X includes: S101: Divide the acquired raw EEG signal X into discrete segments of fixed duration, segmented by one second; S102: Each segment is bandpass filtered from 0.5 to 45 Hz to remove low-frequency drift and high-frequency electromyography artifacts; S103: Perform Z-score normalization to scale the signal amplitudes of different channels and different acquisition segments to a uniform scale.

3. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 1, characterized in that, In step S2, the dual-branch encoder includes a time-domain waveform branch, a time-frequency domain rhythm branch, and a feature fusion module; The time-domain waveform branch uses a one-dimensional residual network, and the input data is a preprocessed enhanced one-dimensional time-series waveform signal, which is used to extract the fine time dynamic information of the data. The time-frequency domain rhythm branch adopts a two-dimensional convolutional neural network. The input data is a one-dimensional time-series signal, which is converted into a logarithmic spectrum through short-time Fourier transform to extract the frequency domain rhythm information of the data that changes dynamically with time. The feature fusion module concatenates the feature vectors extracted from the time-domain waveform branch and the time-frequency domain rhythm branch to form a unified comprehensive feature X1 or X2, providing a robust combined feature vector with complementary cross-modal information.

4. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 3, characterized in that, The temporal waveform branch includes an initial convolutional layer, an initial batch normalization layer, an activation function, a first convolutional layer, a first batch normalization layer, and a max pooling layer connected in sequence. Then, a deep network is constructed through four residual layers and basic modules to extract abstract features at different levels. Then, through adaptive average pooling, the variable-length time dimension output by the fourth residual layer is aggregated into a single dimension to generate a fixed-size channel feature vector. This channel feature vector is flattened into a one-dimensional feature vector, and finally, features are reconstructed through a fully connected layer.

5. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 4, characterized in that, The basic module includes an initial convolutional layer, a first batch normalization layer, an activation function, a second convolutional layer, a second batch normalization layer, and an SE attention module. Internal batch normalization is used to continuously stabilize the distribution of deep features, and the SE attention module dynamically calibrates the channel feature weights.

6. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 3, characterized in that, The time-frequency domain rhythm branch includes a first convolutional layer, a first batch of normalized layers, a first pooling layer, a second convolutional layer, a second batch of normalized layers, and a second pooling layer connected in sequence. Then, the two-dimensional data is converted into a one-dimensional vector through adaptive two-dimensional average pooling to prepare for mapping. Finally, the mapping is performed by a fully connected layer.

7. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 1, characterized in that, In step S2, the contrast loss employs a standardized temperature-adjusted cross-entropy loss. This method trains the encoder to cluster semantically similar signals—that is, clean signals under different artifact interference—at similar positions in the feature space, as shown in the following formula: , in, and Let sim(·) be the feature vector of the positive sample pairs output by the projection head, and let cosine similarity be the similarity. This is the temperature parameter, and N is the batch size. and It represents any two feature vectors from all 2N samples in the current batch.

8. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 1, characterized in that, The classification head consists of a linear layer and a Softmax activation function, used to output the probabilities of the resting state and artifact categories.

9. The method for assessing resting EEG quality based on bi-branch contrastive learning according to claim 1, characterized in that, In step S3, the formula for the hybrid loss function is as follows: , in, It is a classification loss, using focus loss, which introduces a modulation factor and balanced weights to make the model pay more attention to samples that are difficult to classify; λ is the contrast loss term, and λ is a balancing hyperparameter.

10. A resting EEG quality assessment system based on bi-branch contrastive learning, characterized in that, include: The data acquisition and preprocessing module is used to acquire the raw EEG signal X, perform data preprocessing, and augment the preprocessed data to generate two different augmented views as the raw data input to the self-supervised learning pre-training module. The self-supervised learning pre-training module is used to feed the two different augmented views into the dual-branch encoder in parallel, extract time-domain waveform and time-frequency domain rhythm features respectively, and perform deep fusion. The fused features X1 and X2 are fed into the projection head, and the network weights are optimized by using contrastive loss through a self-supervised contrastive learning mechanism. The self-supervised fine-tuning module is used to take a small number of labeled fine-tuning datasets containing X and corresponding labels y, which are fed into a two-branch encoder loaded with pre-trained weights and then directly into a classification head connected to the two-branch encoder to output the quality prediction results of the input data segment. The optimization process uses a hybrid loss function including classification loss and contrastive loss for training.

Citation Information

Patent Citations

  • Emotion recognition method and system based on generative self-supervised learning and electroencephalogram signals

    CN115590515A

  • Emotion analysis method based on multi-modal comparative learning individual focusing model

    CN120724066A