A general EEG signal representation learning system based on dynamic multi-scale mechanisms
The EEG signal representation learning system based on a dynamic multi-scale mechanism solves the problems of cross-device adaptability and multi-scale feature extraction, achieving seamless adaptability and efficient feature extraction across different devices, and improving the robustness and linear separability of the model.
Patent Information
- Application Number
- CN202610195517.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-11
- Publication Date
- 2026-05-26
AI Technical Summary
Existing EEG signal processing models are difficult to adapt to changes in electrode configurations across different devices, cannot effectively capture multi-scale time-frequency features, and lack sufficient linear separability of pre-trained features, limiting their applicability across devices and tasks.
A general EEG signal representation learning system based on a dynamic multi-scale mechanism is adopted, including a data preprocessing and enhancement module, a multi-scale block embedding module, and a dynamic decomposition attention mechanism. It is trained through a hybrid generative-discriminative self-supervised pre-training framework to achieve cross-device adaptability and multi-scale feature extraction.
It achieves seamless adaptability of the model across different devices, effectively captures transient high-frequency anomalies and persistent low-frequency rhythms, improves the linear separability and robustness of features, and reduces the dependence on labeled data and full parameter fine-tuning.
Smart Images

Figure CN122087436A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of electroencephalogram (EEG) signal processing and artificial intelligence, and in particular to a general EEG signal representation learning system based on a dynamic multi-scale mechanism. Background Technology
[0002] Electroencephalography (EEG), as a non-invasive neuroimaging technique, has been widely used in epilepsy diagnosis, sleep staging, and brain-computer interfaces due to its millisecond-level temporal resolution and portability. However, EEG signals inherently possess extremely low signal-to-noise ratios, non-stationarity, and significant inter-subject variability, making the construction of robust decoding systems extremely challenging. Traditional EEG analysis primarily relies on supervised learning paradigms, where models are typically trained from scratch on small datasets specific to a particular task. This approach not only heavily depends on expensive and difficult-to-obtain expert-annotated data, but the trained models are often limited to a single domain, making it difficult to generalize the learned representations to new tasks or subjects.
[0003] In recent years, inspired by the success of large language models, self-supervised learning EEG models based on large-scale unlabeled data have emerged. Despite their potential, these models still face significant hardware heterogeneity barriers in practical applications. Clinical and research EEG acquisition devices differ significantly in terms of channel number, electrode layout, sampling rate, and hardware characteristics. Existing model architectures typically rely on preset channel sequences or fixed positional encodings, making them only applicable to specific device configurations used during training and difficult to generalize to data acquired from other devices, thus limiting their applicability across different devices. When faced with changes in channel number or layout, these models often require interpolation or zero-padding, which not only increases computational burden but may also introduce artifacts, further limiting the model's versatility across different devices.
[0004] Furthermore, existing basic models also have limitations in feature extraction scale. EEG signals contain coupled oscillations across multiple frequency bands and have a complex multi-scale spatiotemporal structure. However, most of the mainstream methods published so far employ a single-scale tokenization strategy, which imposes a static temporal resolution. This design has an inherent bias: it struggles to simultaneously capture high-frequency transient abnormal activities and model low-frequency long-range dependencies, failing to comprehensively analyze broadband neurodynamic features.
[0005] Finally, in designing pre-training objectives, existing technologies typically employ a single optimization goal, leading to insufficient robustness and usability of the representations. For example, mask-based reconstruction methods focus on recovering local morphological details but often lack semantic separability; while simple contrastive learning, although capable of capturing global semantics, sacrifices fine-grained temporal fidelity crucial for clinical diagnosis. This single-perspective deficiency causes existing models to heavily rely on full-parameter fine-tuning in downstream tasks. Their frozen-parameter features perform poorly in linear probing tasks, indicating a lack of inherent linear separability and making them unsuitable as truly general-purpose feature extractors for efficient application in resource-constrained scenarios. Summary of the Invention
[0006] In view of this, the purpose of this invention is to provide a general EEG signal representation learning system based on a dynamic multi-scale mechanism, which can adapt to different acquisition devices, capture multi-scale time-frequency features and has excellent linear separability.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: a general EEG signal representation learning system based on a dynamic multi-scale mechanism, comprising a data preprocessing and enhancement module, a multi-scale block embedding module, and an encoder containing a dynamic decomposition attention mechanism connected in sequence; the system is trained through a hybrid generative-discriminative self-supervised pre-training framework;
[0008] The data preprocessing and enhancement module is configured to: segment and standardize the input continuous EEG signal, apply a probability enhancement strategy to generate two enhanced views of the same signal, and simultaneously implement structured masking on the time blocks;
[0009] The multi-scale block embedding module is configured to: process the input signal using at least two sets of parallel convolution kernels of different scales to extract multi-scale time-frequency features, and then splice and project the extracted features, adding them to the channel and time position embeddings obtained from dynamic slicing in the global parameter library to generate an initial latent representation.
[0010] The encoder, which includes a dynamic decomposition attention mechanism, is configured to sequentially perform temporal causal modeling and dynamic channel grouping spatial attention modeling on the initial latent representation to extract spatiotemporal features.
[0011] In a preferred embodiment, the workflow of the data preprocessing and enhancement module is as follows: First, the input continuous EEG signal is segmented into non-overlapping time windows to form tensors. ,in For batch size, For the number of channels, The number of time blocks. The time dimension of each block is defined; then, the signal is standardized and a probability enhancement strategy is applied, including random time shift, channel dropping, and Gaussian noise injection; finally, a structured masking strategy is used to retain only a portion of the visible signal input to the encoder, forcing the model to use contextual information to predict the missing parts.
[0012] In a preferred embodiment, the multi-scale block embedding module comprises three sets of parallel convolutional streams, employing small-scale, medium-scale, and large-scale convolutional kernels, respectively. The input signal is processed to capture broadband dynamic characteristics ranging from transient high-frequency waveforms to sustained low-frequency rhythms. Represents the convolution kernel for small-scale convolution. The kernel representing a mesoscale convolution. The convolution kernel represents a large-scale convolution; the output of each convolutional stream is processed by GELU activation and pooling to obtain a feature vector. :
[0013] (1)
[0014] In the formula, Indicates input data, For the set of convolution kernel sizes, For a specific kernel size in the set, This represents the corresponding one-dimensional convolution operation. Indicates pooling operation;
[0015] Multi-scale features are concatenated and projected onto the time dimension. Explicit slice location embedding is used; the model maintains a global parameter library. During forward propagation, based on the actual number of channels of the current input data. and number of time blocks The initial latent representation is obtained by dynamically slicing the data from the parameter library and registering the corresponding positional embeddings, and then adding them to the projected multi-scale features. :
[0016]
[0017] In the formula, Linear represents projecting the concatenated multi-scale feature vectors onto a linear transformation layer in the time dimension; it decouples the model parameters from specific hardware configurations, enabling the model to learn general representations independently of the number of channels.
[0018] In a preferred embodiment, the dynamically decomposed attention mechanism in the encoder decomposes spatiotemporal modeling into temporal and spatial flows. First, temporal causal modeling is performed, utilizing multi-head self-attention to independently process the features of each electrode along the time axis, capturing long-range temporal dependencies. The calculation formula is as follows:
[0019]
[0020] In the formula, This represents the intermediate feature tensor after processing along the time dimension. These are the output features of the previous layer. This indicates a multi-head self-attention operation applied along the time axis;
[0021] Secondly, dynamic channel grouping attention employs a dimension-independent grouping strategy. Each channel is dynamically divided into Groups, among which Determine the group size and compute spatial attention within each group; slice and reshape the feature tensor to obtain grouped features. And spatial attention was applied within the group to achieve :
[0022]
[0023]
[0024] In the formula, (*) indicates a feature slice in the channel group. The input tensor after time attention processing. This indicates a spatial multi-head self-attention operation performed within the group. The spatial features of the output for this group; attention computation is performed only in each group. Internally, it models dense local dependencies;
[0025] Finally, the groups are combined to restore the original structure:
[0026] Where FFN(*) represents a feedforward neural network, (*) indicates a splicing operation.
[0027] In a preferred embodiment, the hybrid generative-discriminative self-supervised pre-training framework comprises a hybrid loss function for three sub-objectives:
[0028] First, minimize the reconstructed signal and mask blocks. The original clear signal on Mean square error between:
[0029]
[0030] In the formula, Indicates the loss in morphological reconstruction. The cardinality of the set of time blocks to be masked. This represents the final latent feature tensor output by the encoder. For time-domain reconstruction projection head, Indicates the first The original clear EEG signal corresponding to each mask position Indicates mean square error;
[0031] Secondly, the latent representation is projected into the frequency domain and supervised using the logarithmic magnitude of the short-time Fourier transform of the target signal:
[0032]
[0033] In the formula, This represents the spectral density regression loss. For frequency domain projection head, Indicates the first The original signal at each mask position Perform a short-time Fourier transform. This indicates the calculation of the logarithmic amplitude spectrum. Indicates the mean absolute error;
[0034] Furthermore, instance-level contrastive learning is employed; two augmented views of the same EEG fragment are treated as positive sample pairs. Optimize NT-Xent loss:
[0035]
[0036] In the formula, This represents the semantic contrast alignment loss. For batch size, and This represents the potential representation of the same EEG segment in two views after different enhancements. This represents the function for calculating cosine similarity. For temperature parameters, For indicator functions;
[0037] The ultimate optimization goal is a weighted synergy of these three perspectives:
[0038] In the formula, Denotes the overall optimization objective function. , , These are the weight coefficients for morphological reconstruction loss, spectral density regression loss, and semantic contrast loss, respectively.
[0039] Compared with existing technologies, this invention has the following advantages: This technical solution can seamlessly adapt to EEG devices with different channel numbers and layouts, effectively balancing the capture of transient high-frequency anomalies and continuous low-frequency rhythms. The hybrid pre-training strategy significantly improves the quality of potential representations and reduces the dependence of downstream tasks on large amounts of labeled data and full parameter fine-tuning. It can be used for epileptic seizure detection, abnormal EEG screening, automated sleep staging, etc. Attached Figure Description
[0040] Figure 1 This is a pre-training framework diagram of a preferred embodiment of the present invention.
[0041] Figure 2 This is a model structure diagram of a preferred embodiment of the present invention. Detailed Implementation
[0042] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0043] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, 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 pertains.
[0044] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this application; as used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise; furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0045] This invention aims to address the technical problems of existing EEG models, such as their inability to adapt to varying electrode configurations, difficulty in simultaneously capturing multi-scale time-frequency features, and poor linear separability of pre-trained features. This invention proposes a framework called the Universal Dynamic Multi-Scale Foundation Model (Uni-DMFM), which achieves universal EEG representation learning across devices and tasks through multi-scale block embedding, dynamic channel grouping attention mechanisms, and a hybrid generative-discriminative self-supervised learning strategy. The flowchart of this invention is shown below. Figure 1 and Figure 2 As shown, the specific technical solution is as follows:
[0046] Part 1: Data Preprocessing and Augmentation
[0047] To address the prevalent noise interference and signal non-stationarity issues in EEG data, this invention designs a standardized input processing pipeline. First, the continuous input EEG signal is segmented into non-overlapping time windows, forming tensors. ,in For batch size, For the number of channels, The number of time blocks. The temporal dimension is defined for each block. Next, the signal is standardized, and probabilistic enhancement strategies are applied, including random time shifting, channel dropping, and Gaussian noise injection. These enhancements generate two different views of the same signal, serving two purposes: firstly, to enhance the model's invariance to sensor noise in subsequent contrastive learning tasks; and secondly, to transform the reconstruction task into a denoising task to improve robustness. Finally, a structured masking strategy is employed, randomly masking 60% of the temporal blocks and retaining only a portion of the visible signal input to the encoder, forcing the model to use contextual information to predict the missing parts.
[0048] Part Two: Multi-Scale Block Embedding Module
[0049] To address the multi-scale oscillation characteristics of EEG signals across different frequency bands, this invention constructs a multi-scale block embedding module as the front-end feature extractor of the model, replacing the traditional single-scale embedding. This module contains three sets of parallel convolutional streams, each employing a small-scale (e.g., ...) approach. ), mesoscale (e.g.) ) and large scale (such as ) convolution kernel The input signal is processed to capture broadband dynamic features ranging from transient high-frequency waveforms to sustained low-frequency rhythms. The output of each convolutional stream is processed by GELU activation and pooling to obtain a feature vector. :
[0050] (1)
[0051] Multi-scale features are stitched together and projected onto dimensions. To adapt to variable input dimensions without modifying the architecture, this invention employs explicit slice position embedding. The model maintains a global parameter library. During the forward propagation process, the actual number of channels for the current input data is determined. and number of time blocks The initial latent representation is obtained by dynamically slicing the data from the parameter library and registering the corresponding positional embeddings, and then adding them to the projected multi-scale features. :
[0052]
[0053] This mechanism decouples model parameters from specific hardware configurations, enabling the model to learn general representations independently of the number of channels.
[0054] Part 3: Dynamic Decomposition Attention Mechanism Based on Dynamic Channel Grouping
[0055] To address the high computational complexity and reliance on fixed channel topology inherent in the standard Transformer, this invention designs a dynamic decomposition attention mechanism, decomposing spatiotemporal modeling into temporal and spatial flows. The first step is temporal causal modeling, utilizing multi-head self-attention along the time axis. The characteristics of each electrode are processed independently to capture long-range time dependencies. The calculation formula is as follows:
[0056]
[0057] Secondly, there is dynamic channel grouping attention. To adapt to arbitrary electrode layouts, this invention abandons the fixed adjacency matrix and instead adopts a dimension-independent grouping strategy. Each channel is dynamically divided into Groups (of which) (For group size), and spatial attention is computed within each group. Specifically, the feature tensor is sliced and reshaped to obtain grouped features. And spatial attention was applied within the group to achieve :
[0058] (4)
[0059] (5)
[0060] Attention calculation only occurs in each group Internally, it models dense local correlations. This dynamic slicing mechanism acts as a topology-independent feature aggregator, prioritizing the capture of latent functional connections rather than relying on fixed electrode topologies. Finally, the groups are aggregated to recover the original structure.
[0061]
[0062] This design not only reduces the space complexity to linear, but also enables the model to process EEG data with arbitrary configurations.
[0063] Part 4: Hybrid Generative-Discriminatory Self-Supervised Pre-training Framework
[0064] To ensure that the learned representation has morphological fidelity, spectral accuracy, and semantic separability, this invention constructs a hybrid loss function that includes three sub-objectives.
[0065] First, to ensure the model understands the signal morphology and is robust to artifacts, the reconstructed signal and mask blocks are minimized. The original clear signal on Mean square error between:
[0066]
[0067] Secondly, in order to force the model to encode accurate power spectral density information, the latent representation is projected into the frequency domain and supervised using the logarithmic magnitude of the short-time Fourier transform of the target signal:
[0068]
[0069] Furthermore, to ensure the representations are linearly separable, instance-level contrastive learning is employed. Two augmented views of the same EEG fragment are treated as positive sample pairs. Optimize NT-Xent loss:
[0070]
[0071] The ultimate optimization goal is a weighted synergy of these three perspectives:
[0072]
[0073] This invention possesses significant technical advantages in the field of EEG signal processing. Firstly, regarding architectural versatility, by introducing explicit slice location embedding and dynamic channel grouping mechanisms, it can seamlessly adapt to any number and layout of channels, from low-density portable devices to high-density research equipment. Secondly, in terms of feature extraction capabilities, this product effectively solves the problem of a single time scale being unable to simultaneously capture transient high-frequency anomalies and continuous low-frequency rhythms, comprehensively capturing wideband neurodynamic features through its multi-scale block embedding module. Furthermore, the hybrid generative-discriminatory self-supervised pre-training framework employed in this invention combines temporal morphological reconstruction, frequency domain spectral density regression, and semantic contrast alignment, significantly improving the linear separability and robustness of potential representations.
[0074] In practical applications, this invention, with its powerful generalization and few-sample learning capabilities, has a wide range of uses. In the clinical medical field, it can assist neurologists in detecting epileptic seizures, screening for abnormal electroencephalograms (EEGs), and automating sleep staging. Especially in scenarios where labeled data is scarce, it can achieve high-precision diagnosis with only a small number of samples, effectively reducing reliance on expert annotation. In the field of brain-computer interfaces, this product can be applied to emotion recognition, motor imagery decoding, and cognitive load assessment, providing a stable and reliable neural decoding foundation for human-computer interaction systems. Furthermore, due to its inherent adaptability to hardware heterogeneity, this product is also highly suitable for integrating heterogeneous data from different medical centers and different acquisition devices to build large-scale, cross-center brain science research platforms.
[0075] The application process of this invention mainly includes a pre-training stage and a downstream task application stage. First, in the pre-training stage, the system needs to load a large-scale unlabeled EEG database as basic training data. After segmenting and standardizing continuous EEG signals, a probability enhancement operation is performed to generate two enhanced views of the same signal, and a structured masking operation is applied to the temporal blocks. The processed data is input into a general dynamic multi-scale basic model. The data is mapped to the latent space via a multi-scale block embedding module, and then spatiotemporal features are extracted through a dynamically decomposed attention encoder. During training, the system simultaneously calculates denoising morphological reconstruction loss, spectral density regression loss, and semantic contrast alignment loss. The total loss function is jointly optimized through a backpropagation algorithm, and the model parameters are iteratively updated until convergence, thereby preserving the pre-trained model weights with general representation capabilities.
[0076] Secondly, in the downstream application stage, the target EEG dataset is imported according to the specific scenario (such as sleep staging, epilepsy detection, or brain-computer interface emotion recognition). Standard preprocessing is performed on the raw data, including applying filters to preserve physiological rhythms, using notch filters to remove power line interference, resampling to the model configuration frequency, and standardization. Finally, pre-trained model weights are loaded for inference or fine-tuning. The usage strategy can be selected based on the amount of labeled target data: in scenarios with few samples or rapid deployment, the backbone network parameters are frozen, and only the linear classifier connected to the encoder end is trained; in scenarios pursuing extreme accuracy, end-to-end parameter updates are performed on the entire model. The EEG data to be tested is input into the model, high-dimensional time-frequency features are extracted through forward propagation, and the final prediction result is output through the classification head.
Claims
1. A general-purpose electroencephalogram (EEG) signal representation learning base system based on a dynamic multi-scale mechanism, characterized in that, The system includes a data preprocessing and enhancement module, a multi-scale block embedding module, and an encoder containing a dynamic decomposition attention mechanism, all connected in sequence. The system is trained using a hybrid generative-discriminative self-supervised pre-training framework. The data preprocessing and enhancement module is configured to: segment and standardize the input continuous EEG signal, apply a probability enhancement strategy to generate two enhanced views of the same signal, and simultaneously implement structured masking on the time blocks; The multi-scale block embedding module is configured to: process the input signal using at least two sets of parallel convolution kernels of different scales to extract multi-scale time-frequency features, and then splice and project the extracted features, adding them to the channel and time position embeddings obtained from dynamic slicing in the global parameter library to generate an initial latent representation. The encoder, which includes a dynamic decomposition attention mechanism, is configured to sequentially perform temporal causal modeling and dynamic channel grouping spatial attention modeling on the initial latent representation to extract spatiotemporal features.
2. The general EEG signal representation learning system based on a dynamic multi-scale mechanism according to claim 1, characterized in that, The workflow of the data preprocessing and enhancement module is specifically as follows: first, the input continuous electroencephalogram signal is segmented into non-overlapping time windows to form a tensor wherein is a batch size, is a number of channels, is a number of time blocks, is a time dimension of each block; then, the signal is standardized and a probability enhancement strategy is applied, including random time translation, channel discarding and Gaussian noise injection; finally, a structured mask strategy is adopted to retain only part of the visible signal input into the encoder, forcing the model to predict the missing part using context information.
3. The general EEG signal representation learning system based on a dynamic multi-scale mechanism according to claim 1, characterized in that, The multi-scale patch embedding module contains three sets of parallel convolutional streams, respectively using small, medium and large scale convolution kernels processing the input signal to capture the wide-band dynamics from transient high-frequency waveforms to sustained low-frequency rhythms, convolution kernel representing small-scale convolution, convolution kernel representing medium-scale convolution, convolution kernel representing large-scale convolution; the output of each convolution stream is obtained after GELU activation and pooling operation to obtain a feature vector : (1) wherein, denotes input data, is a set of convolution kernel sizes, is a particular convolution kernel size in the set, denotes a corresponding one-dimensional convolution operation, denotes a pooling operation; Multi-scale features are concatenated and projected into the time dimension , with explicit slice position embedding; the model maintains a global parameter bank ; during the forward propagation process, according to the actual channel number and the time block number of the current input data, the corresponding position embedding is dynamically sliced and registered from the parameter bank, and added to the projected multi-scale features to obtain the initial latent representation : In the formula, Linear represents projecting the concatenated multi-scale feature vectors onto a linear transformation layer in the time dimension; it decouples the model parameters from specific hardware configurations, enabling the model to learn general representations independently of the number of channels.
4. The general electroencephalogram signal representation learning basic system based on a dynamic multi-scale mechanism according to claim 1, characterized in that, The dynamically decomposed attention mechanism in the encoder decomposes spatiotemporal modeling into temporal and spatial flows. First, it performs temporal causal modeling, utilizing multi-head self-attention to independently process the features of each electrode along the time axis, capturing long-range temporal dependencies. The calculation formula is as follows: In the formula, denotes an intermediate feature tensor after time dimension processing, is the output feature of the last layer, denotes a multi-head self-attention operation applied along the time axis; Secondly, dynamic channel grouping attention, which adopts a dimension-independent grouping strategy, dynamically divides one channel into groups, where is the group size, and calculates spatial attention within the group; slice and reshape the feature tensor to get grouped features and apply spatial attention within the group to get : wherein, (*) denotes a characteristic slice of a channel group, is the input tensor after temporal attention processing, denotes a spatial multi-head self-attention operation performed within a group, is the spatial feature output by the group. Attention computation is only performed internally within each group modeling dense local dependencies; Finally, the groups are combined to restore the original structure: where FFN (*) denotes a feed-forward neural network, (*) denotes a concatenation operation.
5. The general electroencephalogram signal representation learning basic system based on a dynamic multi-scale mechanism according to claim 1, characterized in that, The hybrid generative-discriminatory self-supervised pre-training framework includes a hybrid loss function for three sub-objectives: First, minimize the mean square error between the reconstructed signal and the original clean signal on the mask tiles wherein, denotes the morphing reconstruction loss, is the cardinality of the set of masked temporal tiles, denotes the final latent feature tensor of the encoder output, is the temporal reconstruction projection head, denotes the original clean electroencephalography signal at the masking position, denotes the mean squared error; Secondly, the latent representation is projected into the frequency domain and supervised using the logarithmic magnitude of the short-time Fourier transform of the target signal: wherein denotes the spectral density regression loss, is the frequency domain projection head, denotes the short-time Fourier transform of the raw signal at the mask position, denotes the computation of the log-magnitude spectrum, denotes the mean absolute error; In addition, instance-level contrastive learning is adopted; two augmented views of the same EEG segment are treated as positive sample pairs , optimizing NT-Xent loss: In the formula, This represents the semantic contrast alignment loss. For batch size, and This represents the potential representation of the same EEG segment in two views after different enhancements. This represents the function for calculating cosine similarity. For temperature parameters, For indicator functions; The ultimate optimization goal is a weighted synergy of these three perspectives: In the formula, Denotes the overall optimization objective function. , , These are the weight coefficients for morphological reconstruction loss, spectral density regression loss, and semantic contrast loss, respectively.