---
title: 'RSM-CoDG: EEG Emotion Recognition Framework'
url: https://www.emergentmind.com/topics/rsm-codg
type: topic
---

# RSM-CoDG: EEG Emotion Recognition Framework

RSM-CoDG (Region-aware Spatiotemporal Modeling with Collaborative Domain Generalization) is a unified deep learning framework designed for robust cross-subject EEG-based emotion recognition, addressing the challenges of substantial inter-subject variability and nonstationary distribution shifts in multi-subject emotion datasets such as SEED, SEED-IV, and SEED-V. RSM-CoDG integrates neuroscience-informed region-based spatial modeling, multi-scale temporal feature extraction, and a multi-faceted collaborative domain generalization scheme employing explicit feature alignment and bias-suppression constraints [2601.15615].

## 1. Neuroscience-Informed Region-Aware Spatial Modeling

RSM-CoDG’s spatial encoding leverages explicit anatomical priors by partitioning the 62-channel EEG setup (10–20 system) into six functionally motivated regions: frontal (14 electrodes), central (10), parietal (14), left temporal (6), right temporal (6), and occipital (12). Each region reflects established cortical substrates for emotion regulation, sensory integration, language processing, prosody, and visual emotion perception. This partition constrains the region-level feature extraction process to preserve physiological interpretability and strictly prevent nonphysiological cross-region connections.

Spatial modeling is realized via the Region-aware Graph Representation Module (RGRM), which contains two main branches per anatomical region: a continuous (regional mean) branch and a sparse branch selecting the region’s most informative neighbor for each electrode. Outputs are adaptively fused per electrode via a sigmoid-gated combination, and the fused representations are pooled and linearly projected. For cross-subject comparability, each subject is first aligned with a subject-specific linear calibration $W_s$; during inference, the model employs the population mean $W_{\rm avg}$ for unseen subjects. The RGRM thus encodes region-level functional activity while regularizing spatial variability across individuals.

| Region         | Electrodes                    | Core Functions                           |
|----------------|------------------------------|------------------------------------------|
| Frontal        | FP1, FPZ, ..., F8            | Emotion regulation, valence processing   |
| Central        | FC3, FC1, ..., C4            | Somatosensory, motor control             |
| Parietal       | CP3, CP1, ..., P8            | Attention, spatial perception            |
| L. Temporal    | FT7, FC5, T7, ..., CP5       | Auditory emotion, memory                 |
| R. Temporal    | FC6, FT8, C6, ..., TP8       | Prosody, facial emotion                  |
| Occipital      | PO7, ..., O2, CB2            | Visual emotion processing                |

## 2. Multi-Scale Temporal Modeling

Post-spatial features are passed to the Multi-Scale Temporal Transformer (MSTT), which models short- and long-range temporal dependencies of emotional EEG dynamics using dual masked attention mechanisms:

- **Local Dynamics Encoder:** A sliding-window restricted attention extracts local context within a defined temporal radius $w$ via mask $M_{\rm loc}$, promoting sensitivity to rapid transitions and transient features.
- **Global Dependency Encoder:** A sparse, periodic mask $M_{\rm sprs}$ (sampling every $p$ steps) enables long-range attention, capturing session-level and global temporal structure.

Outputs are concatenated and fused, with temporal-attention weights computed to summarize the sequence into a single subject-level embedding $z$. The fusion strategy provides the capacity to model both rapidly fluctuating and sustained affective neural states, which are critical for emotion recognition.

## 3. Collaborative Domain Generalization (CoDG)

RSM-CoDG employs a composite domain generalization module to suppress subject-specific bias and promote cross-subject invariance via three constraint mechanisms:

- **Maximum Mean Discrepancy (MMD):** Enforces feature-level alignment by minimizing the mean domain distance between all cross-subject pairs for the orthogonally projected embeddings $f_{\rm orth}$.
- **Contrastive Attention Loss:** Encourages consistent spatiotemporal attention profiles within the same subject and sharpens inter-subject discrimination via InfoNCE-style objectives over spatial and temporal attention embeddings.
- **Orthogonality Loss:** Forces projected representations toward mutual decorrelation, minimizing redundancy and facilitating transferability.

The final loss is a weighted sum of classification (negative log-likelihood), MMD, contrastive, and orthogonality components:
\[
\mathcal L_{\rm total} = \mathcal L_{\rm cls}
  + \lambda_1\,\mathcal L_{\rm contrast}
  + \lambda_2\,\mathcal L_{\rm orth}
  + \lambda_3\,\mathcal L_{\rm mmd}
\]

## 4. Model Architecture and Training Workflow

The end-to-end RSM-CoDG flow includes: subject-specific linear alignment, RGRM spatial encoding, MSTT temporal modeling, CoDG feature/post-attention embedding, and final softmax classification. Training employs mini-batch stochastic optimization, with the pseudocode structure as follows:

```python
for epoch in 1..E:
    for (X_raw, labels, subjects) in DataLoader:
        W_batch = [W_s or W_avg for each subject in batch]
        X = X_raw @ W_batch
        # RGRM with regional spatial fusion
        # MSTT with dual-masked Transformer
        # CoDG for bias suppression
        # Classifier / loss calculation
        backprop L_total
```

All design choices—functional region partition, dual-path temporal attention, and collaborative constraints—are directly implemented per the published structure.

## 5. Experimental Results and Comparative Performance

Experiments are conducted on the SEED (3-class), SEED-IV (4-class), and SEED-V (5-class) benchmarks, using differential entropy features across five frequency bands and standardized LOSO protocol. RSM-CoDG demonstrates consistent SOTA performance:

| Dataset   | Best Prior          | Accuracy (% ± Std) | RSM-CoDG (% ± Std) |
|-----------|---------------------|--------------------|--------------------|
| SEED      | R2G-STNN            | 84.2 ± 7.6         | **86.4 ± 7.2**     |
| SEED-IV   | MAS-DGAT-Net        | 70.2 ± 9.1         | **71.6 ± 9.8**     |
| SEED-V    | DMMR                | 60.3 ± 11.5        | **62.8 ± 8.9**     |

Ablation on modules and loss terms further validates each component’s contribution to generalization and accuracy.

Variant Removal (Ablation Study):

| Module/Loss Omitted | SEED | SEED-IV | SEED-V |
|---------------------|------|---------|--------|
| w/o SubjectAlign    | 84.3 | 70.1    | 61.0   |
| w/o RGRM            | 82.3 | 67.6    | 58.3   |
| w/o MSTT            | 81.3 | 67.1    | 59.7   |
| w/o CoDG            | 80.1 | 65.1    | 57.6   |
| **Full**            | 86.4 | 71.6    | 62.8   |

Loss Term Ablation:

| Loss Term Omitted   | SEED | SEED-IV | SEED-V |
|---------------------|------|---------|--------|
| − MMD               | 82.9 | 68.6    | 59.4   |
| − Contrastive       | 84.4 | 68.9    | 61.5   |
| − Orthogonal        | 85.7 | 71.1    | 62.4   |
| **Full**            | 86.4 | 71.6    | 62.8   |

## 6. Interpretability and Feature Analysis

RSM-CoDG provides interpretable spatiotemporal features. t-SNE visualizations demonstrate progressive class disentanglement through each model stage, culminating in the most compact clusters after full CoDG regularization. Attention-based scalp maps recover known physiological findings: positive emotions are linked to left-lateralized frontal activation, while negative emotions engage right-dominant frontal and temporal regions, validating the framework’s physiological plausibility.

## 7. Context, Significance, and Future Directions

RSM-CoDG systematically combines neuroscientific priors, advanced temporal modeling, and robust domain generalization for cross-subject EEG emotion recognition, consistently outperforming prior DG, GCN, and adversarial baseline methods [2601.15615]. The explicit region partition enables physiologically-grounded interpretability, while the triply-constrained CoDG module target subject-invariant representation and scalable deployment to unseen users. 

A plausible implication is this approach could extend to other cross-domain affective, cognitive, or BCI tasks involving strongly nonstationary or population-varying physiological data. Potential future work includes adaptation for low-density EEG, application to real-time settings, or integration with multimodal neuroimaging inputs.

Source: https://www.emergentmind.com/topics/rsm-codg