jarod1212 commited on
Commit
6c7cd4e
·
verified ·
1 Parent(s): d79edf7

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +70 -0
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: braindecode
4
+ tags:
5
+ - eeg
6
+ - event-detection
7
+ - dance
8
+ - p300
9
+ datasets:
10
+ - BI2014a
11
+ ---
12
+
13
+ # DANCE — BI2014a P300 event-detection checkpoint
14
+
15
+ Pretrained weights for the [`braindecode.models.DANCE`](https://braindecode.org/stable/generated/braindecode.models.DANCE.html)
16
+ model, used by the tutorial *"From window labels to events: asynchronous EEG
17
+ decoding with DANCE"*.
18
+
19
+ DANCE detects a *set* of `(start, end, class)` events directly from long,
20
+ unaligned EEG windows, without being told where an event starts. This
21
+ checkpoint was trained on the Brain Invaders **BI2014a** P300 dataset (flash
22
+ detection: class `1` = non-target, class `2` = target, class `0` = background).
23
+
24
+ ## Results
25
+
26
+ Cross-subject, held-out subject 3 (never seen in training):
27
+
28
+ | Metric | Value |
29
+ |---|---|
30
+ | F1-event (IoU > 0.5 + class match) | **0.495** |
31
+ | F1-sample (per-token macro) | 0.372 |
32
+
33
+ On the first held-out window the model predicts 51 events (ground truth: 53),
34
+ mean duration ≈ 1.1 s, with confidences 0.75–0.99 — i.e. sharp, correctly
35
+ localized P300 flashes.
36
+
37
+ ## How to load
38
+
39
+ The architecture must be built exactly as in the tutorial (the state dict is
40
+ saved with these hyper-parameters):
41
+
42
+ ```python
43
+ import torch
44
+ from huggingface_hub import hf_hub_download
45
+ from braindecode.models import DANCE
46
+
47
+ model = DANCE(
48
+ n_outputs=3,
49
+ n_chans=len(chs_info), # 16 for BI2014a
50
+ chs_info=chs_info,
51
+ n_times=4096, # 32 s @ 128 Hz
52
+ sfreq=128.0,
53
+ input_window_seconds=32.0,
54
+ )
55
+ model.load_state_dict(
56
+ torch.load(hf_hub_download("braindecode/plot_dance_event_detection", "model.pt"))
57
+ )
58
+ ```
59
+
60
+ ## Training
61
+
62
+ - Data: BI2014a, subjects 1, 2, 4–9 for training; subject 3 held out.
63
+ - Preprocessing (paper recipe): pick EEG, band-pass 0.1–100 Hz, resample to
64
+ 128 Hz, per-channel robust scaling clamped to `[-16, 16]`.
65
+ - Windows: 32 s fixed length, up to 150 events/window, `num_latents = 256`.
66
+ - Optimiser: Adam, constant lr `5e-4`, batch size 16, 120 epochs,
67
+ best-by-held-out-F1-event checkpoint.
68
+ - Loss: `braindecode.training.DanceLoss` (matched-only IoU normalization).
69
+
70
+ Reproduce with `train_checkpoint.py` in this repository.