[BIBM 2025] Bidirectional Time-Frequency Pyramid Network for Enhanced Robust EEG Classification
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:
- Dual-stream processing for synchronized time-frequency analysis
- Pyramid attention mechanism for multi-scale feature extraction
- Bidirectional temporal learning for comprehensive signal understanding
- Python == 3.10.16
- PyTorch == 2.7.1
- CUDA == 12.4
- Additional dependencies in
requirements.txt
Install dependencies:
pip install -r requirements.txt-
BCI Competition IV Dataset 2a
- Data: BCICIV_2a_gdf.zip
- Labels: true_labels.zip
-
BCI Competition IV Dataset 2b
- Data: BCICIV_2b_gdf.zip
- Labels: true_labels.zip
-
SDSSVEP Dataset
- Available at: SSVEP-SanDiego on Kaggle
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.
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
python main.pyThis will automatically:
- Load and preprocess datasets
- Train and evaluate models
- Save results in the
results/directory
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
-
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
- Create your model class in
-
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
- Add dataset configuration in
-
How to run specific experiments?
- Modify the
experimentssection inconfig.yaml - Comment out unwanted dataset configurations
- Adjust model variants as needed
- Modify the