Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Terry RodriguezSalma Mayorquin
Published © CC BY-NC-ND

Deep Learning for Seizure Prediction Wearable

CNNs on EEG readings help predict seizures with a wearable device. Patients can prepare for an event and reduce anxiety and side effects.

AdvancedFull instructions providedOver 1 day7,748

Things used in this project

Hardware components

Raspberry Pi Zero
Raspberry Pi Zero
×1
NeuroSky MindWave Mobile
×1
Buzzer
Buzzer
×1
usb power bank
×1

Software apps and online services

TensorFlow
TensorFlow

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

CNN_EEG_prototype

prototype for seizure prediction wearable using a raspberry pi, piezo buzzer, power bank, and NeuroSky Mindwave Mobile

Code

Code snippet #1

Plain text
  
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
conv2d_1 (Conv2D)            (None, 124, 124, 32)      832
_________________________________________________________________
activation_1 (Activation)    (None, 124, 124, 32)      0
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 62, 62, 32)        0
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 60, 60, 32)        9248
_________________________________________________________________
activation_2 (Activation)    (None, 60, 60, 32)        0
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 30, 30, 32)        0
_________________________________________________________________
conv2d_3 (Conv2D)            (None, 28, 28, 32)        9248
_________________________________________________________________
activation_3 (Activation)    (None, 28, 28, 32)        0
_________________________________________________________________
max_pooling2d_3 (MaxPooling2 (None, 14, 14, 32)        0
_________________________________________________________________
conv2d_4 (Conv2D)            (None, 12, 12, 32)        9248
_________________________________________________________________
activation_4 (Activation)    (None, 12, 12, 32)        0
_________________________________________________________________
max_pooling2d_4 (MaxPooling2 (None, 6, 6, 32)          0
_________________________________________________________________
flatten_1 (Flatten)          (None, 1152)              0
_________________________________________________________________
dense_1 (Dense)              (None, 512)               590336
_________________________________________________________________
activation_5 (Activation)    (None, 512)               0
_________________________________________________________________
dropout_1 (Dropout)          (None, 512)               0
_________________________________________________________________
dense_2 (Dense)              (None, 32)                16416
_________________________________________________________________
activation_6 (Activation)    (None, 32)                0
_________________________________________________________________
dropout_2 (Dropout)          (None, 32)                0
_________________________________________________________________
dense_3 (Dense)              (None, 1)                 33
_________________________________________________________________
activation_7 (Activation)    (None, 1)                 0
=================================================================
Total params: 635,361
Trainable params: 635,361
Non-trainable params: 0
_________________________________________________________________
None
  Train on 9291 samples, validate on 2323 samples
  

Code snippet #2

_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
conv2d_1 (Conv2D)            (None, 124, 124, 32)      832
_________________________________________________________________
activation_1 (Activation)    (None, 124, 124, 32)      0
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 62, 62, 32)        0
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 60, 60, 32)        9248
_________________________________________________________________
activation_2 (Activation)    (None, 60, 60, 32)        0
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 30, 30, 32)        0
_________________________________________________________________
conv2d_3 (Conv2D)            (None, 28, 28, 32)        9248
_________________________________________________________________
activation_3 (Activation)    (None, 28, 28, 32)        0
_________________________________________________________________
max_pooling2d_3 (MaxPooling2 (None, 14, 14, 32)        0
_________________________________________________________________
conv2d_4 (Conv2D)            (None, 12, 12, 32)        9248
_________________________________________________________________
activation_4 (Activation)    (None, 12, 12, 32)        0
_________________________________________________________________
max_pooling2d_4 (MaxPooling2 (None, 6, 6, 32)          0
_________________________________________________________________
flatten_1 (Flatten)          (None, 1152)              0
_________________________________________________________________
dense_1 (Dense)              (None, 512)               590336
_________________________________________________________________
activation_5 (Activation)    (None, 512)               0
_________________________________________________________________
dropout_1 (Dropout)          (None, 512)               0
_________________________________________________________________
dense_2 (Dense)              (None, 32)                16416
_________________________________________________________________
activation_6 (Activation)    (None, 32)                0
_________________________________________________________________
dropout_2 (Dropout)          (None, 32)                0
_________________________________________________________________
dense_3 (Dense)              (None, 1)                 33
_________________________________________________________________
activation_7 (Activation)    (None, 1)                 0
=================================================================
Total params: 635,361
Trainable params: 635,361
Non-trainable params: 0
_________________________________________________________________
None
  Train on 9291 samples, validate on 2323 samples
  

Code snippet #3

Plain text
  
Epoch 35/500
9291/9291 [==============================] - 4s 481us/step - loss: 0.6641 - acc: 0.5856 - val_loss: 0.6781 - val_acc:
0.5519
Epoch 36/500
9291/9291 [==============================] - 4s 477us/step - loss: 0.6638 - acc: 0.5890 - val_loss: 0.6754 - val_acc:
0.5708
  

Code snippet #4

Epoch 35/500
9291/9291 [==============================] - 4s 481us/step - loss: 0.6641 - acc: 0.5856 - val_loss: 0.6781 - val_acc:
0.5519
Epoch 36/500
9291/9291 [==============================] - 4s 477us/step - loss: 0.6638 - acc: 0.5890 - val_loss: 0.6754 - val_acc:
0.5708
  

Credits

Terry Rodriguez
21 projects • 194 followers
hack the change you want to see
Salma Mayorquin
21 projects • 381 followers
Software engineer AI/ML & hardware tinkerer interested in embedded AI. Lets hack the change we want to see!

Comments