This repository provides tools and scripts for processing EEG data, performing signal preprocessing, and running machine and deep learning models for "Cueless EEG imagined speech for subject identification: dataset and benchmarks" paper.
π₯³ Our work has been accepted by IEEE Transactions on Biometrics, Behavior, and Identity Science (T-BIOM) π.
π₯ Download the Data
Download the "Device Output Data" directory from the Hugging Face Dataset of this project.
π Replace the Directory
Replace the empty Device Output Data directory in this repository with the downloaded one:
π Run the Integration Script
Integrate the .tdms files with the corresponding .csv files for each session to generate the Dataset directory containing .fif files.
python data_structuring_file_integration.py --subject-num <SUBJECT_NUM> --session-num <SESSION_NUM>
Example:
python data_structuring_file_integration.py --subject-num 1 --session-num 1
βοΈ Alternatively, you can skip this step by downloading the pre-generated Dataset directory from the Hugging Face.
Preprocess the EEG signals to prepare them for analysis and modeling.
python signal_preprocessing.py --subject-num <SUBJECT_NUM> --session-num <SESSION_NUM> --gender <GENDER>
Example:
python signal_preprocessing.py --subject-num 10 --session-num 1 --gender female
βοΈ Alternatively, skip this step by downloading the Dataset/derivatives/preprocessed_eeg from the Hugging Face.
Navigate to the ml_dl_models directory to generate .npy datasets from the .fif files and create train/val/test splits.
cd ml_dl_models
# Generate numpy datasets from .fif files
# π¨ Before running the following code change the data_path_template in the code to your desired path
python read_and_save.py
# Generate train and test sets with different configurations
python train_test_generate.py
This will generate datasets like train_dataset.npy (First 3 sessions of all subjects), train_dataset_ses-1,2.npy (First 2 sessions of all subjects), etc which will be used in further steps.
Navigate to the base_ml_features directory to replicate results using SVM and XGB with feature extraction.
cd base_ml_features
# Example: Run Optuna for XGBoost with Wavelet Features
python optuna_XGB_wavelet.py
Optuna Studies:
You can visualize hyperparameter tuning results using the Optuna dashboard.
optuna-dashboard sqlite:///study_XGB_wavelet.db
Open the provided URL in your browser to view the tuning plots.
Navigate to the appropriate moment subdirectory based on the desired model size (base, large or small).
Full Fine-Tuning:
Run the following script to full fine-tune the Moment model.
python full_finetune.py
Then for training the SVM or XGB on the output embeddings of the fine-tuned or zero-shot models you could run the following script as an example.
python optuna_XGB_moment_large.py
Logs: Final results and logs are available as .md files within the respective directories.
For end-to-end architectures, navigate to the directories starting with braindecode_. For example, for the EEG Conformer model:
cd braindecode_EEGConformer
# Run the training script with Optuna hyperparameter tuning
python optuna_EEGConformer.py
For any questions or feedback, feel free to reach out:
@ARTICLE{11251347,
author={Derakhshesh, Ali and Dehghanian, Zahra and Ebrahimpour, Reza and Rabiee, Hamid R.},
journal={IEEE Transactions on Biometrics, Behavior, and Identity Science},
title={Cueless EEG Imagined Speech for Subject Identification: Dataset and Benchmarks},
year={2025},
volume={},
number={},
pages={1-1},
keywords={biometric system;electroencephalogram;Imagined speech;machine learning},
doi={10.1109/TBIOM.2025.3634273}
}
52 commits
Python
100.0%
This repository provides tools and scripts for processing EEG data, performing signal preprocessing, and running machine and deep learning models for "Cueless EEG imagined speech for subject identification: dataset and benchmarks" paper.
π₯³ Our work has been accepted by IEEE Transactions on Biometrics, Behavior, and Identity Science (T-BIOM) π.
π₯ Download the Data
Download the "Device Output Data" directory from the Hugging Face Dataset of this project.
π Replace the Directory
Replace the empty Device Output Data directory in this repository with the downloaded one:
π Run the Integration Script
Integrate the .tdms files with the corresponding .csv files for each session to generate the Dataset directory containing .fif files.
python data_structuring_file_integration.py --subject-num <SUBJECT_NUM> --session-num <SESSION_NUM>
Example:
python data_structuring_file_integration.py --subject-num 1 --session-num 1
βοΈ Alternatively, you can skip this step by downloading the pre-generated Dataset directory from the Hugging Face.
Preprocess the EEG signals to prepare them for analysis and modeling.
python signal_preprocessing.py --subject-num <SUBJECT_NUM> --session-num <SESSION_NUM> --gender <GENDER>
Example:
python signal_preprocessing.py --subject-num 10 --session-num 1 --gender female
βοΈ Alternatively, skip this step by downloading the Dataset/derivatives/preprocessed_eeg from the Hugging Face.
Navigate to the ml_dl_models directory to generate .npy datasets from the .fif files and create train/val/test splits.
cd ml_dl_models
# Generate numpy datasets from .fif files
# π¨ Before running the following code change the data_path_template in the code to your desired path
python read_and_save.py
# Generate train and test sets with different configurations
python train_test_generate.py
This will generate datasets like train_dataset.npy (First 3 sessions of all subjects), train_dataset_ses-1,2.npy (First 2 sessions of all subjects), etc which will be used in further steps.
Navigate to the base_ml_features directory to replicate results using SVM and XGB with feature extraction.
cd base_ml_features
# Example: Run Optuna for XGBoost with Wavelet Features
python optuna_XGB_wavelet.py
Optuna Studies:
You can visualize hyperparameter tuning results using the Optuna dashboard.
optuna-dashboard sqlite:///study_XGB_wavelet.db
Open the provided URL in your browser to view the tuning plots.
Navigate to the appropriate moment subdirectory based on the desired model size (base, large or small).
Full Fine-Tuning:
Run the following script to full fine-tune the Moment model.
python full_finetune.py
Then for training the SVM or XGB on the output embeddings of the fine-tuned or zero-shot models you could run the following script as an example.
python optuna_XGB_moment_large.py
Logs: Final results and logs are available as .md files within the respective directories.
For end-to-end architectures, navigate to the directories starting with braindecode_. For example, for the EEG Conformer model:
cd braindecode_EEGConformer
# Run the training script with Optuna hyperparameter tuning
python optuna_EEGConformer.py
For any questions or feedback, feel free to reach out:
@ARTICLE{11251347,
author={Derakhshesh, Ali and Dehghanian, Zahra and Ebrahimpour, Reza and Rabiee, Hamid R.},
journal={IEEE Transactions on Biometrics, Behavior, and Identity Science},
title={Cueless EEG Imagined Speech for Subject Identification: Dataset and Benchmarks},
year={2025},
volume={},
number={},
pages={1-1},
keywords={biometric system;electroencephalogram;Imagined speech;machine learning},
doi={10.1109/TBIOM.2025.3634273}
}
52 commits
Python
100.0%