| --- |
| license: cc-by-4.0 |
| pretty_name: EEGFaceSem |
| tags: |
| - eeg |
| - bci |
| - rsvp |
| - face-stimuli |
| - generative-latents |
| size_categories: |
| - 10K<n<100K |
| --- |
| |
| # EEGFaceSem |
|
|
| EEG Dataset for Semantic Visual Response |
|
|
| ## Installation |
|
|
| ```bash |
| git clone https://huggingface.co/datasets/yefllower/EEGFaceSem |
| cd EEGFaceSem |
| pip install -e . |
| ``` |
|
|
| ## Quick Start |
|
|
| ```python |
| import EEGFaceSem |
| |
| # Auto-downloads data when loading |
| X, Y, ids = EEGFaceSem.load_data(task='female') |
| print(f"X: {X.shape}, Y: {Y.shape}") # X: (n_trials, 32, 1101), Y: (n_trials,) |
| |
| # Or download specific subjects only (~300MB per subject) |
| # EEGFaceSem.download(subjects=[1]) |
| ``` |
|
|
| ### Image Generation |
|
|
| ```python |
| # Load latent vectors and generate face image |
| image_ids, latents, id_to_idx = EEGFaceSem.load_latent() |
| EEGFaceSem.generate(latents[0:1])[0].save("face.png") |
| ``` |
|
|
| ## Dataset Info |
|
|
| | Metric | Value | |
| |--------|-------| |
| | Subjects | 30 | |
| | Total epochs | 64,124 | |
| | EEG channels | 32 | |
| | Sampling rate | 1000 Hz | |
| | Epoch window | [-0.2, 0.9]s | |
|
|
| ### 8 Tasks |
|
|
| | Task ID | Task Name | |
| |---------|-----------| |
| | 0 | female | |
| | 1 | male | |
| | 2 | blond | |
| | 3 | darkhaired | |
| | 4 | smiles | |
| | 5 | nosmile | |
| | 6 | old | |
| | 7 | young | |
|
|
| ## API Reference |
|
|
| ### Data Loading |
|
|
| ```python |
| # Download data |
| EEGFaceSem.download(data_type="processed") # or "raw", "both" |
| EEGFaceSem.download(subjects=[1, 2, 3]) # specific subjects only |
| |
| # Load data |
| X, Y, ids = EEGFaceSem.load_data(task='female') |
| ``` |
|
|
| ### Splitting |
|
|
| ```python |
| # Random split |
| (X_train, Y_train), (X_test, Y_test) = EEGFaceSem.split_random(X, Y, test_size=0.2) |
| |
| # Leave-one-subject-out |
| (X_train, Y_train), (X_test, Y_test) = EEGFaceSem.split_by_subject(X, Y, ids, test_subject=1) |
| ``` |
|
|
| ### Benchmarking |
|
|
| ```python |
| EEGFaceSem.benchmark( |
| model='LDA', # LDA, LR, MLP, EEGNet, EEGPT |
| task_id=0, # 0-7 or -1 for all |
| strategy='single_subject', |
| ) |
| ``` |
|
|
| ### Image Generation |
|
|
| ```python |
| # Load latent vectors |
| image_ids, latents, id_to_idx = EEGFaceSem.load_latent() |
| |
| # Generate from latent |
| images = EEGFaceSem.generate(latents[0:1]) |
| images[0].save("face.png") |
| |
| # Generate from specific image ID in data |
| img_id = int(ids[0, 4]) |
| EEGFaceSem.generate(latents[id_to_idx[img_id]:id_to_idx[img_id]+1])[0].save(f"face_{img_id}.png") |
| ``` |
|
|
| ## License |
|
|
| The dataset is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The accompanying benchmark code is released under the Apache License 2.0. |
|
|