This post is the third in a series aimed at documenting the process behind making a functional BCI at low-cost and with minimal experience. If you haven’t done so, I’d recommend first reading my introductory post about this series that details the materials and costs for the project as well as my first post to hack an EEG headset and my second post to collect data with it.
I trust that you now have data which is going to serve as the lifeblood in creating and training a classifier to detect Mind Wandering – which itself is going to be the lifeblood of our device. So, without further ado, here’s the agenda for this post:
The Agenda
- Create the Neural Network
- Prepare data to be fed into Neural Network
- Train the Neural Network
- Test the Neural Network
- What you need:
- Ideally, Jupyter notebook installed but you could also run my notebook on your browser if not.
- What you need:
Step 1: The Prep
I did the entirety of the data processing, Neural Network building and training is going to be on a Jupyter notebook – one can run python scripts as blocks on juypter notebooks which comes in handy when debugging and re-running isolated parts of the script. So, that’s the format of the code that I’m going to share.
For those who have Jupyter notebook installed, you could download the code from my github, and run it locally: https://github.com/JoshetaSrinivasan/DistractedDrivingDetect/blob/main/EEG_NN_Classifier.ipynb
If you want to install Jupyter notebook, here are the installation details: https://jupyter.org/install.
If not, you can still run my code on a web browser by following this link: https://mybinder.org/v2/gh/JoshetaSrinivasan/DistractedDrivingDetect/75e24de82e2ab58e83a3f4fa27121eb3f0240962
Give it a second or two to load, it will automatically open a page that looks like this.
Navigate to the EEG_NN_Classifier.ipynb file and you should be able to see the jupyter notebook that looks like this:
I’ve pretty much explained everything I wanted to include in the post as explanation as explanation in the notebook. I did however record a video walk through; (recorded during an afternoon slump so excuse the dreariness. I might record a better one soon to replace this lol) . Here’s that:
We now have a trained network. Our next step is to be able to implement this network in an Arduino and program the hardware necessary for the BCI device to work. Till then, adios!
Comments are closed