Electroencephalogram signal visual image reconstruction method, device, equipment and medium

By combining frequency band decomposition and 3D data block construction with 3D modal coding and multi-level temporal coding, the problems of insufficient multidimensional feature expression and unstable cross-modal alignment in the visual reconstruction of EEG signals are solved, and high-quality visual images are generated, which are suitable for scenarios such as visual impairment assistance, mind communication and immersive virtual reality.

CN123181712APending Publication Date: 2026-11-27GUANGDONG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611286439.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-24
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing visual reconstruction methods based on EEG signals suffer from insufficient expression of multidimensional features of EEG signals, lack of visual semantic hierarchical modeling, and unstable cross-modal alignment, resulting in low quality, missing details, and large semantic deviations in the reconstructed images.

Method used

By using frequency band decomposition and three-dimensional data block construction, combined with three-dimensional modal coding path and multi-level temporal coding path, multi-dimensional and temporal features of EEG signals are extracted, and high-quality visual images are generated through hierarchical cross-attention mechanism and triple cross-modal contrastive learning.

Benefits of technology

It achieves high-fidelity visual reproduction, and the generated images have enhanced consistency in outline structure, foreground subject and background scene, with stronger generalization and practicality, and are suitable for scenarios such as visual impairment assistance, mind communication, neurofeedback training and immersive virtual reality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123181712A_ABST
    Figure CN123181712A_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, device, and medium for visual image reconstruction of electroencephalogram (EEG) signals. The method includes: inputting a three-dimensional data block into a three-dimensional modal coding path to extract and fuse high- and low-frequency spatial features to obtain a first feature representation; simultaneously inputting the original signal into a temporal coding path to extract temporal features at three levels: contour, foreground, and context, and obtaining a second feature representation after hierarchical cross-attention integration. The visual stimulus image is processed into three-level images, and image features are extracted and stitched together. Triple contrast learning is performed with the goal of maximizing the pairwise similarity of the three feature representations, and the concatenation of two EEG features is used as a condition to fine-tune the diffusion generation model. During inference, the EEG signal to be reconstructed is processed through two coding paths to extract and stitch features, and then input into the fine-tuned model to generate a reconstructed image. This application significantly improves the detail richness, semantic consistency, and robustness of cross-modal alignment of reconstructed EEG signal images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of visual reconstruction, and more particularly to a method, apparatus, electronic device and computer-readable storage medium for visual image reconstruction of electroencephalogram signals. Background Technology

[0002] With the development of neuroscience and the advancement of brain-computer interface technology, accurately extracting and reconstructing visual information perceived or imagined by humans from brain activity has become a highly anticipated research area. Traditional visual reconstruction methods mainly rely on brain activity data acquired by devices such as functional magnetic resonance imaging (fMRI), but these methods are limited by the high cost, inconvenience, and low temporal resolution of the equipment. In recent years, non-invasive electroencephalograms (EEGs) have been widely used in brain-computer interface research due to their high temporal resolution, relatively low cost, and portability; however, many challenges remain in the reconstruction of visual content based on EEG.

[0003] First, existing methods often lack effective representation of multidimensional features when processing EEG signals, making it difficult to fully utilize the spatial distribution, spectral characteristics, and temporal dynamic information contained in EEG signals, resulting in low-quality reconstructed visual images. For example, when a subject views a photograph of a face, existing systems may only be able to vaguely reconstruct a "rough outline with eyes and a mouth," but cannot accurately present key details such as the position of the nose, the shape of the lips, or the orientation of the face. This information depends on the coordinated response of different brain regions at specific times and frequencies, and traditional methods have failed to fully model this complex relationship.

[0004] Secondly, existing methods are insufficient in modeling the semantic hierarchy of visual information, making it difficult to achieve a complete mapping from low-level visual features (such as edges and textures) to high-level semantic concepts (such as object categories and scene understanding). For example, a system may be able to determine that a user is seeing a "car," but it cannot reproduce the reflection of the car window, the tread pattern of the tires, or the metallic texture of the car body. These seemingly minor textures and structural details are precisely the indispensable parts of human visual perception, and their absence will significantly affect the realism and usability of the reconstructed image.

[0005] Furthermore, the instability and inaccuracy inherent in cross-modal alignment—the process of matching EEG signals with visual images in a high-dimensional semantic space—is also a key bottleneck limiting its application effectiveness. Traditional methods typically only establish a rough correspondence between EEG and simple visual stimuli, with limited ability to achieve fine-grained, semantically consistent cross-modal alignment in complex scenarios. For example, when a user views an image of a "golden retriever running on grass," existing methods might incorrectly generate an image of a "Labrador standing on a beach." Although the overall semantics are similar (both are canines), there are significant discrepancies in key elements such as scene, breed, and action, reflecting the model's failure to accurately align EEG signals with the multi-layered visual semantics in the image.

[0006] In summary, existing visual reconstruction methods based on EEG signals suffer from insufficient expression of multidimensional features of EEG signals, lack of visual semantic hierarchical modeling, and unstable cross-modal alignment, resulting in low quality of reconstructed images, loss of detail, and large semantic deviations. The applicant has made corresponding explorations to address these issues. Summary of the Invention

[0007] The purpose of this application is to solve the above-mentioned problems by providing a method, device, electronic device and computer-readable storage medium for visual image reconstruction of electroencephalogram signals.

[0008] To achieve the various objectives of this application, the following technical solution is adopted:

[0009] A method for visual image reconstruction of electroencephalogram signals, proposed to meet one of the purposes of this application, includes:

[0010] The raw EEG signals of the subject were acquired under the visual stimulus image; the raw EEG signals were decomposed into frequency bands, and the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band were extracted. The signals were then projected onto a matrix according to the spatial position of the electrodes and stitched together to construct a three-dimensional EEG data block.

[0011] The three-dimensional EEG data block is input into the three-dimensional modal coding path of the EEG signal, low-frequency spatial features and high-frequency spatial features are extracted and fused to obtain the first EEG feature representation; at the same time, the original EEG signal is input into the multi-level temporal coding path of the EEG signal, and temporal features of three levels, namely contour, foreground target and context image, are extracted and integrated step by step through a hierarchical cross attention mechanism, and then spliced ​​to obtain the second EEG feature representation.

[0012] The visual stimulus image is processed into a context image, a binarized contour image, and a foreground target image. The image features of the three images are extracted, embedded, and concatenated to obtain the image feature representation.

[0013] The goal is to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation. A three-dimensional cross-modal contrastive learning is performed. The first EEG feature representation and the second EEG feature representation are concatenated as conditional inputs, and the visual stimulus image is used as the image input to fine-tune the diffusion generation model.

[0014] During the inference phase, features of the EEG signal to be reconstructed are extracted and spliced ​​through two coding paths, and then input into a fine-tuned diffusion generation model to generate a reconstructed visual image.

[0015] Optionally, the steps of performing frequency band decomposition on the original EEG signal, extracting the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band, and projecting it onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block include:

[0016] The original EEG signal was filtered to the delta, theta, alpha, and beta bands based on the Chebyshev filter to obtain signal components in multiple sub-bands;

[0017] Calculate the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band;

[0018] The average power spectral density of each channel is projected onto the corresponding position of the first blank matrix according to the preset electrode spatial position to obtain the average power spectral density matrix.

[0019] The time-domain standard deviation of each channel is projected onto the corresponding position of the second blank matrix according to the spatial position of the electrode to obtain the time-domain standard deviation matrix;

[0020] The mean power spectral density matrix and the time-domain standard deviation matrix corresponding to each sub-frequency band are spliced ​​together to construct a three-dimensional EEG data block.

[0021] Optionally, the step of inputting the three-dimensional EEG data block into the three-dimensional modal coding path of the EEG signal, extracting low-frequency spatial features and high-frequency spatial features and fusing them to obtain the first EEG feature representation includes:

[0022] Each matrix in the three-dimensional EEG data block is divided into several sub-blocks, and global average pooling is performed on each sub-block to obtain the pooled features.

[0023] Low-frequency position encoding is added to the pooled features, and the encoded features are calculated through a cross-attention mechanism to obtain low-frequency spatial features;

[0024] A portion of the sub-blocks at preset positions in the matrix are mapped to query vectors of the cross-attention mechanism, and the remaining sub-blocks are mapped to key vectors and value vectors of the cross-attention mechanism. High-frequency spatial features are obtained by calculating through the cross-attention mechanism.

[0025] The first EEG feature representation is obtained by fusing the low-frequency spatial features and the high-frequency spatial features through a linear layer.

[0026] Optionally, the step of inputting the original EEG signal into a multi-level temporal coding path for EEG signals, extracting temporal features at three levels—contour, foreground target, and context image—and integrating them step by step through a hierarchical cross-attention mechanism to obtain a second EEG feature representation after concatenation includes:

[0027] The original EEG signals are input into three parallel multi-stage convolutional processing streams. Each multi-stage convolutional processing stream extracts temporal features through temporal convolution, average pooling, and spatial convolution, respectively, to obtain contour-level features, foreground target-level features, and context image-level features.

[0028] The contour-level features are mapped to query vectors of the cross-attention mechanism, and the foreground target-level features are mapped to key vectors and value vectors of the cross-attention mechanism. After calculation by the cross-attention mechanism, they are superimposed and normalized with the foreground target-level features to complete the integration of contour-level features into foreground target-level features.

[0029] The integrated foreground target hierarchical features are mapped to query vectors of the cross-attention mechanism, and the context image hierarchical features are mapped to key vectors and value vectors of the cross-attention mechanism. After calculation by the cross-attention mechanism, they are superimposed and normalized with the context image hierarchical features to complete the integration of foreground target hierarchical features into context image hierarchical features.

[0030] The features at each level after splicing and integration are used to obtain the second EEG feature representation.

[0031] Optionally, the steps of processing the visual stimulus image into a context image, a binarized contour image, and a foreground target image, extracting image features from each of the three, embedding them, and concatenating them to obtain an image feature representation include:

[0032] The visual stimulus image is normalized to obtain a context image;

[0033] A preset semantic segmentation model is used to segment the foreground object in the context image. The pixels of the segmented object region are set as the first value and the background pixels are set as the second value. The binarized image is obtained after binarization.

[0034] The context image is multiplied pixel by pixel with the binarized contour image to obtain the foreground target image;

[0035] The image feature embeddings of the context image, the binarized contour image and the foreground target image are extracted using a pre-trained image encoder, and the three image feature embeddings are concatenated to obtain the image feature representation.

[0036] Optionally, the steps of performing tri-modal contrastive learning, with the goal of maximizing the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation, include:

[0037] Calculate the first contrast loss between the first EEG feature representation and the image feature representation;

[0038] Calculate the second contrast loss between the second EEG feature representation and the image feature representation;

[0039] Calculate the third contrast loss between the first EEG feature representation and the second EEG feature representation;

[0040] The weighted sum of the first contrast loss, the second contrast loss, and the third contrast loss is used as the total loss. The network parameters of the EEG feature encoding path are optimized with the goal of minimizing the total loss, so as to perform triple cross-modal contrastive learning.

[0041] Optionally, the step of concatenating the first and second EEG feature representations as conditional inputs and using the visual stimulus image as the image input to fine-tune the diffusion generation model includes:

[0042] The first EEG feature representation and the second EEG feature representation are concatenated along the feature dimension to obtain the conditional vector;

[0043] Using the conditional vector as the conditional input and the visual stimulus image as the image input, the diffusion loss is calculated;

[0044] With the goal of minimizing the diffusion loss, the parameters of the diffusion generation model are fine-tuned to determine the fine-tuned diffusion generation model.

[0045] A device for visual image reconstruction of electroencephalogram signals, provided for another purpose of this application, comprises:

[0046] The EEG signal construction module is configured to acquire the raw EEG signals collected by the subject under visual stimulus images; perform frequency band decomposition on the raw EEG signals, extract the mean power spectral density and time domain standard deviation of each channel in each sub-frequency band, and project them onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block;

[0047] The EEG feature encoding module is configured to input the three-dimensional EEG data block into the three-dimensional modal encoding path of the EEG signal, extract low-frequency spatial features and high-frequency spatial features and fuse them to obtain the first EEG feature representation; at the same time, the original EEG signal is input into the multi-level temporal encoding path of the EEG signal, extract the temporal features of the contour, foreground target and context image at three levels, and integrate them step by step through the hierarchical cross attention mechanism, and splice them to obtain the second EEG feature representation;

[0048] The visual feature extraction module is configured to process the visual stimulus image into a context image, a binarized contour image, and a foreground target image, extract the image features of the three respectively, embed and concatenate them to obtain the image feature representation;

[0049] The contrastive learning fine-tuning module is set to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation, and to perform three-fold cross-modal contrastive learning; the first EEG feature representation and the second EEG feature representation are concatenated as conditional input, and the visual stimulus image is used as the image input to fine-tune the diffusion generation model;

[0050] The reasoning and reconstruction module is configured to extract features from the EEG signal to be reconstructed through two encoding paths and splice them together during the reasoning stage. The result is then input into a fine-tuned diffusion generation model to generate a reconstructed visual image.

[0051] An electronic device provided for another purpose of this application includes a central processing unit and a memory, the central processing unit being configured to invoke and run a computer program stored in the memory to perform the steps of the electroencephalogram signal visual image reconstruction method of this application.

[0052] A computer-readable storage medium is provided for another purpose of this application, which stores, in the form of computer-readable instructions, a computer program implemented according to the electroencephalogram signal visual image reconstruction method, which, when called by a computer, executes the steps included in the corresponding method.

[0053] Compared to existing technologies, this application addresses the problems of insufficient expression of multidimensional features of EEG signals, lack of visual semantic hierarchical modeling, and unstable cross-modal alignment in some visual reconstruction methods, which result in low-quality reconstructed images, loss of detail, and large semantic deviations. This application provides, but is not limited to, the following beneficial effects:

[0054] Firstly, this application filters the original EEG signal into four sub-bands using a Chebyshev filter, calculates the mean power spectral density and time-domain standard deviation of each channel in each sub-band, and projects these values ​​onto a spatial matrix based on the electrode spatial locations for stitching, thus converting the original one-dimensional time-series EEG signal into a structured three-dimensional EEG data block. This three-dimensional data block fully preserves information about the EEG signal in three dimensions: spatial distribution, spectral characteristics, and statistical features. This allows subsequent feature extraction to fully utilize the multi-dimensional features of the EEG signal, providing high-quality input data for high-fidelity visual reconstruction.

[0055] Firstly, this application designs a high- and low-frequency spatial feature extraction algorithm based on sub-block partitioning and cross-attention mechanism in the three-dimensional modality coding path. By dividing the spatial matrix into several sub-blocks, low-frequency position encoding is added to the pooled features and cross-attention is calculated to obtain low-frequency features reflecting the overall spatial distribution trend of EEG signals. Simultaneously, some sub-blocks at preset positions and the remaining sub-blocks are mapped to query vectors, key vectors, and value vectors of the attention mechanism, respectively, to calculate high-frequency features reflecting the detailed changes in local brain regions. The fusion of low-frequency and high-frequency features enables the model to grasp both the overall brain region activation pattern and capture the subtle response differences in local brain regions, solving the problem of insufficient modeling of the spatial and spectral synergistic relationship in existing methods.

[0056] Thirdly, this application designs three parallel, multi-stage convolutional processing flows in a multi-level temporal coding path to extract contour-level features, foreground target-level features, and contextual image-level features, respectively. A hierarchical cross-attention mechanism is then used to integrate contour-level features into foreground target-level features and foreground target-level features into contextual image-level features. This mechanism simulates the hierarchical information integration path of the brain's visual cortex from primary contours to object recognition and then to scene understanding. This allows the EEG feature representation to explicitly encode multi-level visual semantics from edge textures to target objects and then to the complete scene, enhancing the consistency of the generated image in terms of contour structure, foreground subject, and background scene.

[0057] Fourth, this application aims to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation, by performing triple cross-modal contrastive learning. Specifically, the first contrastive loss constrains the alignment of 3D spatial features with image semantics, the second contrastive loss constrains the alignment of temporal hierarchical features with image semantics, and the third contrastive loss constrains the consistency between the two EEG encoding paths. These three constraints work together to reduce the bias caused by single embedding spatial alignment, enabling the EEG feature representation to contain more essential and robust visually relevant features, thus providing high-quality semantic conditional input for the diffusion generative model.

[0058] V. This application only requires the subject's raw EEG signals as input during the inference stage, without any corresponding visual stimuli or speech signals. It can generate high-quality reconstructed images end-to-end using a pre-trained dual-path coding path and a fine-tuned diffusion generation model. Compared to existing methods that rely on strictly paired external stimuli, this application eliminates the dependence on external modalities, possesses stronger generalization and practicality, and can be widely applied to cutting-edge scenarios such as visual impairment assistance, mind communication, neurofeedback training, and immersive virtual reality. Attached Figure Description

[0059] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0060] Figure 1 This is a flowchart illustrating the method for visual image reconstruction of electroencephalogram signals in an embodiment of this application.

[0061] Figure 2 This is a flowchart illustrating the construction of three-dimensional data blocks in the three-dimensional modal coding path of EEG signals in an embodiment of this application.

[0062] Figure 3 This is a flowchart illustrating the feature extraction process of three-dimensional data blocks in the three-dimensional modal coding path of EEG signals in this embodiment of the application.

[0063] Figure 4 This is a diagram illustrating the architecture of the hierarchical cross-attention mechanism and the triple cross-modal contrastive learning mechanism in the embodiments of this application.

[0064] Figure 5 This is a diagram of the multi-level image encoding path architecture for visual stimuli in the embodiments of this application;

[0065] Figure 6 This is a schematic block diagram of the EEG signal visual image reconstruction device in the embodiments of this application;

[0066] Figure 7 This is a schematic diagram of the structure of the computer device in the embodiments of this application. Detailed Implementation

[0067] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0068] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application’s specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when an element is referred to as “connected” or “coupled” to another element in this embodiment, it may be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein may include wireless connection or wireless coupling. The term “and / or” as used herein includes all or any unit and all combinations of one or more associated listed items.

[0069] Those skilled in the art will understand that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0070] Those skilled in the art will understand that the terms "client," "terminal," and "terminal device" as used herein include both devices that receive wireless signals, devices that only possess wireless signal receiver capabilities without transmission capabilities, and devices with receiving and transmitting hardware, devices that have receiving and transmitting hardware capable of bidirectional communication over a bidirectional communication link. Such devices may include: cellular or other communication devices such as personal computers or tablets, having single-line displays, multi-line displays, or cellular or other communication devices without multi-line displays; PCS (Personal Communications Service) that can combine voice, data processing, fax, and / or data communication capabilities; PDAs (Personal Digital Assistants) that may include radio frequency receivers, pagers, internet / intranet access, web browsers, notebooks, calendars, and / or GPS (Global Positioning System) receivers; and conventional laptops and / or handheld computers or other devices that have and / or include radio frequency receivers. As used herein, "client," "terminal," and "terminal device" can be portable, transportable, installed in a means of transportation (air, sea, and / or land), or suitable and / or configured to operate locally and / or in a distributed manner, operating in any other location on Earth and / or in space. "Client," "terminal," and "terminal device" as used herein can also be a communication terminal, an internet access terminal, or a music / video playback terminal, such as a PDA, a MID (Mobile Internet Device), and / or a mobile phone with music / video playback capabilities, or a smart TV, set-top box, etc.

[0071] The hardware referred to by the names "server," "client," and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer. It is a hardware device with the necessary components revealed by the von Neumann architecture, such as a central processing unit (including an arithmetic logic unit and a control unit), memory, input devices, and output devices. The computer program is stored in its memory, and the central processing unit loads the program stored in the secondary storage into the main memory to run it, execute the instructions in the program, and interact with the input and output devices to complete specific functions.

[0072] It should be noted that the concept of "server" used in this application can also be extended to the case of server clusters. Based on the network deployment principles understood by those skilled in the art, the servers should be logically divided. Physically, these servers can be independent of each other but accessible through interfaces, or they can be integrated into a single physical computer or a computer cluster. Those skilled in the art should understand this flexibility and should not use it to constrain the implementation of the network deployment method in this application.

[0073] One or more of the technical features of this application, unless explicitly specified herein, can be deployed on a server and accessed by a client remotely calling the online service interface provided by the server, or can be directly deployed and run on a client for access.

[0074] Unless otherwise specified, the neural network models referenced or potentially referenced in this application may be deployed on a remote server and invoked remotely on the client, or deployed on a client with the capability to invoke directly. In some embodiments, when running on the client, the corresponding intelligence may be acquired through transfer learning in order to reduce the requirements on the client's hardware resources and avoid excessive consumption of the client's hardware resources.

[0075] Unless otherwise specified, all data involved in this application may be stored remotely on a server or on a local terminal device, as long as it is suitable for use by the technical solution of this application.

[0076] Those skilled in the art will understand that although the various methods in this application are described based on the same concept and thus present commonality among them, they can be performed independently unless otherwise specified. Similarly, the various embodiments disclosed in this application are all based on the same inventive concept; therefore, concepts expressed in the same way, as well as concepts that are appropriately changed for convenience but are expressed differently, should be understood equivalently.

[0077] Unless otherwise expressly stated, the various embodiments disclosed in this application can be combined in a cross-cutting manner to flexibly construct new embodiments, as long as such combination does not depart from the inventive spirit of this application and can meet the needs of the prior art or solve a certain deficiency in the prior art. Those skilled in the art should be aware of such modifications.

[0078] Please see Figure 1 In one embodiment of the EEG signal visual image reconstruction method of this application, the method includes:

[0079] Step S10: Acquire the raw EEG signals collected by the subject under visual stimulus images; decompose the raw EEG signals into frequency bands, extract the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band, and project them onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block.

[0080] The EEG signal visual image reconstruction system in the terminal device can acquire the raw EEG signals collected by the subject under visual stimulus images; perform frequency band decomposition on the raw EEG signals, extract the mean power spectral density and time domain standard deviation of each channel in each sub-frequency band, and project them onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block.

[0081] In some embodiments, the electroencephalogram (EEG) response signals generated by each subject in response to visual stimuli are acquired. Specifically, raw EEG signals generated by subjects while viewing a series of static images are recorded using an EEG cap conforming to the international 10-20 system. Each image is presented for a fixed number of time steps. Random intervals (1 to 2 seconds) were set between images to avoid anticipated effects and visual afterimage interference. The raw EEG signals were represented as follows:

[0082]

[0083] in, Indicates that the subject watched the first The corresponding EEG signals when viewing visual stimulus images This represents the number of electrode channels used. This is the total length of the EEG signal. This represents the total number of samples collected, which also corresponds to the total number of images viewed by the subjects.

[0084] The visual stimuli images were sourced from various publicly available image datasets, covering a wide range of object categories and scene types. The entire acquisition process was conducted under controlled lighting and in a quiet environment, with subjects maintaining a seated posture and focusing on the center of the screen to minimize non-neurogenic interference such as eye movements and electromyography. This acquisition protocol ensured that the acquired EEG signals stably and reliably reflected the brain's response to visual input, providing a high-quality raw data foundation for subsequent visual reconstruction.

[0085] In a further embodiment, one-dimensional EEG signals are used. Encode into three-dimensional space. Specifically, first use a length of... The time window segmentation of the input EEG signal is represented as follows:

[0086]

[0087] in, Representing the One EEG sample A segment. In this embodiment, according to Long time windows are used for segmentation. Generally, EEG signals are collected before the actual acquisition process. The baseline signal is recorded without any processing of the subject during baseline acquisition, i.e., the subject's steady state is recorded. Therefore, the next step in this embodiment is to remove the baseline signal. Calculate the... Average of baseline fragments from each EEG sample , No. The average value of the baseline segmentation of each EEG sample is expressed as:

[0088]

[0089] in, This represents the total number of baseline EEG segments, as this embodiment assumes the system will collect... The baseline signal, therefore In actual use of this embodiment, adjustments can be made according to the actual data acquisition methods. Then perform baseline removal:

[0090]

[0091] in This represents the EEG cut-off segment after baseline removal.

[0092] In some embodiments, the steps of performing frequency band decomposition on the original EEG signal, extracting the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band, and projecting it onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block include:

[0093] Step S101: Filter the original EEG signal to the δ band, θ band, α band and β band based on the Chebyshev filter to obtain signal components of multiple sub-bands;

[0094] Step S102: Calculate the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band;

[0095] Step S103: Project the average power spectral density of each channel onto the corresponding position of the first blank matrix according to the preset electrode spatial position to obtain the average power spectral density matrix.

[0096] Step S104: Project the time-domain standard deviation of each channel onto the corresponding position of the second blank matrix according to the spatial position of the electrode to obtain the time-domain standard deviation matrix;

[0097] Step S105: The mean power spectral density matrix and the time-domain standard deviation matrix corresponding to each sub-frequency band are spliced ​​together to construct a three-dimensional EEG data block.

[0098] Specifically, after time window segmentation and baseline removal, the raw EEG signal is filtered into four frequency bands using a Chebyshev filter: Frequency band (4-7Hz) Frequency band (8-12Hz) Frequency band (13-30Hz) and Frequency band (31-45Hz) is represented as follows:

[0099]

[0100] in, This represents the Chebyshev filter. Indicates the first One EEG sample Each segment Sub-band, These are the markings for the four major frequency bands. That is the length of the sub-band.

[0101] Furthermore, the mean power spectral density of each channel in each sub-frequency band is calculated separately. and time domain standard deviation The mean power spectral density reflects energy intensity, and the time-domain standard deviation reflects local fluctuations. The mean power spectral density for each sub-band is expressed as follows:

[0102] The time-domain standard deviation for each sub-band is expressed as follows:

[0103]

[0104] in, This represents the local power spectrum estimated by the Welch method. for The mean over the time dimension, The power spectral density is the average value for each sub-band. This represents the average power spectral density for each sub-band.

[0105] The mean power spectral density of each channel is projected onto the corresponding position of the first blank matrix according to the preset electrode spatial position to obtain the mean power spectral density matrix; the time-domain standard deviation of each channel is projected onto the corresponding position of the second blank matrix according to the electrode spatial position to obtain the time-domain standard deviation matrix; the mean power spectral density matrix and the time-domain standard deviation matrix corresponding to each sub-frequency band are spliced ​​together to construct a three-dimensional EEG data block. ,in, There are a total of 8 matrices (4 sub-bands, 2 matrices per sub-band), and the matrix layout is as follows. .

[0106] This embodiment projects the actual location of the EEG acquisition channel of the International 10–20 system onto the human brain. In the matrix layout, then a sub-band corresponding to a segment of EEG is cut off. of Each channel and The value is placed into the position of the projection in the two matrices, that is, a sub-band of a segment of an EEG. The values ​​correspond to a matrix, called Value matrix; The value corresponds to a matrix, called The value matrix is ​​then concatenated for each sub-band. Value matrix and The value matrix is ​​used because an EEG segment has four sub-bands, thus a three-dimensional mapping data block is obtained for each EEG segment. ,in, This means there are a total of 8 matrices (4 sub-bands, 2 matrices for each sub-band).

[0107] Step S20: Input the three-dimensional EEG data block into the three-dimensional modal coding path of the EEG signal, extract low-frequency spatial features and high-frequency spatial features and fuse them to obtain the first EEG feature representation; at the same time, input the original EEG signal into the multi-level temporal coding path of the EEG signal, extract the temporal features of the contour, foreground target and context image at three levels, and integrate them step by step through the hierarchical cross attention mechanism, and splice them to obtain the second EEG feature representation;

[0108] Raw EEG signals were acquired from subjects under visual stimulus images. The raw EEG signals were decomposed into frequency bands, and the mean power spectral density and temporal standard deviation of each channel in each sub-frequency band were extracted. The signals were then projected onto a matrix according to the spatial position of the electrodes and spliced ​​to construct a three-dimensional EEG data block. The three-dimensional EEG data block was then input into the three-dimensional modal coding path of the EEG signal to extract and fuse low-frequency and high-frequency spatial features to obtain the first EEG feature representation. Simultaneously, the raw EEG signals were input into the multi-level temporal coding path of the EEG signal to extract temporal features at three levels: contour, foreground target, and context image. These features were then integrated step by step through a hierarchical cross-attention mechanism and spliced ​​to obtain the second EEG feature representation.

[0109] In some embodiments, the step of inputting the three-dimensional EEG data block into the three-dimensional modal coding path of the EEG signal, extracting low-frequency spatial features and high-frequency spatial features and fusing them to obtain a first EEG feature representation includes:

[0110] Step S201: Divide each matrix in the three-dimensional EEG data block into several sub-blocks, and perform global average pooling on each sub-block to obtain the pooled features.

[0111] Step S202: Add low-frequency position encoding to the pooled features, and calculate the low-frequency spatial features by using a cross-attention mechanism;

[0112] Step S203: Map a portion of the sub-blocks at preset positions in the matrix to query vectors of the cross-attention mechanism, and map the remaining sub-blocks to key vectors and value vectors of the cross-attention mechanism. Calculate the high-frequency spatial features through the cross-attention mechanism.

[0113] Step S204: The low-frequency spatial features and the high-frequency spatial features are fused through a linear layer to obtain the first EEG feature representation.

[0114] Assuming a total of 32 sensors were used to collect EEG data, this means ,but The matrix has 32 values, and the values ​​at the remaining non-projected positions are set to 0. The entire projection process is as follows: Figure 2 As shown. The above process completes the encoding of one-dimensional EEG into three-dimensional space. Next, this embodiment performs the second step of this path, using the high- and low-frequency spatial feature extraction algorithm designed in this embodiment to extract features from the three-dimensional mapped modality. This embodiment focuses on extracting the spatial frequency features of the three-dimensional data block. Since the following focuses on processing a single EEG sample, the subscripts representing the sample number are omitted. .

[0115] The three-dimensional EEG data block is input into the three-dimensional modal coding path of the EEG signal, low-frequency spatial features and high-frequency spatial features are extracted and fused to obtain the first EEG feature representation, specifically including the following steps:

[0116] Specifically, such as Figure 3 As shown, a three-dimensional EEG data block for a single EEG sample. each of them The matrix is ​​divided into 9 The sub-block, denoted as ,in, Represents the sub-block number, and global average pooling is used within each sub-block:

[0117]

[0118] After global average pooling, each 9×9 matrix becomes a 3×3 matrix, and the entire 3D data block becomes... .

[0119] Furthermore, for the pooled features Add low-frequency position coding, which is represented as follows:

[0120]

[0121] in, Represents the features after pooling The first in 1 pixel position This indicates the current corresponding channel. This refers to the total number of channels, in this embodiment. .

[0122] Pooled features middle Even part sum For the odd-numbered portions, each portion is mapped to a key vector for the cross-attention mechanism through a linear layer. Sum value vector , will the original Mapped to query vectors of cross-attention mechanism It is represented as:

[0123]

[0124] in, , and The mapping parameters represent the current cross-attention mechanism; , and These represent the query vector, key vector, and value vector used to calculate cross-attention in the current stage, respectively. Represents the features after pooling middle For the odd-numbered part, Represents the features after pooling middle The part that is even.

[0125] Furthermore, cross-attention is calculated to obtain low-frequency spatial features, which are represented as follows:

[0126]

[0127] in, Represents the scaling factor of the feature. This refers to the low-frequency spatial characteristics of the three-dimensional mapping of electroencephalograms. This represents the Softmax function.

[0128] Furthermore, such as Figure 3 As shown, some sub-blocks at preset positions in the matrix are mapped to query vectors of the cross-attention mechanism, and the remaining sub-blocks are mapped to key vectors and value vectors of the cross-attention mechanism. High-frequency spatial features are obtained by calculation through the cross-attention mechanism.

[0129] Specifically, the four sub-blocks in the top left corner are mapped to query vectors for the cross-attention mechanism. Map the remaining 5 sub-blocks to key vectors Sum value vector It is represented as:

[0130]

[0131] Simultaneously, the four sub-blocks in the lower right corner are mapped to query vectors for the cross-attention mechanism. Map the remaining 5 sub-blocks to key vectors Sum value vector It is represented as:

[0132]

[0133] in, and These represent the four child blocks in the top left corner and the four child blocks in the bottom right corner, respectively. , as well as These are the query vector, key vector, and value vector for the first group of cross-attention mechanisms; , as well as These are the query vector, key vector, and value vector for the second set of cross-attention mechanisms; , and These are the query mapping parameters, key mapping parameters, and value mapping parameters for the first group of cross-attention mechanisms; , and These are the query mapping parameters, key mapping parameters, and value mapping parameters for the second set of cross-attention mechanisms.

[0134] Furthermore, attention calculations are performed to obtain two sets of high-frequency spatial features, which are represented as follows:

[0135]

[0136]

[0137] Furthermore, by fusing the low-frequency spatial features and the high-frequency spatial features through a linear layer, a first EEG feature representation is obtained. It is represented as:

[0138]

[0139] in, Represents a linear layer. This represents the concatenation operation of feature dimensions.

[0140] In a further embodiment, the step of inputting the original EEG signal into a multi-level temporal coding path for EEG signals, extracting temporal features at three levels—contour, foreground target, and context image—and integrating them step by step through a hierarchical cross-attention mechanism to obtain a second EEG feature representation after concatenation includes:

[0141] Step S2001: The original EEG signal is input into three parallel multi-stage convolutional processing streams. Each multi-stage convolutional processing stream extracts temporal features through temporal convolution, average pooling and spatial convolution in sequence, and obtains contour level features, foreground target level features and context image level features respectively.

[0142] Step S2002: Map the contour level features to a query vector of the cross-attention mechanism, and map the foreground target level features to a key vector and a value vector of the cross-attention mechanism. After calculation by the cross-attention mechanism, the features are superimposed and normalized with the foreground target level features to complete the integration of contour level features into foreground target level features.

[0143] Step S2003: Map the integrated foreground target hierarchical features to a query vector of the cross-attention mechanism, and map the context image hierarchical features to a key vector and a value vector of the cross-attention mechanism. After calculation by the cross-attention mechanism, the features are superimposed and normalized with the context image hierarchical features to complete the integration of the foreground target hierarchical features into the context image hierarchical features.

[0144] Step S2004: After splicing and integrating the features at each level, the second EEG feature representation is obtained.

[0145] The raw EEG signal is input into a multi-level temporal coding path for EEG signals, and temporal features at three levels—contour, foreground target, and context image—are extracted. These features are then integrated level by level through a hierarchical cross-attention mechanism and concatenated to obtain a second EEG feature representation. The specific steps include the following:

[0146] The raw EEG signals are input into three parallel multi-stage convolutional processing streams, and each multi-stage convolutional processing stream extracts temporal features through temporal convolution, average pooling, and spatial convolution in sequence.

[0147] In the first stage, the kernel size is first used to... Step size is Temporal convolution captures the temporal dependence of EEG signals and utilizes convolution kernel size of [missing information]. Step size is Average pooling is used to reduce the temporal resolution while retaining key information, and it is represented as:

[0148]

[0149] In the second stage, the kernel size is applied. Spatial convolution for temporal filtering is expressed as:

[0150]

[0151] After each stage, non-linear activation is performed using Normalized and the activation function ELU to prevent gradient explosion.

[0152] Feature projection using 1×1 convolution is represented as follows:

[0153]

[0154] in, and These are temporal convolution and kernel spatial convolution, respectively. represent convolution, This represents the output after the first stage of temporal convolution kernels and average pooling. This represents the output after the second stage of spatial convolution. Represents a multi-stage convolutional processing flow The final output is obtained. After each stage, non-linear activation is performed using batch normalization (BatchNorm) and the ELU activation function to prevent gradient explosion.

[0155] Each input time-series EEG signal The process involves three parallel multi-stage convolutional processing streams. The contour layer features are obtained through processing. Characteristics of the foreground target hierarchy and contextual image hierarchical features .

[0156] Furthermore, this embodiment innovatively introduces a hierarchical cross-attention integration mechanism. Specifically, as... Figure 4 As shown, assuming low-level features, such as contours or foreground targets, are... High-level features, such as foreground objects or contextual images, are... Therefore, this embodiment will Mapped to the key vector of the cross-attention mechanism At the same time Mapped to query vectors of cross-attention mechanism Sum value vector Contour layer features Mapped to the key vector of the cross-attention mechanism The foreground target hierarchical features Mapped to query vectors of cross-attention mechanism Sum value vector It is represented as:

[0157]

[0158]

[0159]

[0160] in, , and This represents the linear layer parameters mapped to the current cross-attention mechanism; , and This represents the query, key, and value vector used to calculate cross-attention in the current stage.

[0161] Furthermore, a cross-attention mechanism is calculated to integrate contour-level features into foreground-target-level features, which is represented as:

[0162]

[0163] in, Representing the integration direction, A value of 1 indicates contour level features. Features of the foreground target hierarchy integrated; A value of 2 indicates that the foreground target level feature is 2. To contextual image hierarchical features integrated.

[0164] Furthermore, let's assume The expression for the aforementioned cross-attention mechanism involves superimposing and normalizing the integrated features to complete the integration of contour-level features into foreground target-level features, as shown below:

[0165]

[0166] in, Represents LayerNorm operation. This represents the Dropout operation.

[0167] Furthermore, the integrated foreground target hierarchical features Mapping the context image hierarchical features to key vectors of a cross-attention mechanism The query vector and value vector are mapped to a cross-attention mechanism, and after calculation by the cross-attention mechanism, they are compared with the context image hierarchical features. Superimposed normalization to complete the foreground target hierarchical features To contextual image hierarchical features The integration is represented as:

[0168]

[0169] At the same time, the contour hierarchy features are preserved, which are represented as follows:

[0170]

[0171] Furthermore, by splicing and integrating the features at each level, a second EEG feature representation is obtained. It is represented as:

[0172]

[0173] Step S30: Process the visual stimulus image into a context image, a binarized contour image, and a foreground target image, extract the image features of the three respectively, embed them, and stitch them together to obtain the image feature representation;

[0174] The three-dimensional EEG data block is input into the three-dimensional modal coding path of the EEG signal, low-frequency spatial features and high-frequency spatial features are extracted and fused to obtain the first EEG feature representation. At the same time, the original EEG signal is input into the multi-level temporal coding path of the EEG signal, and temporal features of three levels, namely contour, foreground target and context image, are extracted and integrated step by step through a hierarchical cross-attention mechanism. After being spliced ​​to obtain the second EEG feature representation, the visual stimulus image is processed into context image, binarized contour image and foreground target image. The image features of the three are extracted, embedded and spliced ​​to obtain the image feature representation.

[0175] In some embodiments, the step of processing a visual stimulus image into a context image, a binarized contour image, and a foreground target image, extracting image features from each of the three images, embedding them, and concatenating them to obtain an image feature representation includes:

[0176] Step S301: Normalize the visual stimulus image to obtain a context image;

[0177] Step S302: Use a preset semantic segmentation model to segment the foreground object in the context image, set the pixels of the segmented object region to the first value and the background pixels to the second value, and obtain a binarized contour image after binarization.

[0178] Step S303: Multiply the context image and the binarized contour image pixel by pixel to obtain the foreground target image;

[0179] Step S304: Use a pre-trained image encoder to extract image feature embeddings from the context image, the binarized contour image, and the foreground target image, and then concatenate the three image feature embeddings to obtain an image feature representation.

[0180] The semantic segmentation model can be the SAM2 model, etc.; the visual stimulus image is processed into a context image, a binarized contour image, and a foreground target image, and the image features of the three are extracted, embedded, and concatenated to obtain the image feature representation, specifically including the following steps:

[0181] Please see Figure 5 The visual stimulus image is normalized to obtain the context image. Then, a semantic segmentation model is used to analyze the context image. Foreground object segmentation is performed, and pixels within the segmented object regions are set to a first value (1), while background pixels are set to a second value (0). Binarization is then performed to obtain a binarized contour image. It is represented as:

[0182]

[0183] in, Represents the SAM model. It is the binarization threshold. This represents the binarization operation.

[0184] Furthermore, the context image With the binarized contour image Pixel-by-pixel multiplication yields the foreground target image. It is represented as:

[0185]

[0186] in, This represents a pixel-by-pixel multiplication operation, where the foreground target image... The object contains only the foreground object, while the background is set to 1, making the background appear white.

[0187] Furthermore, the context images are extracted using a pre-trained CLIP image encoder (such as a frozen CLIP-ViT-H / 14 model). The binarized contour image and the foreground target image The image feature embedding is represented as follows:

[0188]

[0189] in, , and These represent contour image feature embedding, foreground target image feature embedding, and context image feature embedding, respectively.

[0190] Furthermore, embedding contour image features Foreground target image feature embedding and contextual image feature embedding By stitching the images together, we obtain the image feature representation of the path. It is represented as:

[0191]

[0192] in, This represents the concatenation operation of feature dimensions. This represents the image features.

[0193] Step S40: With the goal of maximizing the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation, a three-dimensional cross-modal contrastive learning is performed; the first EEG feature representation and the second EEG feature representation are concatenated as conditional input, and the visual stimulus image is used as image input to fine-tune the diffusion generation model;

[0194] The visual stimulus image is processed into a context image, a binarized contour image, and a foreground target image. The image features of each of the three are extracted, embedded, and concatenated to obtain the image feature representation. Then, a three-way cross-modal contrastive learning is performed with the goal of maximizing the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation. The concatenated first EEG feature representation and the second EEG feature representation are used as the conditional input, and the visual stimulus image is used as the image input to fine-tune the diffusion generation model.

[0195] In some embodiments, the step of performing triple cross-modal contrastive learning with the goal of maximizing the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation includes:

[0196] Step S401: Calculate the first contrast loss between the first EEG feature representation and the image feature representation;

[0197] Step S402: Calculate the second contrast loss between the second EEG feature representation and the image feature representation;

[0198] Step S403: Calculate the third contrast loss between the first EEG feature representation and the second EEG feature representation;

[0199] Step S404: The weighted sum of the first contrast loss, the second contrast loss, and the third contrast loss is used as the total loss. The network parameters of the EEG feature encoding path are optimized with the goal of minimizing the total loss, so as to perform triple cross-modal contrastive learning.

[0200] After obtaining the feature representations of the three paths, a three-way cross-modal contrastive learning and generative model fine-tuning of EEG signal feature encoding are initiated. The former aligns the first EEG feature representation of the EEG signal through three-way cross-modal contrastive learning. Compared with the second EEG feature representation and image feature representation The latter fine-tunes the generative model by using the original visual stimulus image and aligned EEG signal features, enabling it to receive EEG signals as input and output a reconstructed image.

[0201] Triple cross-modal contrastive learning, such as Figure 4 As shown, a three-dimensional cross-modal contrastive learning method is used to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation. The first and second EEG feature representations are concatenated and used as conditional inputs, with a visual stimulus image as the image input, to fine-tune the diffusion generation model. The specific steps include:

[0202] Represented by the first EEG feature With the image feature representation Maximizing the similarity between them, and representing the second EEG feature With the image feature representation Maximizing the similarity between them, and the representation of the first EEG feature Compared with the second EEG feature representation With the goal of maximizing the similarity between them, a triple cross-modal contrastive learning process is performed.

[0203] Specifically, a first contrast loss is calculated between the first EEG feature representation and the image feature representation. It is represented as:

[0204]

[0205] Calculate the second contrast loss between the second EEG feature representation and the image feature representation. It is represented as:

[0206]

[0207] Calculate the third contrast loss between the first EEG feature representation and the second EEG feature representation. It is represented as:

[0208]

[0209] in, Cosine similarity represents the similarity between two vectors. Represents the temperature coefficient and controls the sharpness of the distribution. This represents the index of the current sample in the batch, with a value ranging from 1 to... ; This represents the index of all samples in the batch, used to iterate through positive and negative samples, with a value ranging from 1 to... .

[0210] The weighted sum of the first comparison loss, the second comparison loss, and the third comparison loss is taken as the total loss. Represented as:

[0211]

[0212] in, , and This represents the weighted fusion hyperparameter.

[0213] After this stage of learning, the feature representations obtained from the input electroencephalogram (EEG) signals through the three-dimensional modal coding path and the multi-level temporal coding path are aligned with the CLIP image encoder. Therefore, the generative model can understand the real-world visual phenomena corresponding to the EEG feature representations and thus reconstruct realistic images.

[0214] In a further embodiment, the step of fine-tuning the diffusion generation model by concatenating the first EEG feature representation and the second EEG feature representation as conditional input, and using a visual stimulus image as image input, includes:

[0215] Step S401: Concatenate the first EEG feature representation and the second EEG feature representation along the feature dimension to obtain a conditional vector;

[0216] Step S402: Using the conditional vector as the conditional input and the visual stimulus image as the image input, calculate the diffusion loss;

[0217] Step S403: With the goal of minimizing the diffusion loss, fine-tune the parameters of the diffusion generation model to determine the fine-tuned diffusion generation model.

[0218] Specifically, the generative model is fine-tuned by using the concatenation of two EEG signal feature representations along the feature dimension as conditional input and the original visual stimulus image as image input. This embodiment can be stable-diffusion-v1-4. It is worth noting that those skilled in the art can use any generative artificial intelligence according to the actual application requirements.

[0219] The first EEG feature is represented Compared with the second EEG feature representation Concatenate along the feature dimensions to obtain the condition vector. , with the condition vector As a conditional input, the visual stimulus image As image input, calculate diffusion loss Instructional learning is represented as follows:

[0220]

[0221] in, Represents the input ,noise and time step Take the expected value. It is the KL divergence, used to measure the difference between two probability distributions; The conditional distribution representing the actual backdiffusion process indicates that, given the current hidden state... and original visual stimulus images In the case of the previous time step, the hidden variable The true distribution. The inverse generative distribution representing model learning, where, It is conditional information, representing the characteristic representation of electroencephalogram (EEG) signals.

[0222] Step S50: In the inference stage, the features of the EEG signal to be reconstructed are extracted and spliced ​​through two coding paths, and then input into the fine-tuned diffusion generation model to generate the reconstructed visual image.

[0223] The goal is to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation. Triple cross-modal contrastive learning is performed. The first EEG feature representation and the second EEG feature representation are concatenated as conditional input, and the visual stimulus image is used as the image input. After fine-tuning the diffusion generation model, in the inference stage, the features of the EEG signal to be reconstructed are extracted through two encoding paths and concatenated. The concatenated features are then input into the fine-tuned diffusion generation model to generate the reconstructed visual image.

[0224] Specifically, during the inference phase, only the raw EEG signals collected when the subject views or imagines a visual content are needed as input; no corresponding image information is required. First, the raw EEG signals undergo the same preprocessing as in the training phase: baseline correction, time window segmentation, multi-band filtering (θ, α, β, and γ bands), and the mean power spectral density and temporal standard deviation of each band are calculated. Then, based on the spatial location of the electrodes, the feature values ​​of each channel are projected into a fixed-size spatial matrix to construct a three-dimensional EEG data block. Next, this three-dimensional EEG data block and the raw temporal EEG signals are fed into a pre-trained three-dimensional modal encoding path and a multi-level temporal encoding path, respectively, generating two complementary EEG feature representations. These two feature vectors are then concatenated into a unified conditional vector, serving as the conditional input to the diffusion generation model. Finally, the conditional vector is input into the fine-tuned diffusion generation model, initiating a backdiffusion process that gradually denoises from pure Gaussian noise, ultimately generating a reconstructed image highly consistent with the visual content corresponding to the subject's EEG response.

[0225] The entire reasoning process is completely end-to-end, without relying on external image databases or human intervention, and is applicable to brain-computer visual reconstruction tasks in both offline and online scenarios. For example, in medical assistance, neurofeedback training, or novel human-computer interaction systems, users only need to wear an EEG device to gaze at a target image or imagine a specific scene in their mind, and the system can output the visual content that they "see" or "think" in real time, achieving cross-modal semantic mapping from EEG signals to realistic images.

[0226] Compared to existing technologies, this application addresses the problems of insufficient expression of multidimensional features of EEG signals, lack of visual semantic hierarchical modeling, and unstable cross-modal alignment in some visual reconstruction methods, which result in low-quality reconstructed images, loss of detail, and large semantic deviations. This application provides, but is not limited to, the following beneficial effects:

[0227] Firstly, this application filters the original EEG signal into four sub-bands using a Chebyshev filter, calculates the mean power spectral density and time-domain standard deviation of each channel in each sub-band, and projects these values ​​onto a spatial matrix based on the electrode spatial locations for stitching, thus converting the original one-dimensional time-series EEG signal into a structured three-dimensional EEG data block. This three-dimensional data block fully preserves information about the EEG signal in three dimensions: spatial distribution, spectral characteristics, and statistical features. This allows subsequent feature extraction to fully utilize the multi-dimensional features of the EEG signal, providing high-quality input data for high-fidelity visual reconstruction.

[0228] Firstly, this application designs a high- and low-frequency spatial feature extraction algorithm based on sub-block partitioning and cross-attention mechanism in the three-dimensional modality coding path. By dividing the spatial matrix into several sub-blocks, low-frequency position encoding is added to the pooled features and cross-attention is calculated to obtain low-frequency features reflecting the overall spatial distribution trend of EEG signals. Simultaneously, some sub-blocks at preset positions and the remaining sub-blocks are mapped to query vectors, key vectors, and value vectors of the attention mechanism, respectively, to calculate high-frequency features reflecting the detailed changes in local brain regions. The fusion of low-frequency and high-frequency features enables the model to grasp both the overall brain region activation pattern and capture the subtle response differences in local brain regions, solving the problem of insufficient modeling of the spatial and spectral synergistic relationship in existing methods.

[0229] Thirdly, this application designs three parallel, multi-stage convolutional processing flows in a multi-level temporal coding path to extract contour-level features, foreground target-level features, and contextual image-level features, respectively. A hierarchical cross-attention mechanism is then used to integrate contour-level features into foreground target-level features and foreground target-level features into contextual image-level features. This mechanism simulates the hierarchical information integration path of the brain's visual cortex from primary contours to object recognition and then to scene understanding. This allows the EEG feature representation to explicitly encode multi-level visual semantics from edge textures to target objects and then to the complete scene, enhancing the consistency of the generated image in terms of contour structure, foreground subject, and background scene.

[0230] Fourth, this application aims to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation, by performing triple cross-modal contrastive learning. Specifically, the first contrastive loss constrains the alignment of 3D spatial features with image semantics, the second contrastive loss constrains the alignment of temporal hierarchical features with image semantics, and the third contrastive loss constrains the consistency between the two EEG encoding paths. These three constraints work together to reduce the bias caused by single embedding spatial alignment, enabling the EEG feature representation to contain more essential and robust visually relevant features, thus providing high-quality semantic conditional input for the diffusion generative model.

[0231] V. This application only requires the subject's raw EEG signals as input during the inference stage, without any corresponding visual stimuli or speech signals. It can generate high-quality reconstructed images end-to-end using a pre-trained dual-path coding path and a fine-tuned diffusion generation model. Compared to existing methods that rely on strictly paired external stimuli, this application eliminates the dependence on external modalities, possesses stronger generalization and practicality, and can be widely applied to cutting-edge scenarios such as visual impairment assistance, mind communication, neurofeedback training, and immersive virtual reality.

[0232] Please see Figure 6 A device for visual image reconstruction of electroencephalogram (EEG) signals provided for one of the purposes of this application includes an EEG signal construction module 1100, an EEG feature encoding module 1200, a visual feature extraction module 1300, a contrast learning fine-tuning module 1400, and a reasoning reconstruction module 1500. The EEG signal construction module 1100 is configured to acquire the raw EEG signals collected by the subject under visual stimulation images; perform frequency band decomposition on the raw EEG signals, extract the mean power spectral density and temporal standard deviation of each channel in each sub-frequency band, and project them onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block; the EEG feature encoding module 1200 is configured to input the three-dimensional EEG data block into the three-dimensional modal encoding path of the EEG signal, extract low-frequency spatial features and high-frequency spatial features and fuse them to obtain a first EEG feature representation; simultaneously, input the raw EEG signal into the multi-level temporal encoding path of the EEG signal, extract temporal features of three levels: contour, foreground target and context image, and integrate them step by step through a hierarchical cross-attention mechanism to obtain a second EEG feature representation; the visual feature extraction module 1 300 is configured to process the visual stimulus image into a context image, a binarized contour image, and a foreground target image, extract the image features of the three respectively, embed and concatenate them to obtain an image feature representation; the contrastive learning fine-tuning module 1400 is configured to perform three-way cross-modal contrastive learning with the goal of maximizing the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation; the concatenated first EEG feature representation and the second EEG feature representation are used as conditional input, and the visual stimulus image is used as image input to fine-tune the diffusion generation model; the inference reconstruction module 1500 is configured to extract features from the EEG signal to be reconstructed through two encoding paths and concatenate them, input them into the fine-tuned diffusion generation model, and generate the reconstructed visual image.

[0233] Based on any embodiment of this application, please refer to Figure 7 Another embodiment of this application also provides an electronic device, which can be implemented by a computer device, such as... Figure 7The diagram shows the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. The computer-readable storage medium stores an operating system, a database, and computer-readable instructions. The database may store control information sequences. When the computer-readable instructions are executed by the processor, the processor can implement a method for reconstructing visual images from electroencephalogram (EEG) signals. The processor of the computer device provides computational and control capabilities, supporting the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the EEG signal visual image reconstruction method of this application. The network interface of the computer device is used for communication with a terminal. Those skilled in the art will understand that… Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0234] In this embodiment, the processor is used to execute... Figure 6 The specific functions of each module are defined within the device, and the memory stores the program code and various types of data required to execute these modules. The network interface is used for data transmission between the user terminal and the server. In this embodiment, the memory stores the program code and data required to execute all modules in the EEG signal visual image reconstruction device of this application, and the server can call the server's program code and data to execute the functions of all modules.

[0235] This application also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the EEG signal visual image reconstruction method described in any embodiment of this application.

[0236] This application also provides a computer program product, including a computer program / instructions that, when executed by one or more processors, implement the steps of the EEG signal visual image reconstruction method described in any embodiment of this application.

[0237] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0238] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for visual image reconstruction from electroencephalogram (EEG) signals, characterized in that, include: Acquire raw electroencephalogram (EEG) signals from subjects under visual stimulus images; The original EEG signal is decomposed into frequency bands, and the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band are extracted. The signal is then projected onto a matrix according to the spatial position of the electrodes and stitched together to construct a three-dimensional EEG data block. The three-dimensional EEG data block is input into the three-dimensional modal coding path of the EEG signal, low-frequency spatial features and high-frequency spatial features are extracted and fused to obtain the first EEG feature representation; at the same time, the original EEG signal is input into the multi-level temporal coding path of the EEG signal, and temporal features of three levels, namely contour, foreground target and context image, are extracted and integrated step by step through a hierarchical cross attention mechanism, and then spliced ​​to obtain the second EEG feature representation. The visual stimulus image is processed into a context image, a binarized contour image, and a foreground target image. The image features of the three images are extracted, embedded, and concatenated to obtain the image feature representation. The goal is to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation. A three-dimensional cross-modal contrastive learning is performed. The first EEG feature representation and the second EEG feature representation are concatenated as conditional inputs, and the visual stimulus image is used as the image input to fine-tune the diffusion generation model. During the inference phase, features of the EEG signal to be reconstructed are extracted and spliced ​​through two coding paths, and then input into a fine-tuned diffusion generation model to generate a reconstructed visual image.

2. The method for visual image reconstruction of electroencephalogram signals according to claim 1, characterized in that, The steps of performing frequency band decomposition on the raw EEG signal, extracting the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band, and projecting it onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block include: The original EEG signal was filtered to the delta, theta, alpha, and beta bands based on the Chebyshev filter to obtain signal components in multiple sub-bands; Calculate the mean power spectral density and time-domain standard deviation of each channel in each sub-frequency band; The power spectral density mean of each channel is projected onto the corresponding position of the first blank matrix according to the preset electrode spatial position to obtain the power spectral density mean matrix. The time-domain standard deviation of each channel is projected onto the corresponding position of the second blank matrix according to the spatial position of the electrode to obtain the time-domain standard deviation matrix; The mean power spectral density matrix and the time-domain standard deviation matrix corresponding to each sub-frequency band are spliced ​​together to construct a three-dimensional EEG data block.

3. The method for visual image reconstruction of EEG signals according to claim 1, characterized in that, The steps of inputting the three-dimensional EEG data block into the three-dimensional modal coding path of the EEG signal, extracting low-frequency spatial features and high-frequency spatial features and fusing them to obtain the first EEG feature representation include: Each matrix in the three-dimensional EEG data block is divided into several sub-blocks, and global average pooling is performed on each sub-block to obtain the pooled features. Low-frequency position encoding is added to the pooled features, and the encoded features are calculated through a cross-attention mechanism to obtain low-frequency spatial features; A portion of the sub-blocks at preset positions in the matrix are mapped to query vectors of the cross-attention mechanism, and the remaining sub-blocks are mapped to key vectors and value vectors of the cross-attention mechanism. High-frequency spatial features are obtained by calculating through the cross-attention mechanism. The first EEG feature representation is obtained by fusing the low-frequency spatial features and the high-frequency spatial features through a linear layer.

4. The method for visual image reconstruction of electroencephalogram signals according to claim 1, characterized in that, The steps of inputting the original EEG signal into a multi-level temporal coding path for EEG signals, extracting temporal features at three levels—contour, foreground target, and context image—and integrating them step by step through a hierarchical cross-attention mechanism to obtain the second EEG feature representation include: The original EEG signals are input into three parallel multi-stage convolutional processing streams. Each multi-stage convolutional processing stream extracts temporal features through temporal convolution, average pooling, and spatial convolution, respectively, to obtain contour-level features, foreground target-level features, and context image-level features. The contour-level features are mapped to query vectors of the cross-attention mechanism, and the foreground target-level features are mapped to key vectors and value vectors of the cross-attention mechanism. After calculation by the cross-attention mechanism, they are superimposed and normalized with the foreground target-level features to complete the integration of contour-level features into foreground target-level features. The integrated foreground target hierarchical features are mapped to query vectors of the cross-attention mechanism, and the context image hierarchical features are mapped to key vectors and value vectors of the cross-attention mechanism. After calculation by the cross-attention mechanism, they are superimposed and normalized with the context image hierarchical features to complete the integration of foreground target hierarchical features into context image hierarchical features. The features at each level after splicing and integration are used to obtain the second EEG feature representation.

5. The method for visual image reconstruction of electroencephalogram signals according to claim 1, characterized in that, The steps of processing a visual stimulus image into a context image, a binarized contour image, and a foreground target image, extracting image features from each of the three images, embedding them, and concatenating them to obtain an image feature representation include: The visual stimulus image is normalized to obtain a context image; A preset semantic segmentation model is used to segment the foreground object in the context image. The pixels of the segmented object region are set as the first value and the background pixels are set as the second value. The binarized image is obtained after binarization. The context image is multiplied pixel by pixel with the binarized contour image to obtain the foreground target image; The image feature embeddings of the context image, the binarized contour image and the foreground target image are extracted using a pre-trained image encoder, and the three image feature embeddings are concatenated to obtain the image feature representation.

6. The method for visual image reconstruction of electroencephalogram signals according to claim 1, characterized in that, The steps of triple cross-modal contrastive learning, aimed at maximizing the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation, include: Calculate the first contrast loss between the first EEG feature representation and the image feature representation; Calculate the second contrast loss between the second EEG feature representation and the image feature representation; Calculate the third contrast loss between the first EEG feature representation and the second EEG feature representation; The weighted sum of the first contrast loss, the second contrast loss, and the third contrast loss is used as the total loss. The network parameters of the EEG feature encoding path are optimized with the goal of minimizing the total loss, so as to perform triple cross-modal contrastive learning.

7. The method for visual image reconstruction of electroencephalogram signals according to any one of claims 1 to 6, characterized in that, The steps of fine-tuning the diffusion generation model by concatenating the first and second EEG feature representations as conditional inputs and using a visual stimulus image as the image input include: The first EEG feature representation and the second EEG feature representation are concatenated along the feature dimension to obtain the conditional vector; Using the conditional vector as the conditional input and the visual stimulus image as the image input, the diffusion loss is calculated; With the goal of minimizing the diffusion loss, the parameters of the diffusion generation model are fine-tuned to determine the fine-tuned diffusion generation model.

8. A device for reconstructing visual images from electroencephalogram (EEG) signals, characterized in that, include: The EEG signal construction module is configured to acquire the raw EEG signals collected by the subject under visual stimulus images; perform frequency band decomposition on the raw EEG signals, extract the mean power spectral density and time domain standard deviation of each channel in each sub-frequency band, and project them onto a matrix according to the spatial position of the electrodes to construct a three-dimensional EEG data block; The EEG feature encoding module is configured to input the three-dimensional EEG data block into the three-dimensional modal encoding path of the EEG signal, extract low-frequency spatial features and high-frequency spatial features and fuse them to obtain the first EEG feature representation; at the same time, the original EEG signal is input into the multi-level temporal encoding path of the EEG signal, extract the temporal features of the contour, foreground target and context image at three levels, and integrate them step by step through the hierarchical cross attention mechanism, and splice them to obtain the second EEG feature representation; The visual feature extraction module is configured to process the visual stimulus image into a context image, a binarized contour image, and a foreground target image, extract the image features of the three respectively, embed and concatenate them to obtain the image feature representation; The contrastive learning fine-tuning module is set to maximize the similarity between the first EEG feature representation and the image feature representation, between the second EEG feature representation and the image feature representation, and between the first EEG feature representation and the second EEG feature representation, and to perform three-fold cross-modal contrastive learning; the first EEG feature representation and the second EEG feature representation are concatenated as conditional input, and the visual stimulus image is used as the image input to fine-tune the diffusion generation model; The reasoning and reconstruction module is configured to extract features from the EEG signal to be reconstructed through two encoding paths and splice them together during the reasoning stage. The result is then input into a fine-tuned diffusion generation model to generate a reconstructed visual image.

9. An electronic device comprising a central processing unit and a memory, characterized in that, The central processing unit is used to invoke and run a computer program stored in the memory to perform the steps of the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores, in the form of computer-readable instructions, a computer program implemented according to any one of claims 1 to 7, which, when invoked by a computer, executes the steps included in the corresponding method.