Re-export at 30s epochs (was 4s windows); update README
Browse files
README.md
CHANGED
|
@@ -12,62 +12,74 @@ tags:
|
|
| 12 |
|
| 13 |
Processed HDF5 export of the [EESM23 OpenNeuro dataset](https://doi.org/10.18112/openneuro.ds005178.v1.0.0). It contains paired in-ear EEG and scalp EEG sleep-staging samples from the scored `ses-001` and `ses-002` recordings of 10 subjects.
|
| 14 |
|
|
|
|
|
|
|
| 15 |
## Preprocessing
|
| 16 |
|
| 17 |
Generated with `Ear-EEG-FM-Benchmark/dataset/preprocess_eesm23.py` using schema/eegfm version `0.5.0`:
|
| 18 |
|
| 19 |
- 0.1–100 Hz band-pass and 50 Hz notch filtering on each continuous recording
|
| 20 |
- no re-referencing, resampling, or channel renaming
|
| 21 |
-
- each labeled 30-second AASM scoring event is
|
| 22 |
- classes: `Wake`, `N1`, `N2`, `N3`, `REM`; `Artefact` events are dropped
|
| 23 |
-
- real sensor/data-loss NaN/Inf samples are preserved and recorded in overall
|
| 24 |
-
|
| 25 |
-
-
|
| 26 |
-
|
| 27 |
-
only when it exists in both modalities
|
| 28 |
-
- recording bounds are checked separately for every 4-second window
|
| 29 |
-
- all signal values are stored as `float32` microvolts at 250 Hz
|
| 30 |
|
| 31 |
Brief device data-loss gaps are interpolated before filtering to prevent FIR-kernel contamination, after which the original NaN positions are restored before window selection.
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
## Files
|
| 34 |
|
| 35 |
| File | Channels | Shape `(N, C, T)` | Size |
|
| 36 |
|---|---|---:|---:|
|
| 37 |
-
| `eesm23-in-ear-eeg.h5` | RB, RT, LB, LT | `(
|
| 38 |
-
| `eesm23-scalp-eeg.h5` | M1, F3, C3, O1, M2, F4, C4, O2 | `(
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
|
| 42 |
| Wake | N1 | N2 | N3 | REM |
|
| 43 |
|---:|---:|---:|---:|---:|
|
| 44 |
-
|
|
| 45 |
|
| 46 |
-
## Retained and discarded
|
| 47 |
|
| 48 |
-
The source scoring files
|
| 49 |
-
|
| 50 |
-
`Artefact`.
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
-
| Reason |
|
| 54 |
|---|---:|
|
| 55 |
-
| `
|
| 56 |
-
|
|
| 57 |
-
|
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
quality differs between modalities.
|
| 66 |
|
| 67 |
## HDF5 schema (v0.5)
|
| 68 |
|
| 69 |
```text
|
| 70 |
-
/data (N, C,
|
| 71 |
/durations (N,) int64
|
| 72 |
/nan_fraction (N,) float32
|
| 73 |
/channel_nan_fraction (N, C) float32
|
|
@@ -87,6 +99,6 @@ quality differs between modalities.
|
|
| 87 |
/ch_names (C,) string
|
| 88 |
```
|
| 89 |
|
| 90 |
-
`event_id` and `split_group_id` identify the source 30-second scoring row
|
| 91 |
|
| 92 |
Important attributes include `sfreq`, `class_names`, `unit`, `eegfm_version`, `preprocess_config_json`, `split_group_kind`, and `window_reference`.
|
|
|
|
| 12 |
|
| 13 |
Processed HDF5 export of the [EESM23 OpenNeuro dataset](https://doi.org/10.18112/openneuro.ds005178.v1.0.0). It contains paired in-ear EEG and scalp EEG sleep-staging samples from the scored `ses-001` and `ses-002` recordings of 10 subjects.
|
| 14 |
|
| 15 |
+
> **Update:** this export now stores one **30-second epoch per sample** (previously seven 4-second windows). This matches [`EESM19-Processed`](https://huggingface.co/datasets/Zachary1150/EESM19-Processed) and the canonical sleep-staging unit. See "Preprocessing" below.
|
| 16 |
+
|
| 17 |
## Preprocessing
|
| 18 |
|
| 19 |
Generated with `Ear-EEG-FM-Benchmark/dataset/preprocess_eesm23.py` using schema/eegfm version `0.5.0`:
|
| 20 |
|
| 21 |
- 0.1–100 Hz band-pass and 50 Hz notch filtering on each continuous recording
|
| 22 |
- no re-referencing, resampling, or channel renaming
|
| 23 |
+
- **each labeled 30-second AASM scoring event is stored as one 30-second window** (one sample = one epoch = one label = one prediction — the canonical sleep-staging unit)
|
| 24 |
- classes: `Wake`, `N1`, `N2`, `N3`, `REM`; `Artefact` events are dropped
|
| 25 |
+
- real sensor/data-loss NaN/Inf samples are preserved and recorded in overall and per-channel quality fields
|
| 26 |
+
- the ear-EEG and scalp outputs are strictly row-aligned; a session is excluded from both when either modality is missing/unreadable, and a sample is retained only when it exists in both modalities
|
| 27 |
+
- recording bounds are checked per 30-second window (the full epoch must lie inside the recording)
|
| 28 |
+
- all signal values are stored as `float32` microvolts at 250 Hz (7,500 samples per window)
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
Brief device data-loss gaps are interpolated before filtering to prevent FIR-kernel contamination, after which the original NaN positions are restored before window selection.
|
| 31 |
|
| 32 |
+
### Why 30-second windows (and how to get 4-second windows)
|
| 33 |
+
|
| 34 |
+
The 30-second epoch is the unit at which sleep is scored (AASM) and evaluated. Every
|
| 35 |
+
reference EEG foundation model that does sleep (BENDR, EEGPT, CBraMod, REVE, and the
|
| 36 |
+
EEGPT comparison implementations of LaBraM/BIOT) ingests the full 30-second epoch
|
| 37 |
+
downstream and emits one stage prediction per epoch, rather than splitting one label
|
| 38 |
+
into independently-scored short windows. Storing 30 s is also a strict superset: the
|
| 39 |
+
benchmark loader (`dataset/loader.py`) accepts an `epoch_sec` argument and crops a
|
| 40 |
+
shorter window from each stored sample at load time, so a 4-second (or any ≤30 s) view
|
| 41 |
+
is available without re-exporting; the reverse is not possible.
|
| 42 |
+
|
| 43 |
## Files
|
| 44 |
|
| 45 |
| File | Channels | Shape `(N, C, T)` | Size |
|
| 46 |
|---|---|---:|---:|
|
| 47 |
+
| `eesm23-in-ear-eeg.h5` | RB, RT, LB, LT | `(15,523, 4, 7500)` | 1.74 GiB |
|
| 48 |
+
| `eesm23-scalp-eeg.h5` | M1, F3, C3, O1, M2, F4, C4, O2 | `(15,523, 8, 7500)` | 3.48 GiB |
|
| 49 |
|
| 50 |
+
`T = 7500` is one 30-second epoch at 250 Hz. `N` is the number of scored epochs, one sample per 30-second AASM epoch.
|
| 51 |
+
|
| 52 |
+
Label distribution (identical for both modalities — the samples are row-aligned):
|
| 53 |
|
| 54 |
| Wake | N1 | N2 | N3 | REM |
|
| 55 |
|---:|---:|---:|---:|---:|
|
| 56 |
+
| 1,375 | 1,292 | 7,328 | 2,494 | 3,034 |
|
| 57 |
|
| 58 |
+
## Retained and discarded epochs
|
| 59 |
|
| 60 |
+
The source scoring files label 17,074 30-second epochs across the 20 sessions (10
|
| 61 |
+
subjects × `ses-001`/`ses-002`): 16,558 carry one of the five retained sleep-stage
|
| 62 |
+
labels and 516 are labeled `Artefact`. Each retained epoch becomes one 30-second
|
| 63 |
+
sample, so the final files contain **15,523** strictly paired samples per modality.
|
| 64 |
+
The exclusions from the 16,558 five-class candidates are:
|
| 65 |
|
| 66 |
+
| Reason | Epochs |
|
| 67 |
|---|---:|
|
| 68 |
+
| Entire `sub-006/ses-002` pair: truncated/unreadable PSG | 1,031 |
|
| 69 |
+
| 30-second epoch out of bounds or with no cross-modality partner | 4 |
|
| 70 |
+
| **Total excluded** | **1,035** |
|
| 71 |
+
|
| 72 |
+
(The 516 `Artefact` epochs are outside the five-class task and are never candidates.)
|
| 73 |
+
|
| 74 |
+
`sub-006/ses-002` is dropped because its scalp PSG file is truncated/unreadable
|
| 75 |
+
(`OSError: could not read bytes`). No sample is excluded because it contains NaN/Inf:
|
| 76 |
+
the files retain 2,230 in-ear and 1,913 scalp samples with at least one non-finite
|
| 77 |
+
value; their indices remain paired even when quality differs between modalities.
|
|
|
|
| 78 |
|
| 79 |
## HDF5 schema (v0.5)
|
| 80 |
|
| 81 |
```text
|
| 82 |
+
/data (N, C, 7500) float32
|
| 83 |
/durations (N,) int64
|
| 84 |
/nan_fraction (N,) float32
|
| 85 |
/channel_nan_fraction (N, C) float32
|
|
|
|
| 99 |
/ch_names (C,) string
|
| 100 |
```
|
| 101 |
|
| 102 |
+
`event_id` and `split_group_id` both identify the source 30-second scoring row; here each sample *is* one epoch, so there is one sample per split group. For sequence-model sleep staging that needs adjacent-epoch context, group by `subject`+`session` and order by `window_start_sample`.
|
| 103 |
|
| 104 |
Important attributes include `sfreq`, `class_names`, `unit`, `eegfm_version`, `preprocess_config_json`, `split_group_kind`, and `window_reference`.
|