Spatiotemporal graph transformer method for epilepsy stereoelectroencephalogram signal reconstruction
Patent Information
- Application Number
- CN202611259787.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-10-30
AI Technical Summary
一类方法将脑电信号视为一般时间序列进行建模,主要借助序列网络学习信号随时间变化的规律,虽然能够刻画较长程的时间依赖,但缺乏对电极三维空间分布的显式表达,未能充分利用脑内电极之间的空间位置关系和解剖结构信息,在稀疏采样条件下对未观测区域的推断能力受到限制
本发明通过将电极三维坐标、图拓扑结构和脑区解剖先验经混合空间位置编码融入由短时傅里叶变换得到的动态时频特征流,使每个节点在进入重建主干之前即具备明确的空间身份和生物学语义,从而在稀疏且非均匀植入条件下能够更有效地推断未观测区域的信号。借助几何偏置和功能偏置共同调节的图Transformer,节点间的信息传播不仅取决于内容相似性,还受到空间结构和功能关联的约束,由此既缓解了仅依赖时间序列建模或局部图聚合所导致的空间约束不足问题,又在重建的同时输出反映各观测节点对目标节点贡献关系的交互矩阵,提升了模型的可解释性。通过沿频率维渐进上采样而保持时间维不变的解码方式,以及在重建损失基础上引入多尺度判别器和感知损失的两阶段细化训练,有效缓解了仅采用确定性损失训练时产生的频谱过平滑现象,使重建结果在高频区域能够恢复出更清晰的时频结构。
Smart Images

Figure CN122997709A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to electroencephalogram (EEG) signal processing technology, and in particular to a spatiotemporal graph Transformer method for stereotactic EEG signal reconstruction in epilepsy. Background Technology
[0002] Stereotactic electroencephalography (EEG) is an important technique for preoperative assessment of epilepsy. By implanting deep electrodes at different locations within the brain, it can record the electrical activity of deep brain structures. Compared to scalp EEG, it has higher spatial resolution and stronger focal identification capabilities, and is therefore widely used for preoperative localization and epileptogenic network analysis in patients with drug-resistant epilepsy. However, the signal acquisition of stereotactic EEG is constrained clinically by multiple factors, including surgical risks, patient anatomy, and actual diagnostic and treatment needs. Electrodes typically cover only a limited number of brain regions, and the acquired signals are often sparse and non-uniformly distributed spatially. Furthermore, significant differences exist among patients in the number of electrodes, contact points, covered brain regions, and spatial locations, making it difficult to fully reflect the propagation process of epileptic activity throughout the entire brain. Meanwhile, epilepsy-related neural activity typically contains strong transient characteristics and high-frequency components in both the time and frequency domains. The recovery of these fine-grained time-frequency structures, especially high-frequency information, is directly significant for the localization of epileptogenic zones and the analysis of propagation patterns.
[0003] To address the need for inferring and reconstructing EEG signals in unobserved regions under limited observation conditions, several technical approaches have been proposed. One type of method models EEG signals as general time series, primarily relying on sequence networks to learn the patterns of signal changes over time. While this approach can characterize long-range time dependencies, it lacks an explicit representation of the three-dimensional spatial distribution of electrodes and fails to fully utilize the spatial relationships and anatomical information between electrodes within the brain. This limits its ability to infer unobserved regions under sparse sampling conditions. Another type of method represents EEG leads as nodes in a graph structure, learning the relationships between different channels through graph networks. This introduces the idea of graph modeling, but it typically focuses only on local connectivity, lacking a unified utilization of global topological structure, three-dimensional spatial geometry, and prior anatomical information of brain regions, resulting in insufficient spatial constraints. In addition, a significant number of reconstruction methods employ deterministic optimization objectives such as mean squared error and L1 loss. While these methods help reduce average error, they tend to generate averaged results, causing the reconstructed signal to be overly smoothed in the high-frequency band and transient structures, making it difficult to recover sharp time-frequency textures. Furthermore, most of these methods only output the reconstructed signal itself and cannot provide a description of the contribution relationship between each observation node and the reconstruction of the target node. The interpretability of the model is weak, which is not conducive to subsequent propagation path analysis and brain network interaction analysis.
[0004] Therefore, under the condition of sparse and non-uniform sampling in stereotactic electroencephalography, how to simultaneously utilize the temporal and frequency characteristics of the observed electrodes, the three-dimensional spatial priors of the electrodes, the graph topological priors, and the anatomical priors of the brain regions when reconstructing signals of unobserved electrode nodes, in order to obtain high-fidelity reconstruction results that can reflect the contribution relationship between nodes, remains an unsolved problem. Summary of the Invention
[0005] The purpose of this invention is to provide a spatiotemporal graph Transformer method for stereotactic electroencephalogram (EEG) signal reconstruction in epilepsy. Under the condition of sparse and non-uniform sampling of stereotactic EEG, this method comprehensively utilizes the time-frequency characteristics of the observed electrodes, the three-dimensional spatial priors of the electrodes, the graph topological priors, and the anatomical priors to perform high-fidelity reconstruction of signals from unobserved electrode nodes. During the reconstruction process, it outputs an interaction matrix that reflects the contribution relationship between nodes, thereby improving the inference ability of signals from unobserved regions and the interpretability of the model.
[0006] To achieve the above objectives, the present invention provides the following technical solution.
[0007] A spatiotemporal graph Transformer method for stereotactic electroencephalogram (EEG) signal reconstruction in epilepsy includes: The system acquires continuous stereotactic EEG raw signals and static metadata corresponding to each electrode node. The static metadata includes the three-dimensional coordinates of the electrode node, brain region labels, and tissue component proportions. The continuous stereotactic EEG raw signals are segmented according to fixed time windows. A short-time Fourier transform is performed on the time window signal corresponding to each electrode node to obtain a complex spectrum. The logarithmic amplitude spectrum is taken as the dynamic input feature. The dynamic input features are input into the node-level convolutional encoder for multi-scale convolutional feature extraction. The outputs of each scale branch are then fused along the channel dimension and subjected to adaptive pooling and linear mapping to obtain node dynamic features of a unified dimension. A hybrid spatial location code is constructed for each electrode node. The hybrid spatial location code is formed by adding the three-dimensional geometric location code obtained by sinusoidal and cosine coding of the three-dimensional coordinates of the node, the topological structure code obtained by feature decomposition and mapping of the normalized graph Laplacian matrix of the graph formed by the spatial distribution of electrodes, and the anatomical code obtained by embedding and projecting the brain region labels and tissue component ratios to form a node static prior representation. The node static prior representation is added to the node dynamic feature residual as the input of the backbone network. Using each electrode node as a graph node, an initial k-nearest neighbor graph is constructed in Euclidean space based on the node's 3D coordinates. For the target node to be reconstructed, its true dynamic features are not used, but instead a shared learnable query vector is used. For the observed node, its true dynamic features are retained. An adjacency relationship that integrates spatial proximity and functional similarity is constructed. The edge weight of the spatially nearest node is determined by the functional similarity and the Gaussian decay term of the spatial distance. The edge weight of the non-spatially nearest node is set to zero. The backbone network input is fed into a multi-layer geometry-functional bias graph Transformer to model cross-node information propagation. In each layer, the query matrix, key matrix, and value matrix are obtained by linear mapping of node features, and attention scores are calculated. At the same time, geometric bias determined by the Euclidean distance of node 3D coordinates and functional bias determined by adjacency relationship are introduced. After adding geometric bias and functional bias as additive terms to the attention score and normalizing, attention weights are obtained. The node interaction matrix formed by the aggregation of these attention weights is used as one of the outputs. The hidden representation of the target node after multi-layer propagation is fed into a decoder that progressively upsamples along the frequency dimension while keeping the time dimension unchanged, and the frequency resolution of the spectrum is restored step by step to output the reconstructed logarithmic magnitude spectrum of the target node. A two-stage approach is used to train the generator, which includes the node-level convolutional encoder, geometric-functional bias graph Transformer, and decoder. In the first stage, only the reconstruction loss is used to enable the generator to learn the overall spectrum profile. In the second stage, a multi-scale discriminator that works on inputs with different resolutions is introduced. The reconstruction loss, adversarial loss, and perceptual loss based on the intermediate features of the discriminator are combined to refine the generated logarithmic magnitude spectrum.
[0008] As a preferred embodiment of the present invention, the tissue component ratio in the static metadata is the ratio of gray matter to white matter at the electrode location, and the original stereotactic EEG signal adopts a bipolar lead form after bipolar rereference.
[0009] As a preferred technical solution of the present invention, the node-level convolutional encoder adopts a multi-scale convolutional branch structure, with each branch based on a 3×3 convolution operator. The fine-scale branch is used for local detail modeling, while the medium-scale branch and the coarse-scale branch gradually expand the receptive field through stride convolution to capture a wider range of spectral semantic information. The output features of each branch are fused in the channel dimension and then subjected to adaptive pooling and linear mapping to obtain node dynamic features of a unified dimension.
[0010] As a preferred technical solution of the present invention, the topological structure encoding is to perform eigenvalue decomposition on the normalized graph Laplacian matrix, extract the eigenvectors corresponding to the first few non-zero minimum eigenvalues, and obtain the embedded representation through a mapping network.
[0011] As a preferred embodiment of the present invention, the initial k-nearest neighbor graph is constructed using a symmetric k-nearest neighbor method, and k is set to 8; the adjacency relationship is determined by the following formula:
[0012] in This represents a measure of functional similarity. , Representing nodes respectively , The three-dimensional coordinates Represents a node of Nearest neighbor set The spatial attenuation bandwidth is scaled proportionally to the median of the pairwise Euclidean distances between the subject's internal electrode coordinates.
[0013] in This is the proportionality coefficient.
[0014] As a preferred technical solution of the present invention, in each layer of the geometry-functional bias graph Transformer, the nodes For nodes Attention score
[0015] The geometric bias is as follows:
[0016] The functional bias is derived from the adjacency weight, i.e. The geometric bias and functional bias are added as additive terms to the attention score to obtain the result.
[0017] Attention weights are then obtained after normalization.
[0018] in , These are the query vector and the key vector, respectively. The dimension of the key vector. For geometric bias bandwidth, , These are the weighting coefficients for geometric bias and functional bias, respectively.
[0019] As a preferred technical solution of the present invention, the decoder is composed of several levels of asymmetric two-dimensional transposed convolutional layers. The stride of the transposed convolution is set to 2 in the frequency dimension and 1 in the time dimension. After each level of decoding, the feature map is upsampled by about 2 times in the frequency dimension while the time dimension remains unchanged, thereby restoring the spectral resolution step by step along the frequency dimension and keeping the time boundary unblurred.
[0020] As a preferred embodiment of the present invention, the multi-scale discriminator consists of two sub-discriminators based on PatchGAN. One sub-discriminator operates on the logarithmic magnitude spectrum at the original resolution, and the other sub-discriminator operates on the logarithmic magnitude spectrum after downsampling. Both sub-discriminators adopt a fully convolutional structure and introduce spectral normalization in the convolutional layer. Their output is a patch-level true / false rating map. During training, the discriminator is optimized using multi-scale hinge loss.
[0021] As a preferred embodiment of the present invention, the reconstruction loss in the first stage is
[0022] in The L1 distance between the generated logarithmic magnitude spectrum and the true value. To reconstruct the loss weights, a series-level masking strategy is adopted for both training and inference. Multiple adjacent bipolar channels on the same electrode rod are simultaneously masked as target nodes, and then the target nodes are reconstructed by the remaining observation nodes.
[0023] Compared with the prior art, the present invention has the following beneficial effects: This invention integrates electrode 3D coordinates, graph topology, and brain region anatomical priors into a dynamic time-frequency feature stream obtained by short-time Fourier transform through hybrid spatial location encoding. This ensures that each node possesses a clear spatial identity and biological semantics before entering the reconstruction backbone, enabling more effective inference of signals in unobserved regions under sparse and non-uniform implantation conditions. Utilizing a graph Transformer jointly regulated by geometric and functional biases, information propagation between nodes depends not only on content similarity but also on spatial structure and functional associations. This alleviates the insufficient spatial constraints caused by relying solely on time-series modeling or local graph aggregation, and simultaneously outputs an interaction matrix reflecting the contribution relationship between each observed node and the target node, improving model interpretability. By using a decoding method that progressively upsamples along the frequency dimension while maintaining time dimension invariance, and introducing a multi-scale discriminator and a two-stage refinement training based on the reconstruction loss, the over-smoothing of the spectrum caused by training with only deterministic loss is effectively mitigated, allowing the reconstruction results to recover a clearer time-frequency structure in the high-frequency region. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of the overall architecture of the spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to the present invention. Detailed Implementation
[0025] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0026] See Figure 1 The spatiotemporal graph Transformer method for stereotactic EEG signal reconstruction in epilepsy provided in this embodiment is implemented collaboratively by a heterogeneous spatiotemporal information encoding module, a graph construction module, a geometric-functional bias graph Transformer module, a frequency-dimensional progressive decoding module, an adversarial refinement training module, and a result output module. Its basic idea is to first encode the original stereotactic EEG signal into node dynamic features, then fuse the spatial and anatomical priors of the nodes, subsequently use a graph Transformer with geometric and functional biases to model cross-node information propagation, and finally generate the reconstructed spectrum of the occluded target node and output the inter-node interaction matrix formed by attention aggregation.
[0027] In the data preparation phase, continuous stereotactic EEG raw signals and static metadata corresponding to each electrode node are first acquired. The static metadata includes the three-dimensional coordinates of the electrode node, the label of the brain region it belongs to, and tissue composition information such as the ratio of gray matter to white matter at the electrode location. The raw stereotactic EEG signal is processed in a bipolar lead form after bipolar rereference to suppress common-mode interference and highlight local electrical activity. Under typical implementation conditions, the sampling rate is set to 200Hz, the bandpass filter range is set to 0.5 to 50Hz, the time window length is set to 10 seconds, and the time spectrum obtained from each time window is represented as a fixed-size tensor for subsequent unified processing by the network. After segmenting the continuous signal according to the above fixed time window, a short-time Fourier transform is performed on the time window signal corresponding to each node to obtain a complex spectrum, and then its logarithmic amplitude spectrum is taken as the dynamic input feature. It should be noted that the input feature is not limited to the short-time Fourier transform logarithmic amplitude spectrum; without departing from the core idea of this invention, wavelet time-frequency plots or joint time-domain and frequency-domain representations can also be used.
[0028] See Figure 1On the left, the dynamic input features are fed into a node-level convolutional encoder for multi-scale feature extraction. This encoder employs a multi-scale convolutional branch structure to model local patterns at different spectral scales. Each branch uses a 3×3 convolution as its basic operator, with the fine-scale branch focusing on local detail modeling, while the medium-scale and coarse-scale branches gradually expand the receptive field through stride convolution to capture a wider range of spectral semantic information. The output features from each branch are fused along the channel dimension, then subjected to adaptive pooling and linear mapping to finally obtain a unified-dimensional node dynamic feature representation. This process transforms the original spectrogram into a compact semantic vector suitable for subsequent processing of the graph model, enabling subsequent cross-node modeling to be performed in a unified feature space.
[0029] In parallel with node dynamic feature extraction, this embodiment constructs a hybrid spatial location coding system. See also Figure 1 The lower left section describes the hybrid spatial location encoding, which comprises at least three parts. The first part is three-dimensional geometric location encoding, i.e., the three-dimensional coordinates of each node. The first part involves sine and cosine position encoding, which is then concatenated to obtain a geometric position vector, allowing coordinate information to enter the network in a continuous and differentiable manner. The second part is topological encoding. After constructing an initial graph based on the electrode spatial distribution, the normalized graph's Laplacian matrix undergoes eigenvalue decomposition, extracting the eigenvectors corresponding to the first few non-zero minimum eigenvalues. This is then used to obtain a topological embedding through a mapping network, thus introducing global topological information about the electrode distribution. The third part is anatomical encoding. This involves embedding the brain region labels corresponding to the electrodes and projecting tissue information such as the gray-to-white matter ratio into vectors, which are then fused with the brain region embeddings. Finally, the three encoding methods are summed to form a static prior representation of the nodes. This information is then added to the node's dynamic feature residuals and used as input to the backbone network. In this way, each node carries a clear spatial identity and biological semantics before entering the backbone network, rather than being an unordered feature vector.
[0030] See Figure 1 In the middle section, the graph construction phase begins. This embodiment uses each stereotactic EEG electrode node or bipolar lead as a graph node. An initial k-nearest neighbor graph is constructed in Euclidean space based on the node's three-dimensional coordinates. A symmetrical k-nearest neighbor approach is preferred, with k equal to 8 to control graph sparsity while maintaining local connectivity. To prevent information leakage from the target node during training and inference, the actual dynamic features of the target node are not directly used in the graph construction and backbone input phases. Instead, a shared learnable query vector is employed. This involves substitution. That is, the observed nodes retain their true dynamic characteristics, while the target nodes are represented by a shared query vector, preserving only their static spatial identity and prior knowledge. This design allows the target nodes to participate in information propagation on the graph without introducing their true information.
[0031] Based on the initial graph, an adjacency matrix is further constructed that integrates spatial proximity and functional similarity. For spatially nearest neighbor pairs, the edge weight is determined by both functional similarity and the Gaussian decay term of spatial distance; for non-spatially nearest neighbor pairs, the edge weight is set to zero. Specifically, the adjacency matrix is defined as follows:
[0032] in The measure of functional similarity can be cosine similarity in this embodiment. , For the node features involved in similarity calculation, , For the three-dimensional coordinates of the node, Represents a node The set of k-nearest neighbors. Spatial attenuation bandwidth. An adaptive setting is used, scaling proportionally to the median of the pairwise Euclidean distances between the subject's internal electrode coordinates.
[0033] in This is the scaling factor. Through this adaptive bandwidth setting, adjacency relationships can reflect both the spatial propagation patterns within the brain and the correlation between actual signals, avoiding attenuation scale mismatch caused by differences in electrode spacing among different patients. It should be noted that functional similarity measures are not limited to cosine similarity; Pearson correlation coefficient, mutual information, or other similarity functions can also be used. Graph construction methods can also employ geometric graphs, functional graphs, or a fusion of these.
[0034] See Figure 1 The core of this embodiment, located on the right side, is the geometry-functional bias graph Transformer module. Let the first... Layer input node features are First, the query matrix is obtained through linear mapping. Key matrix Sum matrix For nodes and nodes Standard self-attention score
[0035] in , They are nodes , The corresponding query vector and key vector, This represents the key vector dimension. Based on this, geometric bias and functional bias are also introduced. Geometric bias is calculated based on the Euclidean distance between the node's 3D spatial coordinates:
[0036] in This is the geometric bias bandwidth. The functional bias is given by the adjacency matrix weights, i.e. Then, the two types of biases were added as additive terms to the attention score, resulting in...
[0037] The final attention weights are obtained through normalization.
[0038] in , These are the weight coefficients for geometric bias and functional bias, respectively. Thus, information propagation between nodes depends not only on content similarity but also on spatial structure and functional association. Regarding input format, an asymmetric input mechanism is used for both observation and target nodes. The observation node input is a combination of dynamic features and static priors, while the target node input is a combination of a shared query vector and static priors. This ensures that the target node does not leak the actual content to be predicted while preserving its spatial location and anatomical context. The aforementioned attention weights... While aggregating across nodes, an interaction matrix between nodes is formed, which can be output by the result output module to characterize the contribution relationship of each observed node to the reconstruction of the target node, thereby providing a basis for epilepsy transmission path analysis and brain network interaction analysis.
[0039] After multi-layer geometry-functional bias graph Transformer propagation modeling, the hidden representation of the target node is entered into the decoder. See also Figure 1In the lower right section, this embodiment employs a frequency-dimensional progressive decoding structure. Unlike ordinary two-dimensional symmetric upsampling, this approach only recovers the spectral resolution along the frequency dimension, while maintaining the time dimension. In implementation, this process is accomplished through an asymmetric two-dimensional transposed convolutional layer. The stride of the transposed convolution is set to 2 for the frequency dimension and 1 for the time dimension. The frequency stride is used to progressively increase the frequency resolution, while the time stride is used to maintain the time dimension size. Correspondingly, the convolution kernel size can be set to 4×3 or 2×3, where the first dimension corresponds to the frequency direction and the second dimension corresponds to the time direction. Thus, after each decoding module, the feature map undergoes approximately a 2x upsampling in the frequency dimension, while the time dimension remains unsampled, thereby achieving frequency-dimensional progressive decoding. This avoids blurring the temporal boundaries of epilepsy-related transient events while gradually recovering fine-grained frequency texture. The decoder ultimately outputs the logarithmic amplitude spectrum of the target node to be reconstructed, which can be further restored to a time-domain stereotactic EEG waveform via inverse short-time Fourier transform if necessary.
[0040] To improve high-frequency fidelity, this embodiment employs a two-stage training method for the generator. In the first stage, only L1 reconstruction loss is used to train the generator, allowing the model to learn the overall spectral profile. The loss in this stage is...
[0041] in The L1 distance between the generated logarithmic magnitude spectrum and the true value. To address the reconstruction loss weights, a multi-scale discriminator is introduced in the second stage to refine the generated spectrogram. This multi-scale discriminator consists of two PatchGAN-based sub-discriminators, operating on inputs at different resolutions to simultaneously model local spectral texture and global spectral structure. One sub-discriminator operates on the original resolution spectrogram, while the other operates on the downsampled spectrogram. Both sub-discriminators employ a fully convolutional PatchGAN structure, introducing spectral normalization in all convolutional layers for stable training. Their output is a patch-level true / false rating map rather than a single scalar. During training, the discriminator is optimized using a multi-scale hinge loss, while the generator uses a combination of reconstruction loss, adversarial loss, and perceptual loss based on intermediate discriminator features to refine the generated spectrogram. Therefore, the total generator loss in the second stage can be expressed as a weighted sum of reconstruction loss, adversarial loss, and perceptual loss. The reconstruction loss ensures the correctness of the reconstructed content, while the adversarial and perceptual losses are used to recover high-frequency time-frequency textures. The weights of each loss term can be adjusted during implementation based on training stability and reconstruction quality. Without adversarial refinement, the model output exhibits significant spectral oversmoothing. Introducing adversarial refinement results in a clearer and sharper time-frequency structure in the high-frequency region. Besides generative adversarial networks, other generative refinement structures can also be used to implement the aforementioned refinement training mechanism.
[0042] A specific implementation example is given below. Taking single-patient stereotactic EEG data as an example, the input data uses bipolar lead signals after bipolar rereference, with a sampling rate of 200Hz, a bandpass filter range of 0.5 to 50Hz, a time window length of 10 seconds, and the input spectrum represented with a fixed size. In this embodiment, both training and inference employ a serial occlusion strategy, that is, multiple adjacent bipolar channels on the same electrode rod are simultaneously occluded as target nodes, and then the target nodes are reconstructed by the remaining observation nodes. This occlusion method is closer to the actual application scenario in clinical practice where local areas are not implanted or cannot be observed, so that the model faces the observation condition of large areas of missing data during the training phase.
[0043] This invention is also applicable to heterogeneous data environments involving multiple patients. In multi-patient scenarios, the number of bipolar channels, brain region coverage, and electrode distribution may vary among different patients. To achieve unified modeling, the channels of different patients can be sorted and aligned, and then a uniform number of nodes can be used as model input. This extends the invention to cross-patient applications without changing the aforementioned encoding, graph construction, propagation modeling, and decoding processes.
[0044] It should be noted that the sampling rate, filtering range, time window length, nearest neighbor number k, convolution kernel size, similarity metric, graph construction method, and input feature form given in the above embodiments are specific values or implementation methods provided for ease of understanding of the present invention. Those skilled in the art can make corresponding substitutions without departing from the core idea of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A spatiotemporal graph Transformer method for stereotactic electroencephalogram (EEG) signal reconstruction in epilepsy, characterized in that, include: The continuous stereotactic EEG raw signal and the static metadata corresponding to each electrode node are acquired. The static metadata includes the three-dimensional coordinates of the electrode node, brain region labels and tissue component ratios. The continuous stereotactic EEG raw signal is segmented according to a fixed time window. The short-time Fourier transform is performed on the time window signal corresponding to each electrode node to obtain the complex spectrum. The logarithmic amplitude spectrum is taken as the dynamic input feature. The dynamic input features are input into a node-level convolutional encoder for multi-scale convolutional feature extraction. The outputs of each scale branch are then fused along the channel dimension and subjected to adaptive pooling and linear mapping to obtain node dynamic features of a unified dimension. A hybrid spatial location code is constructed for each electrode node. The hybrid spatial location code is formed by adding the three-dimensional geometric location code obtained by sinusoidal and cosine encoding of the three-dimensional coordinates of the node, the topological structure code obtained by feature decomposition and mapping of the normalized graph Laplacian matrix of the graph formed by the spatial distribution of electrodes, and the anatomical code obtained by embedding and projecting the brain region labels and tissue component proportions to form a node static prior representation. The node static prior representation is added to the node dynamic feature residual as the input of the backbone network. Using each electrode node as a graph node, an initial k-nearest neighbor graph is constructed in Euclidean space based on the node's three-dimensional coordinates. For the target node to be reconstructed, its true dynamic features are not used but instead a shared learnable query vector is used. For the observation node, its true dynamic features are retained, and an adjacency relationship that integrates spatial proximity and functional similarity is constructed. The edge weight of the spatial nearest neighbor node is determined by the functional similarity and the Gaussian decay term of the spatial distance. The edge weight of the non-spatial nearest neighbor node is set to zero. The backbone network input is fed into a multi-layer geometry-functional bias graph Transformer for cross-node information propagation modeling. In each layer, the query matrix, key matrix, and value matrix are obtained by linear mapping of node features, and attention scores are calculated. At the same time, the geometric bias determined by the Euclidean distance of the node's three-dimensional coordinates and the functional bias determined by the adjacency relationship are introduced. The geometric bias and the functional bias are added as additive terms to the attention score and then normalized to obtain attention weights. The node interaction matrix formed by aggregating the attention weights is used as the output. The hidden representation of the target node after multi-layer propagation is fed into a decoder that progressively upsamples along the frequency dimension while keeping the time dimension unchanged, and the frequency resolution of the spectrum is restored step by step to output the reconstructed logarithmic magnitude spectrum of the target node. A two-stage approach is used to train the generator, which includes the node-level convolutional encoder, the geometry-functional bias map Transformer, and the decoder. In the first stage, only the reconstruction loss is used to enable the generator to learn the overall spectrum profile. In the second stage, a multi-scale discriminator that works on inputs with different resolutions is introduced. The generated logarithmic magnitude spectrum is refined by combining the reconstruction loss, the adversarial loss, and the perceptual loss based on the intermediate features of the discriminator.
2. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The tissue composition ratio refers to the ratio of gray matter to white matter at the electrode location, and the original stereotactic EEG signal is in the form of bipolar leads after bipolar rereference.
3. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The node-level convolutional encoder adopts a multi-scale convolutional branch structure. Each branch is based on a 3×3 convolution operator. The fine-scale branch is used for local detail modeling, while the medium-scale and coarse-scale branches gradually expand the receptive field through stride convolution. The output features of each branch are fused in the channel dimension and then subjected to adaptive pooling and linear mapping to obtain node dynamic features of a unified dimension.
4. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The topological structure encoding is achieved by performing eigenvalue decomposition on the normalized graph Laplacian matrix, extracting the eigenvectors corresponding to the first few non-zero minimum eigenvalues, and then obtaining the embedded representation through a mapping network.
5. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The initial k-nearest neighbor graph is constructed using a symmetric k-nearest neighbor method with k set to 8, and the adjacency relationships are determined by the following formula: ; in This represents a measure of functional similarity. , They are nodes , The three-dimensional coordinates Represents a node The set of k nearest neighbors, The spatial attenuation bandwidth is determined by the following formula: ; in This is the proportionality coefficient.
6. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, In each layer of the geometry-functional bias graph Transformer, nodes For nodes Attention score The geometric offset is The functional bias is Attention score after adding bias The normalized attention weights are ,in , To query the vector and key vector, The dimension of the key vector. For geometric bias bandwidth, , These are the weighting coefficients for geometric bias and functional bias, respectively.
7. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The decoder consists of several levels of asymmetric two-dimensional transposed convolutional layers. The stride of the transposed convolution is set to be equal to 2 in the frequency dimension and 1 in the time dimension, so that each decoding feature map is upsampled by about 2 times in the frequency dimension while the time dimension remains unchanged.
8. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The multi-scale discriminator consists of two PatchGAN-based sub-discriminators. One sub-discriminator operates on the logarithmic magnitude spectrum at the original resolution, while the other sub-discriminator operates on the downsampled logarithmic magnitude spectrum. Both sub-discriminators employ a fully convolutional structure and introduce spectral normalization in the convolutional layers. Their output is a patch-level true / false rating map, and the discriminator is optimized using multi-scale hinge loss during training.
9. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The reconstruction loss in the first phase is ,in The L1 distance between the generated logarithmic magnitude spectrum and the true value. To reconstruct the loss weights, a series-level masking strategy is adopted for both training and inference. Multiple adjacent bipolar channels on the same electrode rod are simultaneously masked as target nodes, and then the target nodes are reconstructed by the remaining observation nodes.
10. The spatiotemporal graph Transformer method for stereotactic electroencephalogram signal reconstruction in epilepsy according to claim 1, characterized in that, The target node reconstruction logarithmic amplitude spectrum output by the decoder is restored to a time-domain stereotactic EEG waveform through inverse short-time Fourier transform, and the inter-node interaction matrix formed by the aggregation of the attention weights is output to characterize the contribution relationship of each observation node to the reconstruction of the target node.
