Downloads · 30 days
4
33% of all-time downloads
oraculumai/CBraMod-MI-CoreML
CBraMod-MI-CoreML is a machine learning model from oraculumai. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as bsd-3-clause.
Zero-calibration motor-imagery decoder for 14-channel consumer EEG (EMOTIV EPOC X montage), running natively on Apple silicon. Subject-grouped estimate on unseen users: 78.4% left/right accuracy with no calibration tr…
Downloads · 30 days
4
33% of all-time downloads
All-time downloads
12
Public
Repo size
40.3 MB
Likes
0
Public
Click a slice to open those files.
.bin20.1 MB · 50%
From the Hugging Face model README
Zero-calibration motor-imagery decoder for 14-channel consumer EEG (EMOTIV EPOC X montage), running natively on Apple silicon. Subject-grouped estimate on unseen users: 78.4% left/right accuracy with no calibration trials.
This is CBraMod fine-tuned end-to-end for left/right-hand motor imagery on all 109 PhysioNet EEGBCI subjects, exported to Core ML as a single classifier. Unlike embedding-based deployments, it needs no per-subject head: preprocessed EEG in, left/right probabilities out.
The input window is [1.0, 4.5] s after imagery onset — deliberately covering both the sustained-imagery zone and the post-imagery beta rebound. Our profiling showed the rebound period is anti-correlated under sweet-spot-trained decoders (it reverses the linear decision) but is the single most informative zone when trained on directly; the two-zone window is what lifts unseen-user accuracy from 0.717 to 0.784. Feeding a different window degrades the model to that extent.
| Item | Value |
|---|---|
| Model | CBraModMI.mlpackage (fp32 mlprogram) |
| Input | eeg — float32 [1, 14, 1000] |
| Output | logits — float32 [1, 2] = [left, right] (apply softmax) |
| Window | 3.5 s starting 1.0 s after imagery onset, source 256 Hz (896 samples) |
| Preprocessing | average reference over the 14 channels → global z-score of the window → resample to 200 Hz (polyphase) → zero-pad to 1000 samples |
| Channels (order matters) | AF3, F7, F3, FC5, T7, P7, O1, O2, P8, T8, FC6, F4, F8, AF4 |
| Also included | cbramod_mi_wide.safetensors (the fine-tuned PyTorch weights), training_meta.json, parity.json |
All numbers are subject-grouped (GroupKFold 5 on 109 subjects: the evaluated model never saw any window from the tested user) with pre-registered hyperparameters; the published checkpoint is the same recipe trained on all 109.
Converted with torch.export + run_decompositions({}) (fp32; torch.jit.trace fails on CBraMod's criss-cross reshapes — see the conversion notes in CBraMod-CoreML-Apple). Gates on real EEG windows vs PyTorch: logits rel-L2, 100% decision agreement, softmax max-abs-diff — results in parity.json.
import numpy as np
import coremltools as ct
from huggingface_hub import snapshot_download
# local_dir is required: Core ML cannot resolve the default HF cache's symlinks
repo = snapshot_download("oraculumai/CBraMod-MI-CoreML", local_dir="CBraMod-MI-CoreML")
model = ct.models.MLModel(f"{repo}/CBraModMI.mlpackage")
# window: [1.0, 4.5]s post-onset, 14ch x 896 @ 256 Hz, avg-ref + z-scored,
# then resampled to 200 Hz and zero-padded to 1000 samples:
logits = model.predict({"eeg": window_1x14x1000})["logits"] # [1, 2] = [left, right]
Python helper with the exact preprocessing: oraculum.cbramod.CBraModMIClassifier in https://github.com/nschlaepfer/oraculum-gpt-mk1.
braindecode/cbramod-pretrained.Research artifact — not a medical device; not validated for clinical use.