Close

Pattern recognition

A project log for Brainmotic

EEG to control a Smart house. Oriented to persons with disabilities.

daniel-felipe-valencia-vDaniel Felipe Valencia V 10/03/2016 at 07:060 Comments

We noticed that 59 channels are too many to make a pattern recognition algorithm in the RPI, for this reason, we have decided to change the basis of competition ii BCI data, dataset III. This database has only 3 data channels, which can simulate the behavior of the converter into digital signals biosignal ADS1299 from Texas Instruments.

We create a script in python that calculates the FFT of each of the four channels of the database and displays (https://github.com/dfvalen0223/BrainMotic/blob/master/plot_BCI_II_competition_dataset_III.py). We have executed in the RPI and the next picture we see the result of an FFT made to 8 data signal (in Matlab Figure 1. and Python with IDE PyCharm, Figure 2.), this signal is half the time high and the other half in low.

Figure 1.

Figure 2.

Then, we install TensorFlow (TF) in the RPi3 and we start the tutorial of TF from https://www.tensorflow.org/versions/r0.8/tutorials/mnist/beginners/index.html

we want to share the code that we developed and tested, which makes the task of recognizing handwritten numbers (28x28 pixels images).

The pattern recognition algorithm that we use in the Github code (https://github.com/dfvalen0223/BrainMotic/blob/master/Tensorflow_MNIST.py) is a simple neural network. The code (https://github.com/dfvalen0223/BrainMotic/blob/master/Tensorflow_MNIST_advance.py) utilizes a deep neural network. We want to share these codes because we discussed and processed the beginner and advanced tutorials TF, and we believe that may be useful for those who start managing this library in Python.

We expect to adjust the vectors result of the operation of the FFT, and the energy bands of 0-57 Hz 8-channel ADS1299, as follows: ch1, range of frequencies 0-27 in the first row of a 28x28 matrix positions in the second row the amplitude of the frequency of 28-57 Hz, this until we complete 16 rows, and the rest of the fill 12 rows of zeros.

However, we began to capture the ADS data after the data reaches a stage that adjusts the data so that the neural network TF do its job, we learned that the RPI gets stuck, so we decided to change strategy analysis of imagery for the motor.

The new strategy is to use the voltage potentials, and it is reflected in the FFT when you want to perform an action with a member from one side, that is, we want to raise the right arm then the electrodes of the left hemisphere reflect more electrical activity than the right and vice versa. Code in:https://github.com/dfvalen0223/BrainMotic/blob/master/patternsBCI_MotorImagery_left_right.py

Discussions