3.1. Model Architecture
EEG, ECG, and EMG in multimodal epilepsy detection differ substantially in sampling characteristics, noise levels, and representation forms. As a result, it is difficult to align and fuse multimodal information within a unified feature space. This section introduces the multimodal detection model CMEpiNet (Complex-valued Multimodal Epilepsy Network), as shown in
Figure 1. The model consists of a Complex-valued Multimodal Feature Extractor (CMFE), a Dual-Level Semantic Alignment Fusion module (DLSAF), and a 3D convolutional neural network with a spatial attention mechanism (3DCSA). The main working mechanism of CMEpiNet is described as follows:
(1) Feature extraction module. We adopt a unified Complex-valued Multimodal Feature Extractor (CMFE) for all modalities. For each modality, CMFE builds an isomorphic dual-branch complex-valued convolutional network. The time-domain-phase branch takes the analytic signal as input and uses 1D complex-valued convolutions to extract sequential oscillatory features from the joint amplitude-phase perspective. The time–frequency branch takes the complex-valued time–frequency spectrum as input and applies 2D complex-valued convolutions to capture band-energy distributions and cross-band coupling patterns. The complex-domain features produced by the two branches are then fused along the feature dimension, forming a modality-level representation that contains both time-domain-phase information and explicit frequency-domain information.
(2) Feature fusion module. Under constraints of cross-modal consistency and shared latent-space alignment, this module models a unified representation of multimodal features. First, the CMFE features of each modality are mapped into an alignment space with a unified dimensionality. For each time segment, a cross-modal consistency constraint is imposed on the EEG, ECG, and EMG features, so that multimodal representations originating from the same epileptic physiological event remain semantically consistent in the feature space. Next, the aligned modality features are projected by their respective projection networks into a shared latent seizure space, and a distribution-level alignment loss is used to reduce the global distribution discrepancies among modalities within this latent space. Finally, the latent representations of the three modalities are stacked along the modality dimension to form a 3D fused feature block that jointly includes the time, feature, and modality dimensions. This approach fully leverages the complementary information across modalities in amplitude-phase structure and time–frequency characteristics.
(3) 3DCSA classification module. A 3D convolutional neural network with an embedded spatial attention mechanism is used to deeply process the 3D fused feature blocks in the shared latent space. The feature block obtained by stacking the latent representations of EEG, ECG, and EMG is denoted as , where the three axes correspond to the time, feature, and modality dimensions. Using 3D convolutions, the network jointly models these three dimensions and progressively extracts both local and global structures of multimodal epileptic patterns. A spatial attention mechanism is then introduced to adaptively learn importance weights for each spatial location in the 3D convolutional feature maps, i.e., different time segments, latent feature channels, and modality combinations. Regions that are more relevant to seizure-state discrimination receive higher responses. Noise and redundant information are suppressed. Finally, the weighted high-dimensional features are flattened and fed into a fully connected layer and a Softmax classifier to output the class probabilities of different epilepsy states.
Figure 1.
Overall framework of CMEpiNet. EEG, ECG, and EMG signals are first encoded by the shared complex-valued feature extractor (CMFE), then aligned across modalities by the dual-level semantic alignment fusion module (DLSAF). The aligned features are stacked into a feature block and classified as seizure or non-seizure by the 3D spatial-attention classifier (3DCSA).
Figure 1.
Overall framework of CMEpiNet. EEG, ECG, and EMG signals are first encoded by the shared complex-valued feature extractor (CMFE), then aligned across modalities by the dual-level semantic alignment fusion module (DLSAF). The aligned features are stacked into a feature block and classified as seizure or non-seizure by the 3D spatial-attention classifier (3DCSA).
3.3. Complex-Valued Multimodal Feature Extractor (CMFE)
Multimodal seizure-related signals show clear heterogeneity in noise statistics and signal structures. Features based only on amplitude or spectral distributions cannot effectively characterize seizure-related changes across different modalities within a unified framework. Existing studies have shown that abnormal changes can be observed before seizure onset. These changes appear in inter-regional phase relationships. They also appear in the temporal organization of neural activity. Such changes occur earlier than prominent discharge events. These findings indicate that phase information plays an important role in seizure prediction. In addition, frequency-domain and time–frequency features complement the temporal information reflected by phase by describing energy organization and dynamic evolution, thereby enabling a more comprehensive representation of the pre-seizure state.
Existing seizure detection methods cannot fully exploit deep oscillatory features in multimodal signals. These features include phase characteristics, time-frequency structures, temporal dependencies, and spatially coordinated changes. This limits the model’s ability to accurately represent complex spatiotemporal dynamics during seizures. To address this limitation, this section proposes a complex-valued multimodal feature extraction module, termed the Complex-valued Multimodal Feature Extractor (CMFE), which consists of a time-domain-phase branch and a time–frequency branch. Both branches are centered on complex-valued convolutions. By jointly processing the real and imaginary parts in the complex domain, the model can preserve phase variations as well as frequency- and amplitude-related information during feature extraction, thereby providing a more complete description of seizure-related dynamics in multimodal signals. This module also helps establish a consistent feature description across modalities, laying the foundation for joint modeling of seizure-related patterns.
CMFE adopts a parallel processing architecture to deeply fuse phase and amplitude-structure information in the complex domain. For each modality, CMFE includes two parallel complex-valued convolutional pathways. The time-domain-phase branch takes the analytic signal as input and focuses on capturing the dynamic characteristics of amplitude and instantaneous phase from the time series. The time–frequency branch takes the complex-valued time–frequency spectrum as input and focuses on extracting band-structure information and cross-band coupling features from the time–frequency plane. Both pathways perform convolution in the complex domain, with one emphasizing sequential phase-related features and the other emphasizing explicit frequency-domain structural features. Their outputs are then efficiently fused along the feature dimension, producing a unified complex-domain feature vector for the modality.
As shown in
Figure 2, CMFE processes each modality’s input time series with two parallel branches—a time-domain/phase complex convolution branch and a time–frequency complex convolution branch, to generate a time-domain feature vector and a time–frequency feature vector, respectively. These vectors are concatenated along the feature dimension to form the CMFE output vector
.
- (1)
Time-domain-phase complex convolution branch
As shown in the upper part of
Figure 2, this branch takes each preprocessed single-channel time series (EEG, ECG, EMG) as input. A Hilbert transform is first applied to construct the corresponding analytic signal:
where
is the original continuous-time signal and
denotes its Hilbert transform. In practical implementations, the signal is discretely sampled at the sampling rate
. The physical time corresponding to the
n-th sample is
Accordingly, the discrete analytic signal
is defined as the value of
at the sampling instants
, i.e.,
After constructing the analytic signal via the Hilbert transform, serves as the real part and serves as the imaginary part. This unified complex representation preserves both amplitude and phase information.
As shown in the middle of the upper part of
Figure 2, the analytic signal
is then fed into a 1D complex-valued convolutional network. The network is composed of three cascaded 1D complex convolution layers, which progressively model oscillatory frequency characteristics and phase variation patterns within a local temporal range.
The complex-valued convolution kernel of the
l-th layer is denoted as
Here, l is the layer index, and and represent the learnable real and imaginary parameters of the l-th complex kernel, respectively.
To enable each kernel to simultaneously select frequency components and model phase variations within a local temporal window, we parameterize the 1D complex kernel of each layer as a Gaussian-windowed complex exponential:
Here,
k is the kernel index;
is the center frequency of the
k-th kernel in layer
l;
controls the temporal support of the Gaussian window; and
is the phase offset parameter. In the discrete implementation, we set
, discretize the kernel, and use it for 1D discrete complex convolution. After expansion, the real and imaginary parts are:
With this parameterization, EEG, ECG, and EMG can be modeled using a unified convolutional kernel form.
The forward propagation of the three complex convolution layers can be written recursively as
where ∗ denotes 1D complex convolution,
is the input analytic signal sequence, and
is the feature map produced by the
l-th layer. The third-layer output
is a complex-valued feature map, whose real and imaginary parts are denoted by
and
, respectively.
In the complex-valued feature map, the real part mainly characterizes amplitude-related features such as response strength within a local temporal range, energy distribution, and waveform shape. The imaginary part is more sensitive to changes in relative timing relationships across time points, and it can be used to describe phase variations, phase discontinuities, and changes in synchronization relationships.
To further reveal the amplitude and phase information contained in the third-layer complex feature map, as shown on the right side of the upper part of
Figure 2, we perform amplitude–phase decomposition only on
to obtain the amplitude and phase components:
Corresponding to “Amplitude
” and “Phase
” in the figure, the amplitude and phase can be computed from the real and imaginary parts of the third-layer output:
Here, is the two-argument arctangent function with quadrant correction.
Amplitude–phase decomposition is applied only to the third-layer output in order to preserve the representational capacity of complex convolution layers while avoiding unnecessary nonlinear decomposition in shallow layers.
The amplitude and phase components are then concatenated along the channel dimension to obtain a joint time-domain representation:
Here, T is the number of time steps within the segment, and denotes concatenation along the channel dimension.
Next, 1D global average pooling (GAP) is applied to
, i.e., a global average over the time dimension is computed for each channel, yielding a fixed-length time-domain feature vector:
Here, denotes the response at the c-th channel and the n-th time step in the joint representation. This operation aggregates amplitude and phase statistics over the entire segment along the time dimension.
Finally, the time-domain feature vector
is passed through a linear transformation and then normalized to obtain the time-domain–phase embedding vector for the segment:
Here,
and
are learnable parameters. The resulting
serves as the time-domain–phase feature vector of the current modality for this segment and is used for final fusion with the output of the other branch (the time–frequency branch).
- (2)
Time–frequency complex convolution branch and feature vector generation
As shown in the lower part of
Figure 2, the time–frequency complex convolution branch takes the discrete analytic signal
(output from the time-domain–phase branch) as input. It first applies the short-time Fourier transform (STFT) to map the 1D complex sequence to a 2D complex-valued time–frequency map
, thereby introducing structural information in the frequency and time–frequency domains. In the continuous-time domain, STFT is defined as
where
is the window function,
f is the frequency variable, and
is the time parameter corresponding to the window position (or window center).
denotes the complex coefficient at the time–frequency point
.
In practice, STFT is implemented in discrete time. Let
be the discrete analytic signal, with window length
L, hop size
H, and FFT size
. The discrete form can be written as
Here,
f is the index of the discrete frequency bin, and
is the time-frame index corresponding to the sliding STFT window along the time axis. After computing STFT for an input segment, we obtain a complex-valued time–frequency map
. Decomposing it into real and imaginary parts yields
That is, the STFT output can be viewed as two real-valued matrices (the real-part matrix and the imaginary-part matrix) defined on the same
grid. Furthermore, note that the analytic signal can be written as
. Since STFT is a linear operator, we have
Therefore, and correspond to the time–frequency projections of the original signal and its Hilbert-orthogonal component , respectively. This indicates that the branch does not apply STFT only to a “real-part signal”; rather, a single transform of the complex analytic signal simultaneously produces both real and imaginary 2D time–frequency maps.
The complex-valued time–frequency map
is then used as a 2D complex input to a 2D complex-valued convolution module. This module contains two sets of learnable parameters for the real and imaginary parts of the complex kernels, corresponding to the “Real Filter”
and “Imaginary Filter”
in
Figure 2. The complex-valued convolution kernel at layer
l is
Corresponding to the “Real Output” and “Imaginary Output” branches in the figure, given an input
and a kernel
, the real and imaginary parts of the 2D complex convolution output
are
where ∗ denotes 2D convolution.
To enable the kernel to characterize structural variations in both local frequency neighborhoods and local time neighborhoods on the time–frequency plane, each 2D complex-valued kernel is parameterized as a Gaussian-windowed complex exponential and is defined along both the frequency and time directions:
Here, and denote the local offsets along the frequency and time directions relative to the kernel center, defining the local receptive region on the time–frequency plane. The parameters and control the effective ranges of the k-th kernel in layer l along the frequency and time directions, respectively. Their values determine the smoothness and effective support size in each direction and thus affect the time–frequency resolution characteristics. The first exponential term forms a 2D Gaussian window that locally constrains the kernel response, focusing it on a limited frequency neighborhood and time neighborhood. The parameters and are the oscillation-center parameters of the complex exponential along the frequency and time directions, respectively, describing the kernel’s selectivity to different frequency-change and time-change patterns. is a phase offset term that adjusts phase alignment in the kernel response. With this Gaussian-windowed complex-exponential parameterization, each 2D complex kernel can jointly model local amplitude-variation structures and phase-evolution characteristics on the time–frequency plane, enabling a unified characterization of complex time–frequency patterns.
The forward propagation of the three 2D complex convolution layers can be written recursively as
is the complex-valued feature map output by the third layer. Its real part mainly reflects the response strength and energy variations of different frequency components within a local temporal range, whereas its imaginary part is more sensitive to phase variations and changes in relative timing relationships between frequency components.
As shown on the right side of the lower part of
Figure 2, we perform amplitude–phase decomposition only on the third-layer complex output
to obtain an amplitude map and a phase map:
The amplitude and phase features are concatenated along the channel dimension to form a joint time–frequency feature map:
Here, denotes concatenation along the channel dimension, which jointly represents amplitude and phase information while keeping the time–frequency resolution unchanged.
To obtain a fixed-length time–frequency feature vector, as shown in
Figure 2, we apply 2D global average pooling to
, i.e., we compute a global average over the entire
time–frequency plane for each channel:
Here, denotes the response of the joint time–frequency feature at channel c and the time–frequency point .
The time–frequency feature vector
is then passed through a linear transformation and normalized to obtain the time–frequency embedding vector of the modality:
where
and
are learnable parameters.
Finally, as shown by “Final Fusion/Concatenation” on the right side of
Figure 2, the time-domain–phase branch output
and the time–frequency branch output
are concatenated along the feature dimension:
Here, denotes vector concatenation. In this way, each modality obtains a unified representation that encodes both time-domain local response characteristics (amplitude–phase) and time–frequency structural variation information, providing a stable input for subsequent multimodal feature fusion and classification.
3.4. Feature Fusion: DLSAF
Multimodal features differ substantially in scale, spectral structure, and statistical characteristics. Simple feature concatenation limits the extraction of effective mutual information and reduces the overall signal-to-noise ratio. In addition, cross-modal response asynchrony and the dynamically non-stationary nature of signal quality further exacerbate the difficulty of feature alignment. Moreover, overly strong cross-modal consistency constraints may excessively compress complementary information across modalities and may also introduce misleading noise.
To address these issues, this section proposes a Dual-Level Semantic Alignment Fusion module (DLSAF), as shown in
Figure 3. DLSAF consists of two components: a cross-modal consistency constraint in an alignment space and distribution alignment in a shared latent space. Specifically, EEG, ECG, and EMG features are first projected into a unified alignment space through learnable Linear-MLP mappings. Within this space, a window-level softmin soft matching mechanism is introduced to accommodate cross-modal asynchrony. In addition, a modality-reliability gating mechanism adaptively weights the constraint strength across different time segments. This design suppresses the negative impact of low-quality modalities on the fused representation while improving robustness, yielding the cross-modal consistency loss
. Next, the aligned modality representations are fed into a Deep-MLP to map them into a shared epilepsy-semantic latent space. Within this space, distribution-level alignment is performed based on reliability-weighted first-order statistics (mean) and second-order statistics (covariance), resulting in the distribution alignment loss
. Finally, the latent representation sequences of the three modalities are stacked along the modality dimension to construct a three-dimensional feature block (3D block), which serves as the input to the subsequent 3D module for joint modeling along the time-modality-feature dimensions.
Let , , and denote the EEG, ECG, and EMG modality feature vectors, respectively, obtained from the feature extraction module at the t-th time segment.
- (1)
Cross-Modal Consistency-Constrained Feature Fusion in the Alignment Space
To align high-level semantic representations of different modalities along the temporal dimension, the features extracted from each modality at each time segment are first mapped into a shared alignment space of the same dimensionality. As illustrated by the Linear-MLP module in
Figure 3, considering that the original feature dimensions and distributions may differ across modalities, a set of learnable linear projections is employed to map each modality into an alignment space of dimension
, formulated as:
Here, and are learnable parameters, and denotes the modality representation in the shared alignment space.
Considering that different modalities may exhibit temporal delays and asynchrony when reflecting the same epileptic state, and that signal quality dynamically fluctuates due to artifacts, missing data, and environmental noise, we adopt a window-level soft matching–reliability gating–modality-pair adaptive weighting strategy for consistency regularization within the alignment space. As shown in the Reliable Window Consistency Branch in
Figure 3, we first define the temporal window set:
where
denotes the window radius (measured in segments).
For any modality
, a reliability weight
is estimated at each time segment
t through a learnable gating mechanism:
where
is implemented as a lightweight fully connected network and
denotes the Sigmoid function. This reliability weight is used to suppress the adverse influence of low-quality modalities or segments on the consistency constraint.
For each modality pair
, using
as the anchor, candidate segments from modality
n within the window
are softly matched. The reliability gating is directly incorporated into the matching distance, yielding the reliability-weighted window matching distance at segment
t:
where
denotes the set of modality pairs. The coefficient
is defined via a
operation within the window (controlled by temperature parameter
):
Here, controls the sharpness of matching within the window. A smaller makes the operation closer to hard minimum matching. This window-based soft matching allows cross-modal asynchrony: when the true semantic correspondence occurs at but satisfies , the constraint will focus on the most consistent candidate segment within the window, thereby suppressing gradient noise caused by forced mismatching.
Next, as illustrated by the
branch in
Figure 3, different modality pairs may exhibit varying consistency levels at the same segment
t. Therefore, a
normalization is further applied across modality pairs over the set
to obtain pairwise weights:
where
controls the sharpness of the weight distribution, assigning larger constraint weights to modality pairs with stronger consistency (smaller distance).
The cross-modal consistency loss at segment
t is then defined as:
and the overall consistency loss across all segments within a sample is computed as:
By minimizing , the model encourages different modalities to form a stable and coherent structure around the same epileptic semantic representation while allowing cross-modal asynchrony. Meanwhile, the reliability gating mechanism mitigates the negative impact of low-quality modalities on the fused representation, thereby improving multimodal synergy and robustness.
After cross-modal consistency regularization, the temporally aligned feature sequences of each modality are expressed as:
- (2)
Shared Latent-Space Alignment for Feature Fusion (Shared Latent Seizure Space)
In the alignment space feature fusion step above, the three modality features are mapped into the same alignment space, and a cross-modal consistency loss
is constructed via window-level soft matching, reliability gating, and modality-pair adaptive weighting. This achieves segment-level local semantic alignment along the temporal dimension. However, because different modalities may still exhibit global shifts in statistical distributions and correlation structures, relying only on local consistency constraints can lead to different distributional patterns in the latent representation space. This may in turn degrade generalization across subjects and under varying noise conditions. To further improve modality invariance at the distribution level, as shown in the pipeline “Deep-MLP → weighted mean/covariance → dist →
” on the right side of
Figure 3, we introduce a shared latent seizure space. In this space, we align the first-order statistics (mean) and second-order statistics (covariance) of modality-specific latent representations to obtain a more compact epilepsy-semantic representation with consistent distributions.
For each time segment
, the modality feature
in the alignment space is fed into the modality-specific Deep-MLP
in
Figure 3, yielding the shared latent-space representation
:
To ensure that global distribution estimation is dominated by high-quality segments, we reuse the reliability weights
obtained in the alignment space feature fusion step above, and define the normalized weight sum as
where
is a numerical stability term. Then, as shown in the “weighted mean/weighted covariance“ modules in
Figure 3, we compute the reliability-weighted mean and covariance of modality
m in the shared latent space. The weighted mean vector is defined as
To further align distributional shapes, we introduce the reliability-weighted covariance matrix:
Based on these statistics, as indicated by “dist →
” in
Figure 3, we jointly characterize modality distribution shifts using differences in means and covariances. The first-order alignment loss is
The second-order (CORAL) alignment loss is
where
denotes the Frobenius norm. Finally, the distribution-level alignment loss is defined as
where
balances the relative strength between mean alignment and covariance alignment. With this distribution alignment mechanism, while ensuring that reliable segments dominate the estimation, the model can simultaneously reduce global center shifts and distribution-shape differences across modalities, thereby producing a more compact and modality-invariant epilepsy-semantic representation.
After shared latent-space alignment, as shown in the stacking module in
Figure 3, the latent representation sequence of modality
m is denoted as
. To facilitate subsequent joint modeling across time–feature–modality by the 3D module, the latent representations of the three modalities are stacked along the modality dimension to form a 3D feature block:
This feature block serves as the input to the subsequent 3D convolution/attention classification module.
Finally, to enable end-to-end optimization for the overall task, we denote the prediction loss as
. The total training loss is:
where
is the cross-modal consistency loss defined in the alignment space feature fusion step above, and
and
balance the contributions of local consistency regularization and distribution-level alignment regularization in the overall objective.