SlideShare a Scribd company logo
Day 3  take up convolutional neural network
Day 3  take up convolutional neural network
Day 3  take up convolutional neural network
Day 3  take up convolutional neural network
Day 3  take up convolutional neural network
Day 3  take up convolutional neural network
ICEBREAKER
Phạm Nguyễn Anh Thư
@thu.phamhcmut
Let’s get to know each other!
Record shop
_____ ___ ____
Thật bất ngờ
___ ____ ____
Em dạo này
Tình đắng như ly cà phê
____ _____ ____ _ __ ____
___ ___ ___ ___ ___ ______
Để Mị nói cho mà nghe
____ ____ ____ ___ __ ____ ____
Đâu cần một bài ca tình yêu
how-to-AI Series: Unlock Potential
Day 3: Take UP Convolutional
Neural Network
Nguyễn Luật Gia Khôi
@giakhoi.nguyenluat
Nguyễn Thế Bình
@binh.nguyen288
Outline
1. Break the ice
2. Convolutional Neural Network
3. Why using CNN instead of NN?
4. Demo code
5. Kaggle Challenge
Convolutional
Neural Network
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 -1 -1 1 1
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 -1 -1 1 1
● -1: black
● 1: white
Matrix representation
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 -1 -1 1 1
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 -1 -1 1 1
-1 -1 -1 1 1
-1 1 -1 1 1
-1 -1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 -1 1 1 1
-1 1 1 1 1
-1 -1 -1 1 1
-1 1 -1 1 1
-1 -1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 -1 1 1 1
-1 1 1 1 1
1 1 -1 1 1
1 -1 1 -1 1
1 -1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 -1 1 -1 1
1 -1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
1 1 -1 1 1
ANN can solve this variety in digits
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 -1 -1 1 1
1
-1
-1
-1
1
1
-1
...
1
-1
1
1
-1
-1
1
1
x2
x33
x32
x3
x4
x34
x1
x35
...
h2
x33
x32
h3
h4
x34
h1
x35
...
h2
h8
h3
h9
h1
h10
...
1
9
8
2
3
0
0.01
0.92
0.003
0.008
0.015
0.02
WAIT A SECOND, how about this?
Image size = 1920 x 1080 x 3
Input layer #neurons = 1920 x 1080 x 3 = 6 million
Hidden layer #neurons = Say you keep it = 4 million
Weights between input and first hidden layer =
6 * 4 = 24 trillion parameters
Day 3  take up convolutional neural network
Disadvantages of ANN in image classification
- Computationally expensive.
- Treat local pixels same as pixels far apart => no locality concern
- Sensitive to location of the object in the image.
How does human recognize
images?
Eyes
Nose
Ears
Hand
Leg
Head
Body
Koala
Nine
Curves
Long curve
Circular pattern
How can we make computers
recognize these patterns?
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 -1 1 1
1 -1 1 1 1
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 -1 1 1
1 -1 1 1 1
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 -1 1 1
1 -1 1 1 1
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 -1 1 1
1 -1 1 1 1
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 -1 1 1
1 -1 1 1 1
Circular pattern
filter
Diagonal line
filter
Diagonal line
filter
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 -1 1 1
1 -1 1 1 1
-1 -1 -1
-1 1 -1
-1 -1 -1
* =
-1 9 -1
-5 1 -3
-3 3 -3
-5 -1 -5
-3 -5 -3
Circular pattern
filter
-1 x -1 + -1 x -1 + … + -1 x -1 + 1 x 1 = 9
x
-1 -1 -1
-1 1 -1
-1 -1 -1
*
Circular pattern
filter
=
x
-1 -1 -1
-1 1 -1
-1 -1 -1
*
Circular pattern
filter
=
x
x
-1 -1 -1
-1 1 -1
-1 -1 -1
*
Circular pattern
filter
=
x x
*
Eye
filter
= *
Eye
filter
=
*
Eye
filter
=
x x
x x
x x
*
Eye filter
=
x
*
Nose filter
=
x
x
*
Ear filter
=
*
Head filter
x
=
x x
x
x
X
...
X
...
h2
x8
h3
x9
h1
x10
...
0.01 (Giraffe)
0.80 (Koala)
0.003 (Horse)
0.008 (Buffalo)
0.15 (Bear)
0.02 (Squirrel)
Flatten
Feature extraction Classification
1 -1 -1 -1 1
1 -1 1 -1 1
1 -1 -1 -1 1
1 1 1 -1 1
1 1 1 -1 1
1 1 -1 1 1
1 -1 1 1 1
-1 -1 -1
-1 1 -1
-1 -1 -1
* =
-1 9 -1
-5 1 -3
-3 3 -3
-5 -1 -5
-3 -5 -3
Circular pattern
filter
ReLU
0 9 0
0 1 0
0 3 0
0 0 0
0 0 0
Stride & Padding
stride = 2,
padding = “valid”
stride = 1,
padding = “same”
input
output
input output
Day 3  take up convolutional neural network
0 9 0 0
0 1 0 0
0 3 0 0
0 0 0 0
0 0 0 0
Max pooling
pool_size = (2,2)
stride = 2
9 0
3 0
output_shape = math.floor((input_shape - pool_size) / strides) + 1
Benefits of max pooling
- Reduce feature map size => Reduce computational cost.
- Fewer parameters needed => Reduce overfitting.
- Make model tolerant towards variations and distortions.
Complete pipeline
Conv + ReLU Pooling Conv + ReLU Pooling
w1 x h1x c1 w2 x h2 x c1 w2 x h2 x c2 w3 x h3 x c2
Flatten
Why using CNN instead of NN?
- Can capture spatial features => Connection sparsity => Reduce overfitting
x x
*
Eye filter
=
x
*
Nose filter
=
x
x
*
Ear filter
=
0 0 9 0
0 1 0 0
0 3 0 0
0 0 0 0
0 0 0 0
- Translation invariant.
1 9
3 0
0 0 0 0
0 0 9 0
0 3 0 0
0 0 0 0
0 0 0 0
0 9
3 0
Conv
Conv
Pooling
Pooling
- Location invariant feature detection.
- Parameter sharing.
KAHOOT TIME
DEMO CODE
GDSC AI CHALLENGE
● Challenge: Build a model that can automatically classifies images to their
correct labels.
● Registration form is now open!
● Timeline: 12/12/2021 - 30/12/2021
● Rewards:
○ First prize: 1.000.000 VND
○ Second prize: 700.000 VND
○ Third prize: 500.000 VND
○ 2 AI potential prizes: 400.000 VND
GDSC AI CHALLENGE
Q&A
Feedback form
https://tinyurl.com/37kk6dkw
Thank You!

More Related Content

PDF
Oracle中Sql解析过程
PDF
Free test practice ccat
PPT
DOCX
วรรณคดีอันทรงคุณค่า
PDF
Yesterday
PDF
Deep Learning - STM 6
PPTX
Optimization techniques in formulation Development- Plackett Burmann Design a...
PPTX
Deep Learning con CNTK by Pablo Doval
Oracle中Sql解析过程
Free test practice ccat
วรรณคดีอันทรงคุณค่า
Yesterday
Deep Learning - STM 6
Optimization techniques in formulation Development- Plackett Burmann Design a...
Deep Learning con CNTK by Pablo Doval

Similar to Day 3 take up convolutional neural network (20)

PPTX
DL_Lecture_29_06_2020.pptx
PDF
convolutional neural networks for machine learning
PPTX
How the convolutional neural network works behind the hood.
PPTX
Machine learning algorithms like CNN and LSTM
PDF
Lecture 4: How it Works: Convolutional Neural Networks
PDF
Lecture_15_General _Schmidt _factor_.pdf
PDF
Digital Image Processing
PDF
how CNN works for tech Every parts introductions.pdf
PDF
PDF
CNN Basics.pdf
PPTX
Convolutional Neural Networks
PPTX
Desing of Factorial Experiments
PPTX
Estado del Arte de la IA
PDF
DeepLearning with Neon
PDF
How to caculus
PDF
Your Town
PDF
Dia 2 elaboramos el plan de alimentación para los cuyes.
PDF
PPTX
Deep-Learning-2017-Lecture5CNN.pptx
PPTX
Deep-LearningwithVisualExamplesExplaine.pptx
DL_Lecture_29_06_2020.pptx
convolutional neural networks for machine learning
How the convolutional neural network works behind the hood.
Machine learning algorithms like CNN and LSTM
Lecture 4: How it Works: Convolutional Neural Networks
Lecture_15_General _Schmidt _factor_.pdf
Digital Image Processing
how CNN works for tech Every parts introductions.pdf
CNN Basics.pdf
Convolutional Neural Networks
Desing of Factorial Experiments
Estado del Arte de la IA
DeepLearning with Neon
How to caculus
Your Town
Dia 2 elaboramos el plan de alimentación para los cuyes.
Deep-Learning-2017-Lecture5CNN.pptx
Deep-LearningwithVisualExamplesExplaine.pptx
Ad

More from HuyPhmNht2 (7)

PPTX
Slide.pptx
PDF
Introduction to figma
PDF
Info seminar 2021
PDF
Day 5
PDF
Day 4
PDF
Day 2 build up your own neural network
PDF
Day 1 wazz up ai
Slide.pptx
Introduction to figma
Info seminar 2021
Day 5
Day 4
Day 2 build up your own neural network
Day 1 wazz up ai
Ad

Recently uploaded (20)

PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Geodesy 1.pptx...............................................
PDF
Well-logging-methods_new................
PPT
Project quality management in manufacturing
PDF
PPT on Performance Review to get promotions
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Construction Project Organization Group 2.pptx
PPTX
UNIT 4 Total Quality Management .pptx
DOCX
573137875-Attendance-Management-System-original
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Sustainable Sites - Green Building Construction
Automation-in-Manufacturing-Chapter-Introduction.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Geodesy 1.pptx...............................................
Well-logging-methods_new................
Project quality management in manufacturing
PPT on Performance Review to get promotions
CH1 Production IntroductoryConcepts.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Construction Project Organization Group 2.pptx
UNIT 4 Total Quality Management .pptx
573137875-Attendance-Management-System-original
R24 SURVEYING LAB MANUAL for civil enggi
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Sustainable Sites - Green Building Construction

Day 3 take up convolutional neural network

  • 7. ICEBREAKER Phạm Nguyễn Anh Thư @thu.phamhcmut Let’s get to know each other!
  • 8. Record shop _____ ___ ____ Thật bất ngờ ___ ____ ____ Em dạo này Tình đắng như ly cà phê ____ _____ ____ _ __ ____ ___ ___ ___ ___ ___ ______ Để Mị nói cho mà nghe ____ ____ ____ ___ __ ____ ____ Đâu cần một bài ca tình yêu
  • 9. how-to-AI Series: Unlock Potential Day 3: Take UP Convolutional Neural Network Nguyễn Luật Gia Khôi @giakhoi.nguyenluat Nguyễn Thế Bình @binh.nguyen288
  • 10. Outline 1. Break the ice 2. Convolutional Neural Network 3. Why using CNN instead of NN? 4. Demo code 5. Kaggle Challenge
  • 12. 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 -1 -1 1 1 ● -1: black ● 1: white Matrix representation
  • 13. 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 ANN can solve this variety in digits
  • 14. 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 1 -1 ... 1 -1 1 1 -1 -1 1 1 x2 x33 x32 x3 x4 x34 x1 x35 ... h2 x33 x32 h3 h4 x34 h1 x35 ... h2 h8 h3 h9 h1 h10 ... 1 9 8 2 3 0 0.01 0.92 0.003 0.008 0.015 0.02
  • 15. WAIT A SECOND, how about this?
  • 16. Image size = 1920 x 1080 x 3 Input layer #neurons = 1920 x 1080 x 3 = 6 million Hidden layer #neurons = Say you keep it = 4 million Weights between input and first hidden layer = 6 * 4 = 24 trillion parameters
  • 18. Disadvantages of ANN in image classification - Computationally expensive. - Treat local pixels same as pixels far apart => no locality concern - Sensitive to location of the object in the image.
  • 19. How does human recognize images?
  • 22. How can we make computers recognize these patterns?
  • 23. 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 Circular pattern filter Diagonal line filter Diagonal line filter
  • 24. 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 * = -1 9 -1 -5 1 -3 -3 3 -3 -5 -1 -5 -3 -5 -3 Circular pattern filter -1 x -1 + -1 x -1 + … + -1 x -1 + 1 x 1 = 9
  • 25. x -1 -1 -1 -1 1 -1 -1 -1 -1 * Circular pattern filter = x -1 -1 -1 -1 1 -1 -1 -1 -1 * Circular pattern filter = x x -1 -1 -1 -1 1 -1 -1 -1 -1 * Circular pattern filter =
  • 27. x x * Eye filter = x * Nose filter = x x * Ear filter = * Head filter x = x x
  • 28. x x X ... X ... h2 x8 h3 x9 h1 x10 ... 0.01 (Giraffe) 0.80 (Koala) 0.003 (Horse) 0.008 (Buffalo) 0.15 (Bear) 0.02 (Squirrel)
  • 30. 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 * = -1 9 -1 -5 1 -3 -3 3 -3 -5 -1 -5 -3 -5 -3 Circular pattern filter ReLU 0 9 0 0 1 0 0 3 0 0 0 0 0 0 0
  • 31. Stride & Padding stride = 2, padding = “valid” stride = 1, padding = “same” input output input output
  • 33. 0 9 0 0 0 1 0 0 0 3 0 0 0 0 0 0 0 0 0 0 Max pooling pool_size = (2,2) stride = 2 9 0 3 0 output_shape = math.floor((input_shape - pool_size) / strides) + 1
  • 34. Benefits of max pooling - Reduce feature map size => Reduce computational cost. - Fewer parameters needed => Reduce overfitting. - Make model tolerant towards variations and distortions.
  • 35. Complete pipeline Conv + ReLU Pooling Conv + ReLU Pooling w1 x h1x c1 w2 x h2 x c1 w2 x h2 x c2 w3 x h3 x c2 Flatten
  • 36. Why using CNN instead of NN?
  • 37. - Can capture spatial features => Connection sparsity => Reduce overfitting x x * Eye filter = x * Nose filter = x x * Ear filter =
  • 38. 0 0 9 0 0 1 0 0 0 3 0 0 0 0 0 0 0 0 0 0 - Translation invariant. 1 9 3 0 0 0 0 0 0 0 9 0 0 3 0 0 0 0 0 0 0 0 0 0 0 9 3 0 Conv Conv Pooling Pooling
  • 39. - Location invariant feature detection.
  • 44. ● Challenge: Build a model that can automatically classifies images to their correct labels. ● Registration form is now open! ● Timeline: 12/12/2021 - 30/12/2021 ● Rewards: ○ First prize: 1.000.000 VND ○ Second prize: 700.000 VND ○ Third prize: 500.000 VND ○ 2 AI potential prizes: 400.000 VND GDSC AI CHALLENGE
  • 45. Q&A