|
| 1 | +================================================================ |
| 2 | +MOSS BCI Platform — Predict Package |
| 3 | +Mental State Classifier using NeuroLM + Muse 2 |
| 4 | +================================================================ |
| 5 | +Version: 1.0 | March 2026 | UBC MINT Team |
| 6 | + |
| 7 | +---------------------------------------------------------------- |
| 8 | +WHAT THIS DOES |
| 9 | +---------------------------------------------------------------- |
| 10 | +Given a Muse 2 EEG recording (CSV from Mind Monitor app), |
| 11 | +this tool predicts your mental state using a frozen NeuroLM |
| 12 | +foundation model + trained classifiers. |
| 13 | + |
| 14 | +Available tasks: |
| 15 | + activity — what you were doing: eat / game / read / rest / toy / tv |
| 16 | + focus — attention level: relaxed / neutral / concentrating |
| 17 | + emotion — emotional state: neutral / anger / fear / happiness / sadness |
| 18 | + stress — stress level: Low / Moderate / High (experimental, not reliable) |
| 19 | + |
| 20 | +---------------------------------------------------------------- |
| 21 | +REQUIREMENTS |
| 22 | +---------------------------------------------------------------- |
| 23 | +- Windows 10/11 (Mac/Linux also works with minor path changes) |
| 24 | +- Miniconda or Anaconda: https://www.anaconda.com/download |
| 25 | +- ~4GB free disk space (for NeuroLM weights + environment) |
| 26 | +- Muse 2 headband + Mind Monitor app (iOS/Android, ~$15) |
| 27 | + |
| 28 | +---------------------------------------------------------------- |
| 29 | +ONE-TIME SETUP (do this once) |
| 30 | +---------------------------------------------------------------- |
| 31 | +1. Install Miniconda if you don't have it |
| 32 | + https://docs.anaconda.com/miniconda/ |
| 33 | + |
| 34 | +2. Double-click setup.bat (or run it from Anaconda Prompt) |
| 35 | + This will: |
| 36 | + - Create a Python environment called "MOSS" |
| 37 | + - Install all required packages |
| 38 | + - Takes about 5-10 minutes |
| 39 | + |
| 40 | +3. Download NeuroLM model weights (ONE required file, ~500MB): |
| 41 | + https://huggingface.co/username/neurolm (ask Natalia for link) |
| 42 | + |
| 43 | + Place the file here: |
| 44 | + MOSS\checkpoints\checkpoints\NeuroLM-B.pt |
| 45 | + |
| 46 | + Your folder structure should look like: |
| 47 | + MOSS\ |
| 48 | + checkpoints\ |
| 49 | + checkpoints\ |
| 50 | + NeuroLM-B.pt <-- put it here |
| 51 | + moss_models\ |
| 52 | + muse2_classifier.pkl |
| 53 | + focus_classifier.pkl |
| 54 | + emotion_classifier.pkl |
| 55 | + stress_classifier.pkl |
| 56 | + muse2_predict.py |
| 57 | + setup.bat |
| 58 | + predict.bat |
| 59 | + README.txt |
| 60 | + |
| 61 | +---------------------------------------------------------------- |
| 62 | +RECORDING YOUR EEG |
| 63 | +---------------------------------------------------------------- |
| 64 | +1. Open Mind Monitor app on your phone |
| 65 | +2. Connect your Muse 2 headband |
| 66 | +3. Press record — sit still and do your task for at least 2 minutes |
| 67 | + (longer = more reliable prediction) |
| 68 | +4. Export the CSV: |
| 69 | + Mind Monitor → Menu → Export CSV → save to your computer |
| 70 | + |
| 71 | +The CSV will have columns like: |
| 72 | + TimeStamp, RAW_TP9, RAW_AF7, RAW_AF8, RAW_TP10, ... |
| 73 | + |
| 74 | +---------------------------------------------------------------- |
| 75 | +RUNNING A PREDICTION |
| 76 | +---------------------------------------------------------------- |
| 77 | +Option A — Double-click predict.bat |
| 78 | + It will ask you to: |
| 79 | + 1. Paste the path to your CSV file |
| 80 | + 2. Choose a task (activity / focus / emotion / stress) |
| 81 | + |
| 82 | +Option B — Run from Anaconda Prompt manually: |
| 83 | + conda activate MOSS |
| 84 | + cd path\to\MOSS |
| 85 | + python muse2_predict.py --input "path\to\your_recording.csv" --task activity |
| 86 | + |
| 87 | + Change --task to: activity, focus, emotion, or stress |
| 88 | + |
| 89 | +---------------------------------------------------------------- |
| 90 | +EXAMPLE OUTPUT |
| 91 | +---------------------------------------------------------------- |
| 92 | + MOSS Prediction |
| 93 | + =============== |
| 94 | + Input: my_recording.csv |
| 95 | + Task: focus |
| 96 | + Model: trained on 4 subjects, 633 segments |
| 97 | + |
| 98 | + Segment-by-segment predictions: |
| 99 | + [ 0s-4s] relaxed 94.2% ██████████████████ |
| 100 | + [ 2s-6s] relaxed 87.1% █████████████████ |
| 101 | + [ 4s-8s] concentrating 78.3% ███████████████ |
| 102 | + [ 6s-10s] neutral 65.4% ████████████ |
| 103 | + ... |
| 104 | + |
| 105 | + Overall prediction: RELAXED (67% of segments) |
| 106 | + |
| 107 | + Class probabilities (mean across all segments): |
| 108 | + relaxed 58.1% ███████████████████████ |
| 109 | + neutral 24.3% █████████ |
| 110 | + concentrating 17.6% ███████ |
| 111 | + |
| 112 | +---------------------------------------------------------------- |
| 113 | +CLASSIFIER PERFORMANCE (what to expect) |
| 114 | +---------------------------------------------------------------- |
| 115 | + Task Classes Accuracy Chance Notes |
| 116 | + -------- ------- -------- ------ ----- |
| 117 | + Activity 6 91.7% 16.7% Very reliable |
| 118 | + Focus 3 71.9% 33.3% Reliable |
| 119 | + Emotion 5 45.5% 20.0% Use with caution |
| 120 | + Stress 3 28.0% 33.3% Not reliable yet |
| 121 | + |
| 122 | +Accuracy is Leave-One-Subject-Out cross-validation — |
| 123 | +meaning the model was tested on people it had never seen before. |
| 124 | + |
| 125 | +---------------------------------------------------------------- |
| 126 | +TIPS FOR BEST RESULTS |
| 127 | +---------------------------------------------------------------- |
| 128 | +- Record at least 2 minutes (ideally 5+) for stable predictions |
| 129 | +- Sit still — jaw clenching and movement create artifacts |
| 130 | +- Make sure headband fits snugly (check Mind Monitor signal quality) |
| 131 | +- Do one clearly defined task per recording |
| 132 | +- Green signal quality bars in Mind Monitor = good contact |
| 133 | + |
| 134 | +---------------------------------------------------------------- |
| 135 | +TROUBLESHOOTING |
| 136 | +---------------------------------------------------------------- |
| 137 | +"No module named X" |
| 138 | + → Re-run setup.bat or run: conda activate MOSS |
| 139 | + |
| 140 | +"File not found: NeuroLM-B.pt" |
| 141 | + → Make sure checkpoint is at MOSS\checkpoints\checkpoints\NeuroLM-B.pt |
| 142 | + |
| 143 | +"Recording too short" |
| 144 | + → Record at least 4 seconds; 2+ minutes recommended |
| 145 | + |
| 146 | +"ERROR loading CSV" |
| 147 | + → Check that your CSV has RAW_TP9/AF7/AF8/TP10 columns |
| 148 | + → Export directly from Mind Monitor (not Muse Direct) |
| 149 | + |
| 150 | +---------------------------------------------------------------- |
| 151 | +CONTACT |
| 152 | +---------------------------------------------------------------- |
| 153 | +Questions? Contact Natalia (UBC MINT Team) |
| 154 | +Project: MOSS — Modular Open-Source Signal System |
| 155 | +GitHub: [link TBD] |
| 156 | + |
| 157 | +================================================================ |
0 commit comments