Skip to content

cindy-hong/BiteEEG

Repository files navigation

Bidirectional Time-Frequency Pyramid Network for Enhanced Robust EEG Classification

[BIBM 2025] Bidirectional Time-Frequency Pyramid Network for Enhanced Robust EEG Classification

Overview

BITE is a novel end-to-end deep learning architecture designed to address cross-dataset generalization challenges in EEG classification. The framework combines time-frequency analysis with bidirectional processing, featuring:

  1. Dual-stream processing for synchronized time-frequency analysis
  2. Pyramid attention mechanism for multi-scale feature extraction
  3. Bidirectional temporal learning for comprehensive signal understanding

Prerequisites

  • Python == 3.10.16
  • PyTorch == 2.7.1
  • CUDA == 12.4
  • Additional dependencies in requirements.txt

Install dependencies:

pip install -r requirements.txt

Dataset Preparation

Dataset Links

  1. BCI Competition IV Dataset 2a

  2. BCI Competition IV Dataset 2b

  3. SDSSVEP Dataset

After downloading, organize the datasets in the data/ directory with the following structure:

data/
├── 2a/              # BCICIV-2a dataset
│   ├── 2a_pre/      # Preprocessed data
│   ├── A01E.gdf     # Subject 1 evaluation data
│   ├── A01T.gdf     # Subject 1 training data
│   ├── A01T.mat     # Subject 1 training labels
│   └── ...          # Similar files for other subjects
│
├── 2b/              # BCICIV-2b dataset
│   ├── 2b_pre/      # Preprocessed data
│   ├── B0101T.gdf   # Subject 1 session 1 training data
│   ├── B0101T.mat   # Subject 1 session 1 labels
│   ├── B0102T.gdf   # Subject 1 session 2 training data
│   └── ...          # Similar files for other subjects
│
└── sdssvep/         # SDSSVEP dataset
    ├── sdssvep_pre/ # Preprocessed data
    ├── S01testEEG.mat    # Subject 1 test data
    ├── S01trainEEG.mat   # Subject 1 training data
    ├── S02testEEG.mat    # Subject 2 test data
    └── ...               # Similar files for other subjects

Each dataset will be automatically preprocessed according to the specifications in get_data.py when running the experiments.

Quick Start

1. Configure Experiments

Modify config.yaml to customize your experiments. The configuration supports:

  • Multiple datasets (2a, 2b, sdssvep, HGD)
  • Different paradigms (Within-Subject, Cross-Subject)
  • Model variants and hyperparameters

Default configuration includes:

  • Datasets: BCICIV-2a, BCICIV-2b, sdssvep, HGD
  • Paradigms: Within-Subject and Cross-Subject
  • Model: BiTE

2. Run Experiments

python main.py

This will automatically:

  • Load and preprocess datasets
  • Train and evaluate models
  • Save results in the results/ directory

3. View Results

Results are saved in results/timestamp/ with:

  • Detailed logs
  • Model weights
  • Performance metrics
  • Visualizations:
    • Confusion matrices
    • Learning curves
    • PR curves
    • ROC curves
    • t-SNE visualizations

FAQ

  1. How to add a new model?

    • Create your model class in model/ directory
    • Add model import in get_model.py
    • Update model initialization in get_model() function
  2. How to use a different dataset?

    • Add dataset configuration in config.yaml
    • Implement data loading function in get_data.py
    • Add preprocessing steps if needed
  3. How to run specific experiments?

    • Modify the experiments section in config.yaml
    • Comment out unwanted dataset configurations
    • Adjust model variants as needed

About

https://arxiv.org/abs/2510.10004

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages