• Stars
    star
    264
  • Rank 155,103 (Top 4 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created almost 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deep Learning with Tensor Flow for EEG MNE Epoch Objects

DeepEEG

MNE/Keras/Tensorflow library for classification of EEG data

DeepEEG Image

DeepEEG is a Keras/Tensorflow deep learning library that processes EEG trials or raw files from the MNE toolbox as input and predicts binary trial category as output (could scale to multiclass?).

CAN 2019 Poster presentation on DeepEEG - https://docs.google.com/presentation/d/1hO9wKwBVvfXDtUCz7kVRc0A6BsSwX-oVBsDMgrFwLlg/edit?usp=sharing

Collab notebooks for cloud compution

Colab Notebook Example with simulated data: https://colab.research.google.com/github/kylemath/DeepEEG/blob/master/notebooks/DeepEEG_Sim.ipynb

Colab Notebook Example with data from Brain Vision Recorder in google drive: https://colab.research.google.com/github/kylemath/DeepEEG/blob/master/notebooks/Deep_EEG_BV.ipynb

Colab Notebook Example with muse data from NeurotechX eeg-notebooks: https://colab.research.google.com/github/kylemath/DeepEEG/blob/master/notebooks/Deep_EEG_Muse.ipynb

Getting Started Locally:

DeepEEG is tested on macOS 10.14 with Python3. Prepare your environment the first time:

# using virtualenv
 python3 -m venv deepeeg
 source deepeeg/bin/activate
# using conda
#conda create -n deepeeg python=3
#source activate deepeeg
git clone https://github.com/kylemath/DeepEEG/
cd DeepEEG
./install.sh
git clone https://github.com/kylemath/eeg-notebooks_v0.1

You are now ready to run DeepEEG.

For example, type python and use the following: This loads in some example data from eeg-notebooks

from utils import *
data_dir = 'visual/cueing'
subs = [101,102]
nsesh = 2
event_id = {'LeftCue': 1,'RightCue': 2}

Load muse data, preprocess into trials,prepare for model, create model, and train and test model

#Load Data
raw = LoadMuseData(subs,nsesh,data_dir)
#Pre-Process EEG Data
epochs = PreProcess(raw,event_id)
#Engineer Features for Model
feats = FeatureEngineer(epochs)
#Create Model
model,_ = CreateModel(feats)
#Train with validation, then Test
TrainTestVal(model,feats)

Tests

You can run the unittests with the following command:

python -m unittest tests

Strategy

  • Load in Brain Products or Interaxon Muse files with mne as mne.raw,
  • PreProcess(mne.raw) - normal ERP preprocessing to get trials by time by electrode mne.epochs
  • FeatureEngineer(mne.epochs) - Either time domain or frequency domain feature extraction in DeepEEG.Feats class
  • CreateModel(DeepEEG.Feats) - Customizes DeepEEG.Model for input data, pick from NN, CNN, LSTM, or AutoEncoders, splits data
  • TrainTestVal(DeepEEG.Feats,DeepEEG.Model) - Train the model, validate it during training, and test it once complete, Plot loss during learning and at test

Dataset example

API

Preprocessing

LearningModels

  • First try basic Neural Network (NN)
  • Then try Convolution Neural Net (CNN)
  • New is a 3D convolutional NN (CNN3D) in the frequency domain
  • Then try Long-Short Term Memory Recurrant Neural Net (LSTM)
  • Can also try using (AUTO) or (AUTODeep) to clean eeg data, or create features for other models

DataModels

  • Try subject specific models
  • Then pool data over all subjects
  • Then try multilevel models (in the works)

Benchmarks

Code References

Resources

More Repositories

1

EEGEdu

Interactive Brain Playground - Browser based tutorials on EEG with webbluetooth and muse
JavaScript
173
star
2

cross_colour

Overlay saturated crosshatch grid onto grayscale image for illusory colours
MATLAB
36
star
3

MoralWordEEG

Experiment, Materials, and Analysis code for Moral Word EEG project
MATLAB
5
star
4

Muse_LSL_Environments

A set of python environments for running MUSE LSL experiments, record data, visualize, and send markers, using Alex B. muse-lsl
Python
5
star
5

TimeFreqWorkshop

Presentation and code for time frequency workshop
HTML
4
star
6

pyoptical

Imagent optical imaging interface to MNE loading
Python
4
star
7

faceoff

Latent GAN State Brain Surfing
JavaScript
4
star
8

webcamHR

P5.js webcam HR
JavaScript
4
star
9

StoryTrees3

Story Trees 3 - RAVEN
JavaScript
2
star
10

nomad

Near-infrared Optical Montage Automated Design
MATLAB
2
star
11

p5.eegedu

A live coding environment in p5 which includes bluetooth transmitted brain activity as input variables
JavaScript
2
star
12

pyERP

python ERP framework using MNE structures
Python
2
star
13

MOpt3d

A matlab optical imaging analysis and 3d reconstruction toolbox
MATLAB
2
star
14

WhisperingPines

Webcam Responsive AudioVisual Art
JavaScript
2
star
15

Apparition

Apparition make a live video puppet with pix2pix based on old youtube videos
Jupyter Notebook
1
star
16

AudienceEEG

MATLAB
1
star
17

MathewsonMatlabTools

Toolbox of tricks, gadgets, gizmos, and automated emailers
MATLAB
1
star
18

Mathewson2009

Phase analysis from Mathewson 2009
MATLAB
1
star
19

p5.eegedu.art

1
star
20

matlab_video_hr

MATLAB
1
star
21

nehiyoMTB

Nehiyawewin trail signs for Edmonton
G-code
1
star
22

necker_move

moving necker cube
JavaScript
1
star
23

StoryTrees2

JavaScript
1
star
24

strokeEEG

Python
1
star
25

RetinotopyMatlabCode

MATLAB
1
star
26

Computer-Programming-for-Psychology

Python
1
star
27

micb

Motion Induced Change Blindness - Yao, Wood, Simons 2019 - Psychtoolbox code
MATLAB
1
star
28

375Data_2020

Shared Datasets and analysis files for 375 Final Paper
Jupyter Notebook
1
star