1 of 118

2 of 118

Basic components

3 of 118

4 of 118

5 of 118

6 of 118

7 of 118

Softmax

Convolve

Sharpen

8 of 118

Softmax

Convolve

Sharpen

9 of 118

10 of 118

Architectures

11 of 118

S2

S3

Frame1

Frame2

Frame3

Frame4

Frame5

Frame6

Frame7

12 of 118

Frame5

Frame6

Frame7

Level 1

Sample1

Sample2

Frame4

Frame3

Frame2

Frame1

Level 2

Sample1

Sample2

Level 3

Sample1

Sample2

Level 4

Sample1

Sample2

13 of 118

C

C

C

CNN

Layer

14 of 118

15 of 118

16 of 118

17 of 118

Conv3-32

x4

Maxpool

Conv3-64

x2

Maxpool

(2x2)

Conv3-128

x1

Maxpool

(2x2)

FC-512

Feature

Vector

Output

Input

32x32x3

18 of 118

19 of 118

20 of 118

L

L

L

L

L

L

L

L

L

L

L

L

L

L

AM

FC

SM

Conv

C

C

C

C

C

C

C

21 of 118

L

L

L

L

L

L

L

Conv

C

C

C

C

C

C

C

FC

SM

22 of 118

L

L

L

L

L

L

L

C

C

C

C

C

C

C

FC

SM

L

L

L

C

C

C

23 of 118

C

C

C

C

C

C

C

FC

SM

C

C

C

Conv

24 of 118

A) LSTM

B) Mixed LSTM / 1D Conv

D) Mixed Att-BiLSTM / 1D Conv

C) Mixed BiLSTM / 1D Conv

25 of 118

A) LSTM

B) LSTM / 1D Conv

D) Att-BiLSTM / 1D Conv

C) BiLSTM / 1DConv

26 of 118

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

27 of 118

Frame1

Frame2

Frame3

Frame4

Frame5

Frame6

Frame7

Frame8

Frame9

Frame10

S7

S8

28 of 118

29 of 118

L

L

L

L

L

L

L

C

C

C

C

C

C

C

FC

SM

L

L

L

C

C

C

Conv

AM

30 of 118

L

L

L

L

L

L

L

C

C

C

C

C

C

C

FC

SM

L

L

L

C

C

C

AM

31 of 118

L

L

L

L

L

L

L

C

C

C

C

C

C

C

FC

SM

L

L

L

C

C

C

32 of 118

L

L

L

L

L

L

L

C

C

C

C

C

C

C

FC

SM

L

L

L

C

C

C

Conv

33 of 118

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

34 of 118

35 of 118

36 of 118

L

L

L

L

L

L

L

C

C

C

C

C

C

C

FC

SM

L

L

L

C

C

C

Conv

37 of 118

C

C

C

C

C

C

C

LSTM layer

Attention layer

CNN

layer

C

C

C

38 of 118

C

C

C

C

C

C

C

C

C

C

LSTM layer

Attention layer

CNN

layer

39 of 118

L

L

L

L

L

L

L

AM

FC

SM

Conv

C

C

C

C

C

C

C

40 of 118

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]

41 of 118

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]

42 of 118

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]

43 of 118

NxNx3

+b1

+b2

MxM

MxM

+b1

+b2

ReLU

ReLU

a[l]

MxMX2

a[l-1]

CONV operation

44 of 118

NxNx3

+b1

+b2

MxM

MxM

+b1

+b2

ReLU

ReLU

MxMX2

CONV operation

45 of 118

NxNx3

+b1

+b2

MxM

MxM

+b1

+b2

ReLU

ReLU

MxMX2

CONV operation

46 of 118

S=1

S=2

Striding in CONV

47 of 118

NxNx192

NxNx64

NxNx32

NxNx128

NxNx192

1x1 Same

3x3 Same

5x5 Same

MaxPool Same s=1

Inception Module

48 of 118

49 of 118

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

50 of 118

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

51 of 118

Tokenize

I

love

coding

and

writing

“I love coding and writing”

52 of 118

ML Concepts

53 of 118

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

54 of 118

Size

$

Size

$

Linear regression

ReLU(x)

55 of 118

NxN

NxN

NxN

NxN

256

225

56

.

.

.

214

210

211

R-G-B

Unrolling Feature vectors

56 of 118

Large NN

Med NN

Small NN

SVM,LR etc

η

Amount of Data

Why does Deep learning work?

57 of 118

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

58 of 118

a[1]1

a[1]2

x[1]

a[2]

x[2]

x[2]

x[3]

x[1]

Neural network templates

59 of 118

Train

Valid

Test

x1

x2

x1

x2

x1

x2

Train-Dev-Test vs. Model fitting

Underfitting

Good fit

Overfitting

60 of 118

x[2]

x[3]

x[1]

a[L]

x1

x2

r=1

x1

x2

DropOut

Normalization

61 of 118

w1

w1

w2

J

w1

w2

J

w1

w2

w2

Before Normalization

After Normalization

Early stopping

Dev

Train

Err

it.

62 of 118

x1

x2

w[1]

w[2]

w[L-2]

w[L-1]

w[L]

FN

TN

TP

FP

Deep neural networks

Understanding

Precision & Recall

63 of 118

w1

w2

SGD

BGD

w1

w2

SGD

Batch vs. Mini-batch �Gradient Descent

Batch �Gradient Descent vs. SGD

64 of 118

x[2]

x[3]

x[1]

p[1]

p[2]

Softmax Prediction with 2 outputs

65 of 118

Abstract backgrounds

66 of 118

67 of 118

dair.ai

68 of 118

69 of 118

70 of 118

Gradient Backgrounds

71 of 118

72 of 118

73 of 118

74 of 118

ML and Health

75 of 118

ICA

Conv

Conv

Conv

Conv

Conv

Conv

EEG Time Series

Time slice

Conv

Spatial Feature Learning

EEG Images

Spectral Topography Maps

Alpha

LSTM+AM

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Temporal Feature Aggregation

Pain Intensity Assessment

Delta

Alpha

Beta

76 of 118

77 of 118

Pain Location Assessment

ICA

Conv

Conv

Conv

Conv

Conv

Conv

EEG Time Series

Time slice

Conv

Spatial Feature Learning

EEG Images

Spectral Topography Maps

Alpha

Alpha

Theta

LSTM+AM

Beta

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Temporal Feature Aggregation

Pain Intensity Assessment

78 of 118

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

Conv

79 of 118

80 of 118

81 of 118

Activations

(U=WX)

Scalp maps

( )

82 of 118

83 of 118

84 of 118

85 of 118

Test Subject

S1

S2

S3

S4

S5

S6

S7

S8

S9

S10

S11

S12

S13

Average Accuracy

Pain Intensity

0.8209

0.8882

0.9569

0.9625

0.9322

0.9563

1

0.9707

0.9809

0.9226

0.9015

0.892

0.8094

0.922623077

Pain Location

0.7243

0.8028

0.9397

0.9951

0.9286

1

0.9948

0.9088

0.8844

0.8956

0.8816

0.7081

0.7591

0.878684615

86 of 118

87 of 118

88 of 118

Level 1

Level 2

Level 3

Level 4

No Pain

Low Pain

Moderate Pain

High Pain

Signal Segmentation

Time

Withdraw

hand

Immerse

hand

89 of 118

Level 1

Level 2

Level 3

Level 4

No Pain

Low Pain

Moderate Pain

High Pain

Time

Immerse

hand

Withdraw

hand

90 of 118

91 of 118

92 of 118

AEP

93 of 118

Bicubic

Spectral Topography Map

PSD

AEP

Delta

Alpha

Beta

94 of 118

FFT

PSD

Theta(4~8Hz)

Alpha(8~13Hz)

Beta(13~30Hz)

Bicubic

Spectral Topography Map

Image Generation

AEP

95 of 118

Conv3-32

x4

Maxpool

(2x2)

Conv3-64

x2

Maxpool

(2x2)

Conv3-

128

Maxpool

(2x2)

FC-512

Feature

Vector

Input

32x32x3

Output

ConvNet Configuration

96 of 118

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

Conv3-32

Max-Pool

Conv3-32

Conv3-128

Conv3-64

Conv3-64

Max-Pool

Layer1

Layer2

Layer3

FC-512

Output

Max-Pool

FC-512

Output

ConvNet Configuration

Stack4

97 of 118

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

98 of 118

Level 1

Level 2

Level 3

Level 4

Time

Level 5

No Pain

LowPain

MediumPain

High

Pain

Unbearable

Pain

(a)

(b)

99 of 118

Level 1

Level 2

Level 3

Level 4

Time

Level 5

No Pain

LowPain

MediumPain

High

Pain

Unbearable

Pain

(a)

(b)

100 of 118

101 of 118

102 of 118

Miscellaneous

103 of 118

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

104 of 118

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

105 of 118

Previous layer

1x1 convolutions

1x1 convolutions

3x3 convolutions

1x1 convolutions

5x5 convolutions

3x3 max pooling

1x1 convolutions

Filter concatenation

106 of 118

Previous layer

1x1 convolutions

1x1 convolutions

3x3 convolutions

1x1 convolutions

5x5 convolutions

3x3 max pooling

1x1 convolutions

Filter concatenation

107 of 118

Input

1x11 conv

1x11 conv

Inception 1

Inception 2

1x7 conv

1x7 conv

FC

FC

Output

Inception 2

Inception 2

108 of 118

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

109 of 118

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

110 of 118

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)

111 of 118

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

+

112 of 118

Input

Conv

Avg-Pool

Dense Block 2

Dense Block 3

Conv

Avg-Pool

Conv

Dense Block 1

Avg-Pool

FC

Softmax

Transition layers

113 of 118

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)

114 of 118

115 of 118

116 of 118

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

117 of 118

ML System Design / Infrastructure

118 of 118

脑电波头盔

疼痛等级

疼痛位置

APP

治疗力度

治疗方案

疼痛治疗仪

使用者的治疗时长、治疗方案、治疗反馈记录