Professional Documents
Culture Documents
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
2
Classification Problem vs Regression Problem
Classification Problem VS Regression Problem
Classification Regression
การจําแนกข้อมูล เช่น การแยกสายพันธุ์ดอกไม้จากความ การทํานายข้อมูล เช่น การทํานายราคาบ้านจากขนาดของบ้าน
กว้างความยาวของกลีบดอก
4
Classification Problem
Classification Problem
Iris Virginica
Iris Setosa
Width (cm) 8
Classification Problem
Length (cm)
Iris Virginica
Iris Setosa
Width (cm) 9
https://www.desmos.com/calculator/qbpm3fc4zc
10
Prediction Example
ตัวอยางจุดสีดําในภาพแทนดอกไมดอกใหมที่เราจะนํามาจําแนกวาอยูกลุมไหน ความกวางของ
ดอก 0.9 cm และความยาวของดอก 0.8 cm อยูในพื้นที่ๆ เราจําแนกไดเปนดอกไมสีมวง 11
More About Linear vs Nonlinear
https://playground.tensorflow.org
12
Source: https://study.com/academy/lesson/how-to-recognize-linear-functions-vs-non-linear-functions.html
Regression Problem
ข้อมูลราคาบ้าน
ราคาบ้าน
ชื่อผู้ขาย วันที่ประกาศขาย ตําแหน่งที่ตั้ง ขนาดบ้าน (ft2) จํานวนห้องนอน
($1000)
ตัวอย่างข้อมูลดิบของการขายบ้าน
14
Supervised Learning Workflow
ว ิเคราะห์ปัญหาจากข้อมูลว่าเป็นปัญหาประเภท
คัดเลือกเฉพาะข้อมูลที่เกี่ยวข้อง
ไหน (Classification, Regression, etc.)
Raw Data Cleaned Data
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
15
คัดเลือกข้อมูลที่เกี่ยวข้อง
ราคาบ้าน
ชื่อผู้ขาย วันที่ประกาศขาย ตําแหน่งที่ตั้ง ขนาดบ้าน (ft2) จํานวนห้องนอน
($1000)
16
Regression Problem
Source: https://github.com/girishkuniyal/Predict-housing-prices-in-Portland/blob/master/ex1data2.txt 17
Regression Problem
เราต้องการหาสมการเส้นตรงหนึ่งเส้นที่ทํานายราคาบ้านได้จากขนาดของบ้าน
Source: https://github.com/girishkuniyal/Predict-housing-prices-in-Portland/blob/master/ex1data2.txt 18
Regression Problem
Source: https://github.com/girishkuniyal/Predict-housing-prices-in-Portland/blob/master/ex1data2.txt 19
Regression Problem
Source: https://github.com/girishkuniyal/Predict-housing-prices-in-Portland/blob/master/ex1data2.txt 20
Recap: Classification vs Regression
Classification Regression
การจําแนกข้อมูล เช่น การแยกสายพันธุ์ดอกไม้จากความ การทํานายข้อมูล เช่น การทํานายราคาบ้านจากขนาดของบ้าน
กว้างความยาวของกลีบดอก
21
Supervised Learning Workflow
ว ิเคราะห์ปัญหาจากข้อมูลว่าเป็นปัญหาประเภท
คัดเลือกเฉพาะข้อมูลที่เกี่ยวข้อง
ไหน (Classification, Regression, etc.)
Raw Data Cleaned Data
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
22
กําหนด Label และตรวจสอบความถูกต้องของข้อมูล
ราคาบ้าน
ขนาดบ้าน จํานวนห้องนอน
(Label)
2104 3 399
1600 3 329
2400 3 369
23
Supervised Learning Workflow
ว ิเคราะห์ปัญหาจากข้อมูลว่าเป็นปัญหาประเภท
คัดเลือกเฉาะข้อมูลที่เกี่ยวข้อง
ไหน (Classification, Regression, etc.)
Raw Data Cleaned Data
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
24
แบ่ง Dataset เป็น Training Set, Validation Set, Test Set
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
Training Set (60%)
2400 3 369
จํานวนห้อง ราคาบ้าน
ขนาดบ้าน
นอน (Label) ... ... ...
2105 3 398
1600 3 329
1605 3 328
Validation Set (20%)
2400 3 369 2405 3 368
1607 3 325
Test Set (20%)
2407 3 365
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
26
Neural Network
What is Neural Network?
Source: http://www.cs.stir.ac.uk/courses/ITNP4B/lectures/kms/4-MLP.pdf 28
Solve XOR Problem using a Simple Neural Network
x1 h1
x2 h2
https://www.desmos.com/calculator/xvtdj4fog8
29
Handwritten Digits Classification (MNIST)
Source: https://towardsdatascience.com/image-classification-in-10-minutes-with-mnist-dataset-54c35b77a38d 30
LeNet-5 to Solve Handwritten Digits Problem
Source: https://adeshpande3.github.io/A-Beginner%27s-Guide-To-Understanding-Convolutional-Neural-Networks/ 32
VGG-16 to Solve Image Classification
Source: https://www.pyimagesearch.com/2017/03/20/imagenet-vggnet-resnet-inception-xception-keras/ 33
A Simple Neural Network
Recap: House Price Data
Source: https://github.com/girishkuniyal/Predict-housing-prices-in-Portland/blob/master/resources/output_4_0.png 35
Neural Network: A Simple Model
x1 w1
p: house price
w2
x2
Input: Output:
x1 คือขนาดบ้านเป็นตารางฟุต p คือราคาบ้าน
x2 คือจํานวนห้องนอน Output เป็นผลลัพธ์การทํานายของ
โมเดล ในที่นี้เราต้องการให้โมเด
ลทํานายราคาบ้านจากขนาดบ้านและ
จํานวนห้องนอน
36
Neural Network: A Simple Model
x1 w1
p: house price
w2
x2
Weight:
w1 คือตัวเลขที่จะบอกความสําคัญของ x1 ในการทํานายราคาบ้าน
w2 คือตัวเลขที่จะบอกความสําคัญของ x2 ในการทํานายราคาบ้าน
w ตัวไหนที่มีค่ามากหมายความว่า feature (x1 หร ือ x2) นัน
้ ๆ ช่วยทําให้โมเดลทํานายราคาบ้านได้
37
Neural Network: A Simple Model
x1 w1
p: x1w1 + x2w2
w2
x2
Weight:
ค่านํ้าหนัก w1, w2 คือตัวเลขที่จะบอกความสัมพันธ์ของ feature ของข้อมูล (ขนาดบ้านและ
จํานวนห้องนอน) ค่า weight เหล่านี้มีชื่อเร ียกหลายแบบ เช่น parameter, θ (Theta)
x1 w1
p: x1w1 + x2w2
w2
x2
Weight:
ค่านํ้าหนัก w1, w2 คือตัวเลขที่จะบอกความสัมพันธ์ของ feature ของข้อมูล (ขนาดบ้านและ
จํานวนห้องนอน) ค่า weight เหล่านี้มีชื่อเร ียกหลายแบบ เช่น parameter, θ (Theta)
x1 w1
w3
p: house price
x2 w2
40
Example of Neural Network with Hidden Layer
x1 w1 h1
w3
p: house price
x2 w2
h1 = x1w1 + x2w2 +
b1
41
Example of Neural Network with Hidden Layer
x1 w1 h1
w3
p = h1w3 + b2
x2 w2
h1 = x1w1 + x2w2 +
b1
42
Supervised Learning Workflow
ว ิเคราะห์ปัญหาจากข้อมูลว่าเป็นปัญหาประเภท
คัดเลือกเฉพาะข้อมูลที่เกี่ยวข้อง
ไหน (Classification, Regression, etc.)
Raw Data Cleaned Data
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
43
PyTorch
A Simple and Powerful Deep Learning Framework
The Origin of PyTorch
45
Source: https://github.com/pytorch/pytorch/commit/731041cb6a12b6f46626e16a04ab11523fed1c49
PyTorch Authors
Edward Z. Yang Adam Paszke
Research Engineer Deep Learning Engineer
Facebook AI Research NVIDIA
46
Source: https://github.com/pytorch/pytorch 47
Source: https://github.com/pytorch/pytorch 48
49
Source: http://blog.ezyang.com/2019/05/pytorch-internals/
2D Array
50
Source: http://blog.ezyang.com/2019/05/pytorch-internals/
51
Source: http://blog.ezyang.com/2019/05/pytorch-internals/
Tensor Supported Data Type
52
Source: https://pytorch.org/docs/stable/tensors.html
Workshop 7: Tensor in PyTorch
Neural Networks
Source: https://www.analyticsindiamag.com/how-to-create-your-first-artificial-neural-network-in-python/ 54
Tensor as Neural Network Data Structure
55
Source: https://hmkcode.github.io/ai/backpropagation-step-by-step/
Neural Network Lifecycle
56
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Neural Network Lifecycle
57
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Workshop 8: A Simple Neural
Network in PyTorch
Recap: What we want to solve?
Classification Regression
การจําแนกข้อมูล เช่น การแยกสายพันธุ์ดอกไม้จากความ การทํานายข้อมูล เช่น การทํานายราคาบ้านจากขนาดของบ้าน
กว้างความยาวของกลีบดอก
59
Recap: House Price Dataset
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
Training Set (60%)
2400 3 369
จํานวนห้อง ราคาบ้าน
ขนาดบ้าน
นอน (Label) ... ... ...
2105 3 398
1600 3 329
1605 3 328
Validation Set (20%)
2400 3 369 2405 3 368
Dataset
2107 3 395
1607 3 325
Test Set (20%)
2407 3 365
2104 3 399
1600 3 329
2400 3 369
Training Set
x1 w1 h1
w3
p = h1w3 + b2
x2 w2
h1 = x1w1 + x2w2 + b1 61
Neural Network: Input from Training Set
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
2400 3 369
Training Set
2104 w1 h1
w3
p = h1w3 + b2
3 w2
h1 = x1w1 + x2w2 + b1 62
Neural Network: Random Weights
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
2400 3 369
Training Set
2104 0.16 h1
0.01
p = h1w3 + b2
0.1
3
h1 = x1w1 + x2w2 + b1 b1=0, b2=0 63
Neural Network: Feedforward
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
2400 3 369
Training Set
2104 0.16 h1
0.01
p = h1w3 + b2
0.1
3
h1 = 336.94 b1=0, b2=0 64
Neural Network: Feedforward
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
2400 3 369
Training Set
2104 0.16 h1
0.01
p = 3.3694
0.1
3
h1 = 336.94 b1=0, b2=0 65
Workshop 9: Implementing
PyTorch Neural Network on MNIST
Dataset
Neural Network Lifecycle
67
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Supervised Learning Workflow
ว ิเคราะห์ปัญหาจากข้อมูลว่าเป็นปัญหาประเภท
คัดเลือกเฉพาะข้อมูลที่เกี่ยวข้อง
ไหน (Classification, Regression, etc.)
Raw Data Cleaned Data
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
68
Optimizing Neural Network
Optimization Examples
70
Source: https://medium.com/coinmonks/backpropagation-concept-explained-in-5-levels-of-difficulty-8b220a939db5
Neural Network Lifecycle
71
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Neural Network: Calculate Error/Loss
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
การคํานวณหา Error คือการวัดผลว่า Model เรา
1600 3 329 ทํานายผลได้แม่นแค่ไหน
2400 3 369
Training Set
2104 0.16 h1
0.01
p = 3.3694
0.1
3
h1 = 336.94 b1=0, b2=0 72
Neural Network: Calculate Error
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
เราจะคํานวณ Error จากระยะห่างระหว่าง p
1600 3 329 (Prediction) และ Label
2400 3 369
Training Set
2104 0.16 h1
0.01
p = 3.3694
0.1
3
h1 = 336.94 b1=0, b2=0 73
Neural Network: Calculate Error
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
ว ิธีการหนึ่งคือเอามาลบกันตรงๆ
1600 3 329 3.3694 - 399 = -399.63
2400 3 369
Training Set
2104 0.16 h1
0.01
p = 3.3694
0.1
3
h1 = 336.94 b1=0, b2=0 74
Neural Network: Calculate Error
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
Training Set
2104 0.16 h1
0.01
p = 3.3694
0.1
3
h1 = 336.94 b1=0, b2=0 75
Error Functions / Loss Functions
โมเดลอาจจะ Predict ออกมาเปนคาติดลบ เราอยากรูระยะหางระหวาง Model Prediction กับ Label ดังนั้นเราสามารถใส Absolute
หรือยกกําลังสองเพื่อที่ตอนนํา Error ของแตละ training samples มารวมกันอยูใน Scale เดียวกัน
(ถา Data ของเรามีลักษณะเกาะกลุมกันเหมือนตัวอยางราคาบาน เราจะมีการกระจายของ Error ที่เปน Normal Distribution ที่คา Mean
เปน 0 ซึ่งสอดคลองกับ Square Error)
Dataset ที่คลายๆ กับตัวอยางราคาบานแนะนําใหใช Square Error เพื่อหาระยะหางระวาง Model Prediction กับ Label
https://pytorch.org/docs/stable/nn.html#loss-functions
76
Source: https://people.orie.cornell.edu/mru8/doc/udell18_big_data.pdf
Neural Network Lifecycle
77
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Neural Network Lifecycle
78
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Optimization Goal
79
Source: https://medium.com/coinmonks/backpropagation-concept-explained-in-5-levels-of-difficulty-8b220a939db5
Neural Network: Reduce Error
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
2400 3 369
Training Set
2104 0.16 h1
0.01
p = 3.3694
0.1
3
h1 = 336.94 b1=0, b2=0 80
Neural Network: Reduce Error
ขนาดบ้าน จํานวนห้องนอน ราคาบ้าน (Label)
2104 3 399
1600 3 329
2400 3 369
Training Set
เราต้องปรับโมเดลของเราที่เป็นเส้นสีแดงให้เข้าใกล้เส้นสีเขียว
ที่มี Error น้อยกว่า (prediction ใกล้เคียงกับ Label)
สิ่งที่เราปรับได้ใน Model คือค่า Weight
2104 0.16 h1
0.01
p = 3.3694
0.1
3
h1 = 336.94 b1=0, b2=0 81
เราจะปรับค่า Weight เพื่อลด Error ได้อย่างไร?
Minimize Error
82
เราจะปรับค่า Weight เพื่อลด Error ได้อย่างไร?
84
เราจะปรับค่า Weight เพื่อลด Error ได้อย่างไร?
85
เราจะปรับค่า Weight เพื่อลด Error ได้อย่างไร?
86
เราจะปรับค่า Weight เพื่อลด Error ได้อย่างไร?
87
คํานวณความชันของ Error
ทีนี้เราจะหาความชันเส้นสีนํ้าเงินได้อย่างไร?
88
คํานวณความชันของ Error
89
คํานวณความชันของ Error
90
คํานวณความชันของ Error
91
คํานวณความชันของ Error
92
คํานวณความชันของ Error
94
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Neural Network Lifecycle
95
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Backpropagation
Backpropagation
Backpropagation คือ วิธีการปรับคา weight ใน neural network เพื่อใหโมเดลทํานายผล
ไดแมนขึ้น (error นอย) Backpropagation เปนวิธีการที่มีประสิทธิภาพกวาการวน loop ปรับ
weight ทีละคาเนื่องจากมีการ re-use คาความชันของ error จาก layer กอนหนา
97
Backpropagation Algorithm
https://google-developers.appspot.com/machine-learning/crash-course/backprop-scroll/
98
Neural Network Lifecycle
99
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Recap: คํานวณความชันของ Error
101
Learning Rate
102
Source: https://www.jeremyjordan.me/nn-learning-rate/
เรมิ่ ต้น Update Weight จาก Layer ท้ายสุด
103
เรมิ่ ต้น Update Weight จาก Layer ท้ายสุด
104
เรมิ่ ต้น Update Weight จาก Layer ท้ายสุด
105
เรมิ่ ต้น Update Weight จาก Layer ท้ายสุด
106
เรมิ่ ต้น Update Weight จาก Layer ท้ายสุด
107
Update w1 และ w2
109
Update w1 และ w2
110
Update w1 และ w2
111
Update w1 และ w2
112
Update w1 และ w2
113
เปร ียบเทียบ Weight เดิมกับ Weight ใหม่
2104 0.16 h1
0.1433
p = 48.28
0.1
3
h1 = 336.94 b1=0, b2=0 114
เปร ียบเทียบ Weight เดิมกับ Weight ใหม่
2104 0.16 h1
0.1433
p = 48.28 Label: $399
0.1
3
h1 = 336.94 b1=0, b2=0 115
Recap: Neural Network Lifecycle
116
Source: https://medium.com/datathings/neural-networks-and-backpropagation-explained-in-a-simple-way-f540a3611f5e
Workshop 10: Backpropagation
PyTorch Autograd (Automatic Differentiation)
118
Source: https://pytorch.org/docs/stable/tensors.html?highlight=backward#torch.Tensor.backward
Source: https://github.com/pytorch/pytorch 119
Supervised Learning Workflow
ว ิเคราะห์ปัญหาจากข้อมูลว่าเป็นปัญหาประเภท
คัดเลือกเฉาะข้อมูลที่เกี่ยวข้อง
ไหน (Classification, Regression, etc.)
Raw Data Cleaned Data
กําหนดโครงสร้างของ Neural
นํา Training Set ไป Train โดย
Network และกําหนด Error ปรับจูน Hyperparameter ต่างๆ
วัดผลเทียบกับ Validation Set
Function
Deploy Model
120
Workshop 11: Train Neural
Network in PyTorch
Workshop 12: Fashion-MNIST
Dataset
Hyperparameters: Tuning the Neural Network
Batch Size, Iteration, and Epoch
Given a training set with 48,000 samples.
124
Source: https://machinelearningmastery.com/difference-between-a-batch-and-an-epoch/
Learning Rate
125
Source: https://www.jeremyjordan.me/nn-learning-rate/
Momentum
n คือจํานวน layers
w[j] คือค่า weight ที่ layer jth
m คือ จํานวน input samples
λ คือค่า weight decay
128
Source: https://www.d2l.ai/chapter_multilayer-perceptrons/weight-decay.html
Feature Scaling
129
Source: https://slideplayer.com/slide/16156919/
130
Source: https://www.youtube.com/watch?v=wEoyxE0GP2M
Convolutional Neural Network
132
Source: https://neurology.mhmedical.com/book.aspx?bookID=1049
Image Classification Development
136
137
What is Convolution?
Photo editor apps
139
Source: https://www.macthai.com/2016/01/08/15-necessary-apps-editor-photo-for-ios/
Kernel/Filter
=
Input Image Convolution Blurred Image
140
Source: https://en.wikipedia.org/wiki/Kernel_(image_processing)
Convolution Operation
141
Source: http://cs231n.github.io/convolutional-networks/
Bias Y=θx+Thai
142
Calculate Feature Maps Dimension (1)
Output Dimension:
i คือ ขนาดของ input
p คือ จํานวน padding
f คือ ขนาดของ filter
Padding: 1, Stride: 1
s คือ ก้าวทีละกี่ช่อง (stride)
144
Convolution as Edge Detection
Vertical Edge Detection
= ?
Kernel
Input Image
146
Vertical Edge Detection
=
Kernel
Output/Feature maps
Input Image
147
Horizontal Edge Detection
=
Kernel
Output/Feature maps
Input Image
148
Workshop 13: Convolution
Workshop 14: Tensor with TensorFlow
Convolutional Neural Network
152
Source: http://cs231n.github.io/convolutional-networks/
ReLU (Rectified Linear Unit)
154
Source: https://computersciencewiki.org/index.php/Max-pooling_/_Pooling
A Simple Convolutional Neural Network
A simple model using Keras and TensorFlow.
156
A simple model summary. None in output shape a batch
size, it will be specify when you train a model. 157
Classification Layer
Flatten Layer and Dense Layer
Dense(10)
Feature Maps, 5x3 Flatten(), 15x1
Kernel, 15x10
1 Class #1 Probability
2
1 2 3
3
4 5 6
. Fully Connected
7 8 9 .
. .
.
10 11 12 .
13
13 14 15 14
15
160
Source: https://towardsdatascience.com/cutting-edge-face-recognition-is-complicated-these-spreadsheets-make-it-easier-e7864dbf0e1a
Softmax (2)
Actual Image
161
Cross-Entropy Loss
Normalized
Probability S(y) Cross-entropy (D) Label (L)
0.97 0.03 1.00
0.02 0.00 0.00
0.01 0.00 0.00
Loss 0.03
162
Softmax Cross-Entropy Loss
163
Source: https://towardsdatascience.com/cutting-edge-face-recognition-is-complicated-these-spreadsheets-make-it-easier-e7864dbf0e1a
Workshop 15: A Simple CNN
MobileNets
MobileNets Architecture
166
Source: https://arxiv.org/abs/1704.04861
Global Average Pooling (GAP)
For example, each channel of 3x3x3 kernel slided through each channel
of an input image, and sum all values into the feature maps.
169
Source: https://machinethink.net/blog/googles-mobile-net-architecture-on-iphone/
Depthwise Convolutional Layer
171
Source: https://machinethink.net/blog/googles-mobile-net-architecture-on-iphone/
Depthwise Separable Convolution is Fast!
Input Image: 224x224x3
Regular Convolution (64 filters)
2
(224-3+1) x (3x3x3) x 64 = 85,162,752 multiplication operations
output size: filter size number of filters
(input size - filter
size + 1)2
Pointwise Convolution
(224-3+1)2 x (1x1x3) x 64 = 9,462,528
Total: ? multiplication operations
172
Depthwise Separable Convolution is Fast!
Input Image: 224x224x3
Regular Convolution (64 filters)
2
(224-3+1) x (3x3x3) x 64 = 85,162,752 multiplication operations
output size: filter size number of filters
input size - filter size
Pointwise Convolution
(224-3+1)2 x (1x1x3) x 64 = 9,462,528
Total: 10,793,196 multiplication operations
In MobileNet paper, they found that ReLU6 is more robust than regular ReLU when
using low-precision computation such as mobile devices.
174
Source: https://machinethink.net/blog/mobilenet-v2/
Transfer Learning
ImageNet dataset contains the 1000 categories and 1.2 million images.
176
Source: https://gluon-cv.mxnet.io/build/examples_datasets/imagenet.html
Case: Tiny Dataset
For example, less than 500 labels
for each class.
Train these
classification layers on
177
your dataset.
Case: Small Dataset
For example, 500-1,000 labels for
each class.
179
Workshop 16: MobileNet
Workshop 17: TensorFlow.js