pip install python-osc
and pip install tk
pip install tensorflow
OSC Stream Target IP
: here you should add your computer’s local IP-address, on Win10 you can run ipconfig
in a command prompt to find it, often starts with 192.168.x.xOSC Stream Port
: set to 5000
python "Blink Pong without ML.py"
Collect OSC-data.py
from your favourite IDE or from the command prompt with python "Collect OSC-data.py"
1
and Noise
, both for 2 seconds. If you want, you can later change them or add more events in the code, look for this:
1
for 2 seconds. During this time you should blink once.Noise
for 2 seconds. During this time you should not blink, just relax.Data acquisition
and click the icon labeled Upload existing data
Create an impulse
and fill in the Time series data
as shown in the picture. While the length of the samples are in fact 2000 ms (= 2 seconds), I’ve found that using 20 ms (as in 20 lines for each sample) works at least as good.Raw data
and let all axes be checkmarked. You can later try to find which axes do not impact much or at all for your model and uncheck them, but then you also need to modify the line expected_samples = 20
in Blink Pong with ML.py
accordingly. This is explained more detailed in the code itself.Classification (Keras)
, in this tutorial you will have only 2 output features: 1
and Noise
, but if you want to create an event for double blinks, feel free to record events with e.g. 2
as well, like in the picture.Save impulse
and Raw data
on the left hand menu
Save parameters
which will take you to the second tab.Generate features
NN Classifier
from the left hand menuNumber of training cycles
to 200. This is another parameter to tweak, the higher this number is, the longer time the training will take, but also the better the network will perform, at least until it can’t improve anymore.Start training
Model testing
in the menuClassify all
Dashboard
from the left hand menuDownload block output
and click on the icon next to NN Classifier model TensorFlow Lite (float32)
ei-[ your project name ]-nn-classifier-tensorflow-lite-float32-model.lite
. Although you can rename it if you really want to, why not save your brain cells to more important stuff :smirk:Blink Pong with ML.py
with your favourite IDE or a text file editor like Notepad
initiate_tf
and locate the line with lite_file = "ei-.......lite"
=
with your own file name, remember the double quotes " "
and .lite
at the endpython "Blink Pong with ML.py"
pong
towards the end of the program includes a variable ball_speed = 5
where you can change the ball speed.Create an impulse
step, you will also reduce the data needing processing and the time it takes. As earlier mentioned, and as also explained in the code itself, you then need to change the variable expected_samples
from 20 to something else. If you e.g. reduce the axes from 20 to 10, you would put 10 in this variable..lite
-file trained by the author. You can try the game using this, without the need to record own EEG-data, but don’t be surprised if it doesn’t give good results, brains tend to be different…