ML Visuals
0~1s
Rest
Rest
ERP
PSD
T0
T1/T2
Motor Imagery
Time
T0
T1/T2
1~3s
Visual
Stimulus
Visual
Stimulus
Rest
Motor Imagery
Rest
Time
4-sec
Visual
Stimulus
Visual
Stimulus
An EEG Trial
L
L
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
L
L
L
A
A
A
A
A
A
A
A
A
A
L
L
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
L
L
L
A
A
A
A
A
A
A
A
A
A
Spectral-Stream
Spatial-Stream
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
L
A
A
A
A
A
A
A
A
Spectral-Stream
Spatial-Stream
EEG of all channels in time domain
(0-1s, downsampling to 100Hz)
EEG of all channels in frequency domain
(0-50Hz, average of 0-4s (one trial))
Spatial Topographic Maps
(25 frames)
Spectral Topographic Maps
(25 frames)
(a) EEG Topographic Maps Generation
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
L
A
A
A
A
A
A
A
A
Spectral-Stream
Temporal-Stream
EEG of all channels in time domain
(0-1s, downsampling to 100Hz)
EEG of all channels in frequency domain
(0-50Hz, average of 0-4s (one trial))
Spatial Topographic Maps
(25 frames)
Spectral Topographic Maps
(25 frames)
(b) Spatial-Spectral-Temporal Feature Learning
BiLSTM
CNN
ANN
FC
Layer
Softmax
Layer
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
L
A
A
A
A
A
A
A
A
Spectral-Stream
EEG of all channels in time domain
(0-1s, downsampling to 100Hz)
EEG of all channels in frequency domain
(0-50Hz, average of 0-4s (one trial))
Spatial Topographic Maps
(25 frames)
Spectral Topographic Maps
(25 frames)
(a) EEG Topographic Maps Generation
(b) Spatial-Spectral-Temporal Feature Learning
Bi-LSTM
CNN
ANN
FC
Layer
Softmax
Layer
Temporal-Stream
0ms
40ms
80ms
960ms
0Hz
2Hz
4Hz
48Hz
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
L
A
A
A
A
A
A
A
A
Spectral-Stream
Amplitude of all channels in time domain
(0-1s, downsampling to 100Hz)
PSD of all channels in frequency domain
(0-50Hz, average of 0-4s (one trial))
Spatial Topographic Maps
(25 frames)
Spectral Topographic Maps
(25 frames)
(a) EEG Topographic Maps Generation
(b) Spatial-Spectral-Temporal Feature Learning
Bi-LSTM
CNN
ANN
FC
Layer
Softmax
Layer
Temporal-Stream
Bicubic
Amplitude Distribution
(Interval: 40ms)
20ms
60ms
100ms
940ms
980ms
Power Distribution
(Interval: 2Hz)
1Hz
3Hz
5Hz
47Hz
49Hz
Spectral EEG Topographic Maps
(25 frames)
Temporal EEG Topographic Maps
(25 frames)
EEG of all channels in time domain (0-1s, downsampling to 100Hz)
EEG of all channels in frequency domain (0-50Hz, average of 0-4s (one trial))
Bicubic
L
L
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
L
L
L
A
A
A
A
A
A
A
A
A
A
head-like
topographic map
sensors position
box-like
topographic map
Basic components
Softmax
Convolve
Sharpen
Softmax
Convolve
Sharpen
Architectures
L
L
L
L
L
L
L
C
C
C
C
C
C
C
FC
SM
L
L
L
C
C
C
C
C
C
C
C
C
C
FC
SM
C
C
C
Conv
Level 1
Sample1
Sample2
Level 2
Sample1
Sample2
Level 3
Sample1
Sample2
Level 4
Sample1
Sample2
Frame1
Frame2
Frame3
Frame4
Frame5
Frame6
Frame7
Frame8
Frame9
Frame10
Frame1
Frame2
Frame3
Frame4
Frame5
Frame6
Frame7
Frame8
Frame9
Frame10
S7
S8
Frame1
Frame2
Frame3
Frame4
Frame5
Frame6
Frame7
Frame8
Frame9
Frame10
S7
S8
Level 1
Sample1
Sample2
Level 2
Sample1
Sample2
Level 3
Sample1
Sample2
Level 4
Sample1
Sample2
Frame1
Frame2
Frame3
Frame4
Frame5
Frame6
Frame7
Frame8
Frame9
Frame10
L
L
L
L
L
L
L
C
C
C
C
C
C
C
FC
SM
L
L
L
C
C
C
Conv
AM
L
L
L
L
L
L
L
C
C
C
C
C
C
C
FC
SM
L
L
L
C
C
C
Attention
A) CNN-LSTM
B) CNN-LSTM/1D-Conv
D) CNN-ANN-BiLSTM (ARCNN)
C) CNN-BiLSTM
A) LSTM
B) LSTM / 1D-Conv
D) Att-BiLSTM
C) BiLSTM
L
L
L
L
L
L
L
C
FC
SM
L
L
L
C
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
C
C
C
C
C
C
C
FC
SM
L
L
L
C
C
C
Conv
L
L
L
L
L
L
L
C
C
C
C
C
C
C
FC
SM
L
L
L
C
C
C
Conv
AM
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
FC
SM
L
L
L
C
C
C
Conv
AM
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
L
C
C
C
C
C
C
C
FC
SM
L
L
L
C
C
C
Conv
C
C
C
C
C
C
C
LSTM layer
Attention layer
CNN
layer
C
C
C
C
LSTM layer
Attention layer
CNN
layer
C
C
C
C
C
C
C
C
C
C
LSTM layer
Attention layer
CNN
layer
C
C
C
C
C
C
C
C
C
Output
L
L
L
L
L
L
L
C
FC
SM
L
L
L
C
C
C
C
C
C
C
C
C
L
L
L
L
L
L
L
AM
FC
SM
Conv
C
C
C
C
C
C
C
Input Layer
Hidden Layers
Output Layer
X = A[0]
a[4]
A[1]
A[3]
X
Ŷ
a[1]1
a[1]2
a[1]3
a[1]n
a[2]1
a[2]2
a[2]3
a[2]n
a[3]1
a[3]2
a[3]3
a[3]n
A[2]
A[4]
Input Layer
Hidden Layers
Output Layer
X = A[0]
a[4]
A[1]
A[3]
X
Ŷ
[1a]1
a[1]2
a[1]3
a[1]n
a[2]1
a[2]2
a[2]3
a[2]n
a[3]1
a[3]2
a[3]3
a[3]n
A[2]
A[4]
Input Layer
Hidden Layers
Output Layer
X = A[0]
a[4]
A[1]
A[3]
X
Ŷ
a[1]1
a[1]2
a[1]3
a[1]n
a[2]1
a[2]2
a[2]3
a[2]n
a[3]1
a[3]2
a[3]3
a[3]n
A[2]
A[4]
NxNx3
+b1
+b2
MxM
MxM
+b1
+b2
ReLU
ReLU
a[l]
MxMX2
a[l-1]
CONV operation
NxNx3
+b1
+b2
MxM
MxM
+b1
+b2
ReLU
ReLU
MxMX2
CONV operation
NxNx3
+b1
+b2
MxM
MxM
+b1
+b2
ReLU
ReLU
MxMX2
CONV operation
S=1
S=2
Striding in CONV
NxNx192
NxNx64
NxNx32
NxNx128
NxNx192
1x1 Same
3x3 Same
5x5 Same
MaxPool Same s=1
Inception Module
t-1
t
t-1
t
t
t-1
t
t
t-1
t-1
t
t-1
Positional
Encoding
Masked
Multi-Head
Attention
Add & Norm
Output
Embedding
Multi-Head
Attention
Add & Norm
Outputs(shifted right)
Positional
Encoding
Multi-Head
Attention
Add & Norm
Input
Embedding
Feed
Forward
Add & Norm
Inputs
Feed
Forward
Add & Norm
Linear
Softmax
Multi-Head
Attention
Add & Norm
Input
Embedding
Output
Embedding
Feed
Forward
Add & Norm
Masked
Multi-Head
Attention
Add & Norm
Multi-Head
Attention
Add & Norm
Feed
Forward
Add & Norm
Linear
Softmax
Inputs
Outputs (shifted right)
Positional
Encoding
Positional
Encoding
Tokenize
I
love
coding
and
writing
“I love coding and writing”
ML Concepts
Size
#bed
ZIP
Wealth
Family?
Walk?
School
PRICE ŷ
X
Y
X
Ŷ = 0
Ŷ = 1
How does NN work (Insprired from Coursera)
Logistic Regression
Basic Neuron Model
Size
$
Size
$
Linear regression
ReLU(x)
NxN
NxN
NxN
NxN
256
225
56
.
.
.
214
210
211
R-G-B
Unrolling Feature vectors
Large NN
Med NN
Small NN
SVM,LR etc
η
Amount of Data
Why does Deep learning work?
a[1]1
a[1]2
a[1]3
Input
Hidden
Output
X = A[0]
a[1]4
a[2]
A[1]
A[2]
X
Ŷ
One hidden layer neural network
a[1]1
a[1]2
x[1]
a[2]
x[2]
x[2]
x[3]
x[1]
Neural network templates
Train
Valid
Test
x1
x2
x1
x2
x1
x2
Train-Dev-Test vs. Model fitting
Underfitting
Good fit
Overfitting
x[2]
x[3]
x[1]
a[L]
x1
x2
r=1
x1
x2
DropOut
Normalization
w1
w1
w2
J
w1
w2
J
w1
w2
w2
Before Normalization
After Normalization
Early stopping
Dev
Train
Err
it.
x1
x2
w[1]
w[2]
w[L-2]
w[L-1]
w[L]
FN
TN
TP
FP
Deep neural networks
Understanding
Precision & Recall
w1
w2
SGD
BGD
w1
w2
SGD
Batch vs. Mini-batch �Gradient Descent
Batch �Gradient Descent vs. SGD
x[2]
x[3]
x[1]
p[1]
p[2]
Softmax Prediction with 2 outputs
Abstract backgrounds
dair.ai
Gradient Backgrounds
ML and Health
ICA
Conv
Conv
Conv
Conv
Conv
Conv
Time slice
Conv
Spatial Feature Learning
EEG Images
Alpha
RNN+ANN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
Temporal Feature Aggregation
Pain Intensity Assessment
Delta
Alpha
Beta
Spectral Topography Maps
EEG Time Series
ICA
Conv
Conv
Conv
Conv
Conv
Conv
Time slice
Conv
Spatial Feature Learning
EEG Images
Alpha
RNN+ANN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
CNN
Temporal Feature Aggregation
Pain Intensity Assessment
Delta
Alpha
Beta
Spectral Topography Maps
EEG Time Series
Pain
Localization
No pain
Conv
Conv
Conv
Conv
Conv
Conv
Conv
Conv
Conv
Conv
Level 1
Level 2
Level 3
Level 4
No Pain
Low Pain
Moderate Pain
High Pain
Signal Segmentation
Time
Withdraw
hand
Immerse
hand
Level-1
Level-2
Level-3
Level-4
No Pain
Time
Immerse
hand
Withdraw
hand
Low Pain
Medium Pain
High Pain
…
Sliding Window
Event-Marker
5s
Level 1
Level 2
Level 3
Level 4
No Pain
Low Pain
Medium Pain
High Pain
Time
Immerse
hand
Withdraw
hand
(a)
(b)
AEP
FFT
AEP
Delta
Alpha
Beta
Bicubic
EEG Image
(32x32x3)
FFT
PSD
Theta(4~8Hz)
Alpha(8~13Hz)
Beta(13~30Hz)
Image Generation
AEP
Bicubic
Spectral Topography Map
Conv3-32
x4
Maxpool
(2x2)
Conv3-64
x2
Maxpool
(2x2)
Conv3-
128
Maxpool
(2x2)
FC-512
Feature
Vector
Input
32x32x3
Output
ConvNet Configuration
Conv3-32
Conv3-32
Conv3-32
Max-Pool
Conv3-32
Conv3-128
Max-Pool
Conv3-64
Conv3-64
Max-Pool
Input
Conv
Conv
Max-Pool
Max-Pool
FC
Layer1
Softmax
FC
Layer2
Layer3
Layer4
Stack1
Stack2
Stack3
Input
Conv3-32
Conv3-32
Max-Pool
Conv3-128
Conv3-64
Conv3-64
Max-Pool
Layer1
Layer2
Layer3
FC-512
Output
Max-Pool
ConvNet Configuration
Stack4
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Output
Input
Conv3-32
Conv3-32
Max-Pool
Conv3-128
Conv3-64
Conv3-64
Max-Pool
Layer1
Layer2
Layer3
Max-Pool
ConvNet Configuration
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Output
Conv3-32
Conv3-32
Max-Pool
Conv3-128
Conv3-64
Conv3-64
Max-Pool
Layer1
Layer2
Layer3
Max-Pool
ConvNet Configuration
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Conv3-32
Output
Conv3-32
Conv3-32
Conv3-32
Max-Pool
Conv3-32
Conv3-128
Max-Pool
Conv3-64
Conv3-64
Max-Pool
Stack1
Stack2
Stack3
FC-512
Output
Stack4
Level 1
Level 2
Level 3
Level 4
Time
Level 5
No Pain
LowPain
MediumPain
High
Pain
Unbearable
Pain
(a)
(b)
Level 1
Level 2
Level 3
Level 4
Time
Level 5
No Pain
LowPain
MediumPain
High
Pain
Unbearable
Pain
(a)
(b)
Miscellaneous
3
64
16
16
32
32
64
128
128
256
256
128+256
128
1
64+128
64
32+64
32
16+32
16
16
Convolution 3x3
Max Pooling 2x2
Convolution 1x1
Skip connection
Up Sampling 2x2
Block copied
Dropout 0.1
Dropout 0.2
Dropout 0.3
Conv3-32
Conv3-32
Conv3-32
Max-Pool
Conv3-32
Conv3-128
Max-Pool
Conv3-64
Conv3-64
Max-Pool
Input
Conv
Conv
Max-Pool
Max-Pool
FC
Layer1
Softmax
FC
Layer2
Layer3
Layer4
Layer1
Layer2
Layer3
Layer4
Input
Conv3-32
Conv3-32
Conv3-32
Max-Pool
Conv3-32
Conv3-128
Conv3-64
Conv3-64
Max-Pool
Layer1
Layer2
Layer3
Feature
Vector
FC-512
Output
Max-Pool
FC-512
Output
Previous layer
1x1 convolutions
1x1 convolutions
3x3 convolutions
1x1 convolutions
5x5 convolutions
3x3 max pooling
1x1 convolutions
Filter concatenation
Previous layer
1x1 convolutions
1x1 convolutions
3x3 convolutions
1x1 convolutions
5x5 convolutions
3x3 max pooling
1x1 convolutions
Filter concatenation
Input
1x11 conv
1x11 conv
Inception 1
Inception 2
1x7 conv
1x7 conv
FC
FC
Output
Inception 2
Inception 2
Previous layer
1x3 conv,
1 padding
1x5 conv,
2 padding
1x3 conv,
1 padding
1x7 conv,
3 padding
Filter concatenation
1x3 conv,
1 padding
1x3 conv,
1 padding
Input
Conv
Max-Pool
Max-Pool
Max-Pool
Inception
Inception
Max-Pool
Conv
Max-Pool
Conv
Inception
Inception
Inception
Inception
Inception
Inception
Inception
Avg-Pool
Conv
FC
FC
Softmax
Avg-Pool
Conv
FC
Softmax
Avg-Pool
Conv
FC
FC
Softmax
Auxiliary Classifier
Auxiliary Classifier
Previous layer
1x1 conv.
1x1 conv.
3x3 conv.
1x1 conv.
3x3 conv.
Pool
1x1 conv.
Filter concatenation
3x3 conv.
Previous layer
1x1 conv.
1x1 conv.
1x1 conv.
3x3 conv.
Pool
1x1 conv.
Filter concatenation
1x3 conv.
3x1 conv.
1x3 conv.
3x1 conv.
(a)
(b)
R1
R2
R3
R1
R2
R3
R1
R1
R1
R2
Stacked layers
Previous input
x
F(x)
y=F(x)
Stacked layers
Previous input
x
F(x)
y=F(x)+x
x
identity
+
Input
Conv
Avg-Pool
Dense Block 2
Dense Block 3
Conv
Avg-Pool
Conv
Dense Block 1
Avg-Pool
FC
Softmax
Transition layers
3x3 conv
(a)
add
identity
3x3 conv
5x5 conv
3x3 avg
identity
3x3 avg
3x3 avg
3x3 conv
5x5 conv
add
add
add
add
Filter concatenation
hi
hi-1
...
hi+1
hi
hi-1
...
7x7 conv
5x5 conv
7x7 conv
3x3 max
5x5 conv
3x3 avg
add
add
add
identity
3x3 avg
3x3 max
3x3 conv
add
add
Filter concatenation
hi+1
(b)
1
1
2
4
5
6
7
8
3
2
1
0
1
2
3
4
6
8
3
4
Max(1,1,5,6) = 6
Image Representation
Y
X
Pooling performed with a 2x2 kernel and a stride of 2
ML System Design / Infrastructure
EEG
疼痛识别
疼痛等级
疼痛位置
APP
治疗力度
治疗方案
疼痛治疗仪
使用者的治疗时长、治疗方案、治疗反馈记录
Pain Recognition
EEG
Deep
Learning
Pain Localization
疼痛强度
APP
Page Design
Data
Mining
Reinforce
Learning
Pain Treatment Apparatus
Appearance
Design
Circuit
Design
治疗力度
治疗方案
Pain Management
治疗反馈
脑电检测
Closed-loop Control
应用场景
APP
页面设计
数据挖掘
强化学习
疼痛治疗仪
外观设计
电路设计
治疗力度
治疗方案
治疗反馈
主观疼痛感受
疼痛治疗
普通用户
脑电信号
采集/反馈
疼痛识别
EEG
深度学习
疼痛定位
疼痛强度
APP
页面设计
数据挖掘
强化学习
疼痛治疗仪
外观设计
电路设计
治疗力度
治疗方案
疼痛治疗
特殊患者
脑电监测
脑电信号
采集/反馈
疼痛识别
EEG
深度学习
疼痛定位
疼痛强度
APP
页面设计
数据挖掘
强化学习
疼痛治疗仪
外观设计
电路设计
治疗力度
治疗方案
疼痛治疗
主动反馈
EEG
机器挖掘
强化学习
治疗参数自动调整
治疗参数
治疗反馈
信号处理
特征提取
疼痛分类
可视化
治疗参数人为调整
服务器
用户端
疼痛缓解
治疗系统
Tens片
治疗方案
疼痛源
识别结果
治疗记录
个人信息
疼痛检测系统
精确治疗系统
不同场景—— 痛经治疗仪
脑电信号
采集/反馈
疼痛识别
EEG
深度学习
疼痛定位
疼痛强度
APP
页面
设计
数据挖掘
强化学习
疼痛治疗仪
外观设计
电路设计
治疗力度
治疗方案
疼痛治疗
治疗反馈
主观疼痛感受
特殊患者