How leizan/cbramod_homework works
This repository supports SHU-MI EEG experiments comparing a pretrained CBraMod model with an EEGSimpleConv baseline. The documented workflow preprocesses MAT trials into LMDB, loads train/validation/test splits, fine-tunes a selected model, and evaluates results; the notebook also documents comparisons, data-efficiency experiments, and inference-time measurements. Source excerpts show the training and model call structure. Notebook and configuration links rely on README statements; the dataset preprocessing and persisted-result details are documented rather than fully sampled.
Main entry points: finetune_main.py Experiment runner · model_for_shu.py CBraMod SHU adapter · preprocessing_shu.py Trial preprocessing · shu_dataset.py Split data loaders
Components 18
EEG Data
- SHU-MI MAT
- Trial preprocessing
preprocessing/preprocessing_shu.py - Processed LMDB
- Split data loaders
preprocessing/shu_dataset.py - Tensor conversion
utils/util.py
Model Architectures
- CBraMod SHU adapter
models/CBraMod/model_for_shu.py - CBraMod backbone
models/CBraMod/cbramod.py - Criss-cross transformer
models/CBraMod/criss_cross_transformer.py - EEGSimpleConv SHU adapter
models/EEGSimpleConv/model_for_shu_simpleconv.py - EEGSimpleConv network
models/EEGSimpleConv/EEGSimpleConv.py - Same-rate resampling
models/EEGSimpleConv/simpleconv_resample.py - Pretrained checkpoint
models/model_weights/CBraMod/pretrained_weights.pth
Fine-tuning
- Experiment runner
finetune_main.py - Training and selection
finetune_trainer.py - Metric evaluation
finetune_evaluator.py
Experiments
- Model configurations
configs - Experiment notebook
CBraMod.ipynb
Other components
- Researcher
Connections 18
- Researcher → Experiment notebook: runs experiments
README.md - Researcher → Trial preprocessing: prepares data
README.md - SHU-MI MAT → Trial preprocessing: provides trials
README.md - Trial preprocessing → Processed LMDB: writes processed trials
README.md - Processed LMDB → Split data loaders: supplies splits
preprocessing/shu_dataset.py - Split data loaders → Tensor conversion: converts batches
preprocessing/shu_dataset.py - Experiment runner → Split data loaders: loads splits
finetune_main.py - Experiment runner → Training and selection: starts training
finetune_main.py - Experiment runner → CBraMod SHU adapter: selects CBraMod
finetune_main.py - Experiment runner → EEGSimpleConv SHU adapter: selects baseline
finetune_main.py - Training and selection → Metric evaluation: evaluates models
finetune_trainer.py - CBraMod SHU adapter → CBraMod backbone: runs backbone
models/CBraMod/model_for_shu.py - CBraMod backbone → Criss-cross transformer: uses encoder
models/CBraMod/cbramod.py - CBraMod SHU adapter → Pretrained checkpoint: loads weights
models/CBraMod/model_for_shu.py - EEGSimpleConv SHU adapter → EEGSimpleConv network: adapts inputs
models/EEGSimpleConv/model_for_shu_simpleconv.py - EEGSimpleConv network → Same-rate resampling: resamples input
models/EEGSimpleConv/EEGSimpleConv.py - Model configurations → Experiment notebook: configures runs
README.md - Experiment notebook → Experiment runner: documents training
README.md