Post on 03-Jan-2016
description
Mai Mohamed Project TeamProject Team
Brain Computer Interface
Mohamed Omar
Mohamed Sami
Nada Mohamed
Ahmed Mamdoh
http://bci2.k-space.org
Brain Computer
Interface
BCI
Brain Computer
Interface
BCISupervisorsProf.Dr Abu Bakr M. Youssef Assistant Prof.Dr Yasser M.Kadah
SupervisorsProf.Dr Abu Bakr M. Youssef Assistant Prof.Dr Yasser M.Kadahhttp://bci2.k-space.org
Motivation for BCI ResearchMotivation for BCI ResearchThere are , more than 200,000 patients live with the motor sequelae of serious injury.
Locked-in SyndromeNeurological diseases may lead to paralysis of the entire motor system .Unable to use their muscles and therefore cannot communicate their needs, wishes, and emotions.
http://bci2.k-space.org
Reason of BCIReason of BCI
• Allow a user to communicate with a computer through his Brain
• The user can think and the computer recognizes what he thought about.
• This is what we call a Brain-Computer Interface (BCI) [or Brain-Machine Interface (BMI)].
http://bci2.k-space.org
The DreamThe Dream
•People always think about controlling environments from their mind
•Anyone wish if he could read the people thoughts and know what they are thinking of him
•Some people want to store their dreams and record it while they sleeping
http://bci2.k-space.org
Dream vs. RealityDream vs. Reality• Dream BCI
– Think to whatever you want– Without recognition errors – Whenever you want
• Physiological problems– No thought sensor– Partial brain knowledge– Noisy signals
• Solutions in the BCI community (reality)– Limited thought– Limited recognition accuracy
http://bci2.k-space.org
BCI communityBCI community
2 4
48
127
0
20
40
60
80
100
120
140
1985-1990 1991-1995 1996-2000 2001-2004
SCI paper
About 60 research groupsAbout 300 researchersIncreasing published papers
http://bci2.k-space.org
Our GoalsOur Goals
1. Recording Brain Signal Using EEG electrodes.1. Recording Brain Signal Using EEG electrodes.
2. Isolation between subject and electronic circuit2. Isolation between subject and electronic circuit
3. Designing Data Acquisition System3. Designing Data Acquisition System
4. Signal Selection 4. Signal Selection
5. Interfacing with Computer by Soundcard5. Interfacing with Computer by Soundcard
6. Implementing real time analysis Classification data6. Implementing real time analysis Classification data
BCI CategoriesBCI Categories
• Invasive and Non-Invasive BCIs
• Online and Offline BCIs
• Imaginary and Mental Tasks
http://bci2.k-space.org
General schemeGeneral scheme
Controlinterface
Application
Bio-sensor
Pre-processing
Feature extraction
Classification
Electrical activity
The brainOn the computer
Mental
state
High levelcommands
1. Data Acquisition 2. BCI System
3. Online Feedback
Feedback
http://bci2.k-space.org
Medical IntroductionMedical Introduction
Nervous System Nervous System
Nervous System Nervous System
PNS PNS
CNS CNS
Brain
SpinalCord
CranialNerves
SpinalNerves
Sensory
Motor
http://bci2.k-space.org
Human Brain Human Brain
http://bci2.k-space.org
EEGEEG
Electroencephalography or EEG is the measurement of neural activity within the brain.
EEG has been used to detect low oxygen and high carbon dioxide levels.
A clinical use of EEG is in the diagnosis of epilepsy.
http://bci2.k-space.org
EEG SignalEEG Signal
http://bci2.k-space.org
EEG Wave BandEEG Wave Band
Alpha Beta Delta Theta
Frequency 8-13 Hz 13-30 Hz 0.5-4 Hz 4-8 Hz
Occupation occipital
parietal and frontal lobes. ______
Conditionawake person
_____ Sleeping _____
Age ______ ______infants&adults
children and sleeping adults
EEG Lead SystemEEG Lead System
http://bci2.k-space.org
Data Acquisition Data Acquisition
http://bci2.k-space.org
OverviewOverview
Pre Amplifier
Pre Amplifier
Pre Amplifier
Pre Amplifier
Pre Amplifier
Pre Amplifier
MUX
Latch
Parallel Port
Gain Amplifier LPF Sound Card
ElectrodeIsolation
ElectrodeIsolation
ElectrodeIsolation
ElectrodeIsolation
ElectrodeIsolation
ElectrodeIsolation
Matlab Workspace
http://bci2.k-space.org
Biopotential SensorsBiopotential Sensors
Electrodes are Biopotential sensor.
There are different types of electrodes:
1. Gold electrode.2. Silver electrode.
http://bci2.k-space.org
IsolationIsolationMedical procedures usually expose the patient
to more hazard than at home or workplace.
Our main goal is to break ground loop .
We decide to do that by low cast and effective way by using:
1.Isolation transformer as power isolation.2.Opto-Couplers as signal isolation.
http://bci2.k-space.org
IsolationIsolation
In our design we used the PC817 due to:Its low turn-on and off time and high.Isolation voltage between input.
Continue
http://bci2.k-space.org
Instrumentation AmplifierInstrumentation AmplifierAmplifying differential input
There are two stage of signal amplification:1.Pre-Amplification2.Gain-Amplification
We used AD620 according to many better features on it:
• Lower cost • High accuracy• Low noise• High Gain Ability
http://bci2.k-space.org
AD620 SchematicAD620 Schematic
http://bci2.k-space.org
Signal SelectionSignal SelectionMultiplexer:
Select data from two or more data sources into a single channel.
There are two types of multiplexers:•Analog Multiplexer.•Digital Multiplexer.
we used Analog Multiplexer and we choose M54HC4051 IC
Some features of M54HC4051:• Low power dissipation• Fast switching• High noise immunity• Wide analog input voltage range
http://bci2.k-space.org
M54HC4051 SchematicM54HC4051 Schematic
http://bci2.k-space.org
LatchLatch
Change output state only in response to data input
Transfer data from parallel port to MUX and holding it using LE (latch enable).
In our design SN74LS373 As latch IC.
http://bci2.k-space.org
SN74LS373 SchematicSN74LS373 Schematic
http://bci2.k-space.org
Signal FilteringSignal FilteringA low-pass filter is a Filter that passes low frequensy Component well, reduces frequencies higher than the cutoff frequency.
It is sometimes called a high-cut filter, or treble cut filter.
We use active 2nd order low pass filter we used UA741 IC.
LPF SchematicLPF Schematic
http://bci2.k-space.org
Parallel PortParallel PortThe Parallel Port is the most commonly used port for interfacing home made projects
•Hardware Properties
8 output pins accessed via the DATA Port 5 input pins (one inverted) accessed via the STATUS Port 4 output pins (three inverted) accessed via the CONTROL Port The remaining 8 pins are grounded
•Why Parallel Port ?
Easy Implementation and InstallationAllow Full Software Control without- need any Counters &Clock to Switch between ChannelsAbility of Communication withMatlab
http://bci2.k-space.org
Sound CardSound Card
A sound card is a Computer PCI Card that can input and output Sound under control of computer programs General characteristics 1-Sound Chip2- multi-channel Dacs & A/D 3-ROM or Flash memory
Color Function
Lime gree
n
Analog line level output for the main stereo signal (front speakers or headphones).
Pink Analog Microphone input.
Light blue
Analog Line level input.
http://bci2.k-space.org
Continue
Sound CardInternal Block
Sound CardInternal Block
Why we choose Sound CardWhy we choose Sound Card
• Fixed and Low Cost Acquisition Card• Easy in Implementation and installation• Ability to Convert from Analog to Digital with very
high accuracy and vise versa• Easy Communication with Matlab• Ability to detect low Frequencies• Sampling Data in wide rang (8000 to 44100)• Better than designing new Interfacing System and this
System in Situation to not work because of hardware troubleshooting
http://bci2.k-space.org
Acquiring Data with a Sound CardAcquiring Data with a Sound Card
http://bci2.k-space.org
Data Acquisition ProgramsData Acquisition Programs
OnlineSignal with
Filtering
EachChannelOnline
Plotting
DrawingWith
Selection
OnlineClassifier
1st
Release2nd
Release3rd
Release
4th
Release
http://bci2.k-space.org
1st Release1st Release
http://bci2.k-space.org
2nd Release2nd Release
http://bci2.k-space.org
3rd Release3rd Release
http://bci2.k-space.org
4th Release4th Release
imagination of right hand movement
imagination of left hand movement
http://bci2.k-space.org
Analytic methodsAnalytic methods
Signal preprocessing
Signal preprocessing
Feature extraction
Feature extraction
Statistical classification
Statistical classification
The process of EEG signal analysis and classification consists of the Following three steps:The process of EEG signal analysis and classification consists of the Following three steps:
http://bci2.k-space.org
Signal PreprocessingSignal Preprocessing
Backgroundbrain
activityPhysiologic
noiseEnvironmental
noise
Measuredsignal
Mentaltask
• Power line 50/60 Hz• Electrode contact
• Eye movements• Other movements
?
Experiment protocol
Power line
Heart rateSubject
Eye blink
Electrode contact
Noisy signal
Start
Type of work
Work on exist dataset
Offline
Online
Record EEG signal
Read dataset
Feature extraction
hypothesis test
Feature available
F
Classification
TTest next feature
Test classifier
feature extraction
Decision
classification
Record our dataset
Feature extraction
Make hypothesis test
Classification
Visual O/P
Red Green
http://bci2.k-space.org
Offline DatasetBCI Competition 2003 Data Set Ia: ‹self-regulation of SCPs› provided by University of
Tuebingen,Germany, Dept. of Computer Engineering (Prof. Rosenstiel)
Offline DatasetBCI Competition 2003 Data Set Ia: ‹self-regulation of SCPs› provided by University of
Tuebingen,Germany, Dept. of Computer Engineering (Prof. Rosenstiel)
Datasets were taken from a healthy subject he was asked to move a cursor up and down on a computer screen.
Data6 EEG electrodes are used referenced to the vertex electrode Cz •Channel 1: A1-Cz (A1 = left mastoid) •Channel 2: A2-Cz (right mastoid)•Channel 3: 2 cm frontal of C3 •Channel 4: 2 cm parietal of C3•Channel 5: 2 cm frontal of C4•Channel 6: 2 cm parietal of C4Sampling rate of 256 Hz.
Trial structure overviewconsisted of three phases1-s rest phase,1.5-s cue presentation phase and 3.5-s feedback phase.
http://bci2.k-space.org
Offline DatasetOffline Dataset
During every trial, the task was visually presented by a highlighted goal at the top or bottom of the screen to indicate negativity or positively from second 0.5 until the end of the trial. The visual feedback was presented from second 2 to second 5.5. Only this 3.5 second interval of every trial is provided for training and testing.
Trails separated into training set (268 trials) which is 2-D Matrices 135x5377 and 133x5377 testing set The test set (293 trials). Every line of a matrix contains the data of one trial. The first column codes the class of the trial (0/1).
•NoteFor our implementation we constructed the test set from the train set. That was done by selecting 100 trails from class 0 and 100 trails from class 1.
Continue
http://bci2.k-space.org
Offline DatasetOffline DatasetApproachWe used MATLAB (release 13) for analysis. We separated the channels of each class to be 135x896 matrix for channels in class 0 and 133x896 matrix for class 1 channels.For each EEG channel, we plotted the time-domain and frequency-domain averages across trials for each class.
NoteIn our online BCI approach, we constructed our own
dataset which consist of training set & testing set.The training set was used to tune the parameters of
the classification algorithm.We also applied all the pre-processing techniques as in
the offline work.
Continue
http://bci2.k-space.org
Feature ExtractionFeature Extraction
Steps of feature extraction
Choosing feature
Features Vector Form
http://bci2.k-space.org
Choosing FeaturesChoosing Features
Time Domain Features
mean
Variance
http://bci2.k-space.org
Frequency domain featuresFrequency domain featuresShort-Time Fourier Transform–First we transform all signals to frequency domain by (FFT).–Then we get mean & variance in frequency domain .–calculate the amplitudes at 20 Hz.
Welch methodEstimate the power spectral density (PSD) of a signal using Welch is done using Pwelch Matlab function
Continue
Form features vectorForm features vector
Std1Std1Std2Std2Std3Std3Std4Std4
::::::::::::::::::
Channel 1
Signal 1Signal2Signal3Signal4
::::
: : :
feature vector
Class 0
Class 1
Class 0
Class 1
http://bci2.k-space.org
Form Features VectorForm Features Vector
Ch1 Feature Vector
Class 0
Class 1
mean2
mean1
mean3
mean4
Var1
Var2
Var3
Var4
.
.
.
.
Continue
http://bci2.k-space.org
Multi dimension feature vectorMulti dimension feature vector
Channel 1
Channel 2
Channel 5
Channel 6
http://bci2.k-space.org
Hypothesis TestHypothesis Test
Perform Hypothesis testing for the difference in means of two samples.
http://bci2.k-space.org
[H, P, Ci]=ttest2(X,Y)
H=0 no significance
H=1 significance
Signal Classification TechniquesSignal Classification Techniques
Classifier
Minimum Minimum DistanceDistance
BayesBayes K-NNK-NN
http://bci2.k-space.org
Classifier inputClassifier input
Train feature vector Test feature vector
Class 0
Class 1
Class 0
Class 1
Minimum Distance ClassifierMinimum Distance ClassifierMinimum Distance ClassifierMinimum Distance ClassifierAlgorithm 1. Group the design set into (n) class 2. Estimate the sample mean for each class.3. A test sample is classified by assigning it to the class
which has the nearest mean vector.4. Error rate is estimated by the percentage of
misclassified samples
http://bci2.k-space.org
Bayes ClassifierBayes ClassifierAlgorithm Compute Gaussian distribution of each class (p.d.f) Compute probabilities of sample (a)F( a Є f0) & F( a Є f1)
http://bci2.k-space.org
K-Nearest Neighbor (KNN)K-Nearest Neighbor (KNN)Algorithm 1. Obtain distances between
test sample and all samples in the design set
2. Sort obtained distance values in ascending ordered array.
3. Assigns the test sample to the majority class in the subset.
4. Error rate is estimated by the percentage of misclassified samples
ResultsResults
Dataset Ia results
Our dataset results
http://bci2.k-space.org
Dataset Ia Best results Dataset Ia Best results
FFT feature (amplitude of 20 HZ)
KNN k=3 Accuracy Error
channel 3 80% 20%
Pwelch feature
KNN k=5 Accuracy Error
channel 4 78% 22%
http://bci2.k-space.org
Our Dataset Best ResultsOur Dataset Best Results
FFT feature (amplitude of 20 HZ)
KNN k=3 Accuracy Error
channel 3 54% 46%
KNN k=5 Accuracy Error
channel 4 58% 42%
Pwelch feature
http://bci2.k-space.org
BCI challengeBCI challenge
Information transfer rate.High error rate.Autonomy.Cognitive load.
http://bci2.k-space.org
Conclusion & FutureConclusion & Future
• In our project we built a simple BCI ,which separated between left and right hand movement
• System worked on online & offline data set• Online data pass through different stages:
FiltrationAmplificationInterfacing with computer using soundcardAnalysis and classify
http://bci2.k-space.org
Conclusion & FutureConclusion & Future
Completely paralyzed patients can use a BCI to realize a spelling system (virtual keyboard) to install a new non muscular communication channel.
•In the future: It will be used by total normal people to perform simple activities Spread commercially in the field of video gamesIn military
http://bci2.k-space.org
Online DemoOnline Demo
Thank YouThank You