SlideShare a Scribd company logo
UI Case Study + Intro to CNN
By Vincent Tatan
Google Data Analyst (Machine Learning)
Wait, who am I?
Meet Vincent
Data Analyst (Machine Learning)
Trust & Safety Google
Medium : towardsdatascience.com/@vincentkernn
Linkedin : linkedin.com/in/vincenttatan/
Data Podcast: https://datacast.simplecast.com/
Disclaimer
This disclaimer informs readers that the views, thoughts, and opinions
expressed in the text belong solely to the author, and not necessarily to the
author’s employer, organization, committee or other group or individual.
This article was made purely as the author’s initiatives and in no way driven by
any other hidden agenda.
Google:
Trust and Safety To prevent phishing @
scale with Data Analytics
and ML
Google
Data Analyst, Machine Learning
Aug 19 - Present
Phishing Samples
Phishing Samples
UI Case Study
Case study (CSV, Practice_Colab)
Case study (Colab, Article)
Intro to CNN
Understanding CNN
Medium Articles
https://towardsdatascience.com/understanding-cnn-convolutional-neural-network-69fd626ee7d4
Colab Demonstration
Cat v.s. Dog using CNN
https://colab.research.google.com/drive/1OFWBxvT9cnyJpcTcGCPEqYIq_u0Yt90b?authuser=1#scrollTo=tRVDMlsknGDU
Proprietary + Confidential
Today’s Agenda
1
2
3
4
5
Machine Learning in Image Recognition
Principles behind CNN: Convolution, ReLU, Max Pooling
CNN stacks + Fully Connected Layer
Avoiding Overfitting (Dropout and Image Augmentation)
Transfer Learning
1
Machine Learning in Image
Recognition
Classify objects in images
1
Image Recognition is hard -- Are all of these cats?
My search for the word “cat”.
Warning -- Not all of these are cats.
We need an automatic way to determine critical features to identify cats or other objects.
Black color
Sharp ears
We need a way to determine the features scalably
2 Principles behind CNN
Convolution, ReLU, Max Pooling
Introducing Convolutional Neural Network (CNN)
Type of neural network comprising of different layers of convolutions
and max pooling mainly for image recognition
1. Convolution
2. ReLU Activation
3. Max Pooling
Intuition of Convolutional Neural Network
What do you see?
Young lady or old grandma or both?
Intuition of Convolutional Neural Network
Psychologist Edwin Boring
introduced the painting of “My Wife
and My Mother-in-Law” where the
figure seems to morph from young
lady to old woman, to the public in
1930. (Source)
These boxes determined the features of the object that you would classify.
● The curve that changed into (ears/eyes)
● The straight line that changed into (choker/mouth)
Intuition of Convolutional Neural Network
This means you are relying on
● Data (strokes of the painting)
● Prior knowledge (your scrolling habits/understanding of faces)
To identify Features
Intuition of Convolutional Neural Network
CNN distinguishes meaningful features from a sequence of
pixels rather than pixel per pixel to classify the image
1 1 1 1
0 0 1 1
0 1 0 1
1 1 1 1
0 0 0 0
1 1 1 1
1 1 1 1
0 0 0 0
What is convolution exactly? Colab
-1 -2 -1
0 0 0
1 2 1
Principle of CNN: Convolution (1-D)
Which order of the element where I see there is a change from 1 to 0?
[1,1,1,1,0,0]
Hint: answer is [0,0,0,1,0]
Principle of CNN: Convolution (1-D)
Which order of the element where I see 1 becomes -1?
1 -1
1 1 1 1 0 0
1st element : 1*1 + 1*-1 = 0
2nd element : 1*1 + 1*-1 = 0
3rd element : 1*1 + 1*-1 = 0
4th element : 1*1 + 0*-1 = 1
5th element : 0*1 + 0*-1 = 0
End Result: 0 0 0 1 0
Principle of CNN: Convolution (2-D)
Same principle also applies to 2-D where you derive the feature map using the kernels (acts as
weights in NN). With this kernel you can find diagonal patterns
>
Data Prior
Knowledge
Feature map
Principle of CNN: Convolution (2-D), 3 stacks
Feature Maps
Principle of CNN: Activation Function ReLU
The ReLU function introduces non linearity to activate on a “big enough” stimulus (sparse
activation). This method has been effective to solve vanishing gradients due to its constant 1 for
weight more than 1. Weights that are very small will remain as 0 after the ReLU activation
function.
Principle of CNN: Maxpooling(2-D)
CNN uses max pooling to replace output with a max summary to reduce data size and
processing time. This allows you to determine features that produce the highest impact
and reduces the risk of overfitting.
Recap
Understanding CNN
1. Convolution
2. ReLU Activation Function
3. Maxpooling
3
CNN Stacks + Fully Connected
Layer
Generating Real Results
CNN Stacks + Fully Connected Layer(2-D)
Take the Feature maps from CNN as the inputs and insert it into NN models which will calculate the
probabilities of the image to the labels assigned.
Finally, we will serve the convolutional and max pooling feature map outputs with Fully Connected Layer
(FCL). We flatten the feature outputs to column vector and feed-forward it to FCL. Every node in the previous
layer is connected to the last layer and represents which distinct label to output. FCL represents Artificial
Neural Network and has the final layer as MultiLayer Perceptron (MLP)
CNN Stacks: Cats vs Dogs
The discovery of curves
Fully Connected Layer Activation: Softmax
softmax activation function squashes the probability scores to add up to 1.0.
CNN Big Picture: Cats vs Dogs
The sensors of the neural
network might start by
understanding what edges
and colors it is looking at.
The last layer, called the fully
connected layer,
summarizes this analysis and
gives the probability of
whether it is looking at a dog.
A third layer is trying to
conceptualize what these
shapes represent (for
instance, is it an animal or
something else?).
Another layer is trying to
understand what shapes it is
looking at.
Using Tensorflow + Keras
Create and Compile our CNN
Change to
‘categorical_crossentropy’ for
softmax
CNN Stacks (conv base)
Fully Connected Layer (top or
head)
Train our CNN
Results: Cats vs Dogs
Results: Cats vs Dogs
Overfitting!
loss: 0.0134
acc: 0.9965
val_loss: 3.5137
val_acc: 0.7290
Important Resources (Teachable Machine)
https://teachablemachine.withgoogle.com/train/image
Colab Demonstration
Cat v.s. Dog using CNN
https://colab.research.google.com/drive/1OFWBxvT9cnyJpcTcGCPEqYIq_u0Yt90b?authuser=1#scrollTo=tRVDMlsknGDU
4 Avoiding Overfitting
Improve Generalization with Dropout and Image
Augmentation
Overfitting Mistakes: CNN
Common Mistakes Solutions
Using test set as the validation set to test the
model
Use validation sets as validation tests and test
models as final tests
Dataset is relatively small
Image augmentations to add new variants of
images
Over Memorization
Dropout/ reduce epochs/layers/neurons per layer
to increase generalizations
Overfitting Solutions: Data Augmentation
In the case of small training data set, you need to artificially boost the diversity and number of training examples.
One way of doing this is to add image augmentations and creating new variants. These include translating
images and creating dimension changes such as zoom, crop, flips, etc.
Overfitting Solutions: Data Augmentation
Overfitting Solutions: Dropout
You could also use regularization techniques such as Dropout to remove activation unit in every gradient step training.
Each epoch training deactivates different neurons.
Since the number of gradient steps is usually high, all neurons will averagely have same occurrences for dropout.
Intuitively, the more you drop out, the less likely your model memorizes.
Overfitting Solutions: Dropout
Overfitting Solutions: Dropout
Results: Cats vs Dogs
Much better
loss: 0.5622
acc: 0.7145
val_loss: 0.5090
val_acc: 0.7650
Results: Cats vs Dogs
Overfitting CNN
CNN with Dropout and Image
Augmentation
loss: 0.5622
acc: 0.7145
val_loss: 0.5090
val_acc: 0.7650
loss: 0.0134
acc: 0.9965
val_loss: 3.5137
val_acc: 0.7290
1 Transfer Learning
Leverage PreTrained Model by Experts
5
Transfer Learning: ImageNet
Transfer learning is a technique that reuses an existing model to the current model. You could produce on top of existing models that were
carefully designed by experts and trained with millions of pictures. You can freeze the model, then only apply the training for the high level
layers.
Transfer Learning
CNN Stacks
Fully Connected Layer
CNN Stacks
Fully Connected Layer
Importing Conv_base (VGG16)?
Trainable params Huge!
Freezing Conv_base (VGG16)?
Better!
Results: Cats vs Dogs
CNN with Dropout and Image Augmentation
loss: 0.5622
acc: 0.7145
val_loss: 0.5090
val_acc: 0.7650
Transfer Learning (VGG16)
Colab Demonstration
Cat v.s. Dog using CNN
https://colab.research.google.com/drive/1OFWBxvT9cnyJpcTcGCPEqYIq_u0Yt90b?authuser=1#scrollTo=tRVDMlsknGDU
Proprietary + Confidential
What’s Next: Explainable ML
Proprietary + Confidential
What’s Next: Deep Dream
Proprietary + Confidential
Today’s Agenda
1
2
3
4
5
Machine Learning in Image Recognition
Principles behind CNN: Convolution, ReLU, Max Pooling
CNN stacks + Fully Connected Layer
Avoiding Overfitting (Dropout and Image Augmentation)
Transfer Learning
Proprietary + Confidential
Today’s Summary
Machine Learning in Image Recognition
Principles behind CNN: Convolution, ReLU, Max Pooling
CNN stacks + Fully Connected Layer
Transfer Learning
Avoiding Overfitting + Transfer Learning
04/
05
● Data Augmentation: artificially boost diversity and number of training examples
● Dropout: Regularization Techniques to remove activation unit in every gradient
step training. Each epoch training deactivates different neurons.
● Transfer learning is a technique that reuses an existing model to the current
model. You could produce on top of existing models that were carefully designed
by experts and trained with millions of pictures.
CNN Stacks +Fully Connected Layer
03
● Fully Connected Layer: Take the Feature maps from CNN as the inputs and insert
it into NN models which will calculate the probabilities of the image to the labels
assigned.
● Softmax activation function which assign decimal probabilities for each possible
label which add up to 1.0.
Principles behind CNN: Convolution, ReLU,
and Max Pooling
02
● Convolution: Same principle also applies to 2-D where you derive from the
feature map using the kernels (acts as weights in NN).
● The ReLU function introduces non linearity to activate on a “big enough” stimulus
(sparse activation).
● Max pooling to replace output with a max summary to reduce data size and
processing time.
Machine Learning in Image Recognition
01
● Classical Image Recognition Allows you to extract features and derive
characteristics.
● Convolution Neural Network (CNN) Deep learning techniques using convolutions,
max pooling to share weights, produce critical features, and classify labels.
Commonly used in image classifications
Reach out to me :)
Medium : towardsdatascience.com/@vincentkernn
Linkedin : linkedin.com/in/vincenttatan/
Survey: tiny.cc/vincent-survey

More Related Content

PPTX
Introduction to ml ops in daily apps
PPTX
[Revised] Intro to CNN
PPTX
Dssg talk CNN intro
PDF
Variants of GANs - Jaejun Yoo
PPTX
Introduction to Machine Learning
PDF
Machine learning for_finance
PPTX
Introduction to deep learning workshop
PPTX
Machine learning and vulnerabilities
Introduction to ml ops in daily apps
[Revised] Intro to CNN
Dssg talk CNN intro
Variants of GANs - Jaejun Yoo
Introduction to Machine Learning
Machine learning for_finance
Introduction to deep learning workshop
Machine learning and vulnerabilities

What's hot (20)

PPTX
Diving into Deep Learning (Silicon Valley Code Camp 2017)
PDF
Data Science - Part IX - Support Vector Machine
PPTX
sentiment analysis using support vector machine
PDF
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...
PDF
Deeplearning in finance
PDF
Matrix Factorization In Recommender Systems
PPTX
Ai in 45 minutes
PDF
Rsqrd AI - ML Interpretability: Beyond Feature Importance
PPTX
Mnist report ppt
PDF
MNIST and machine learning - presentation
PDF
Machine Learning for Everyone
PDF
VSSML16 LR2. Summary Day 2
PPTX
Machine Learning Essentials Demystified part1 | Big Data Demystified
PDF
VSSML16 L3. Clusters and Anomaly Detection
PDF
Semi-Supervised Insight Generation from Petabyte Scale Text Data
PDF
Deep learning (Machine learning) tutorial for beginners
PPTX
Introduction to ml
PPTX
MachineLlearning introduction
PDF
Synthetic Gradients - Decoupling Layers of a Neural Nets
PDF
Deep Learning Demystified
Diving into Deep Learning (Silicon Valley Code Camp 2017)
Data Science - Part IX - Support Vector Machine
sentiment analysis using support vector machine
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...
Deeplearning in finance
Matrix Factorization In Recommender Systems
Ai in 45 minutes
Rsqrd AI - ML Interpretability: Beyond Feature Importance
Mnist report ppt
MNIST and machine learning - presentation
Machine Learning for Everyone
VSSML16 LR2. Summary Day 2
Machine Learning Essentials Demystified part1 | Big Data Demystified
VSSML16 L3. Clusters and Anomaly Detection
Semi-Supervised Insight Generation from Petabyte Scale Text Data
Deep learning (Machine learning) tutorial for beginners
Introduction to ml
MachineLlearning introduction
Synthetic Gradients - Decoupling Layers of a Neural Nets
Deep Learning Demystified
Ad

Similar to Classification case study + intro to cnn (20)

PDF
cnn.pdf
PPTX
build a Convolutional Neural Network (CNN) using TensorFlow in Python
PPTX
intro-to-cnn-April_2020.pptx
PDF
dfdshofdifhdifhdfhgfoighfgofgfgfgfgdfdfdfdf
PDF
DL.pdf
PPTX
Convolutional Neural Network and Its Applications
PPTX
PyConZA'17 Deep Learning for Computer Vision
PPTX
cnn ppt.pptx
PDF
Convolutional Neural Networks (CNN)
PPTX
Illustrative Introductory CNN
PPTX
Convolutional neural network
PPTX
Deep learning L1-CO2-session-4 CNN .pptx
PDF
Classification of Images Using CNN Model and its Variants
PPTX
A Neural Network that Understands Handwriting
PPTX
introduction Convolutional Neural Networks.pptx
PDF
Faire de la reconnaissance d'images avec le Deep Learning - Cristina & Pierre...
PPTX
Image classification using cnn
PDF
Convolutional neural network complete guide
PPTX
Basic Introduction to Convolutional Neural Network.pptx
cnn.pdf
build a Convolutional Neural Network (CNN) using TensorFlow in Python
intro-to-cnn-April_2020.pptx
dfdshofdifhdifhdfhgfoighfgofgfgfgfgdfdfdfdf
DL.pdf
Convolutional Neural Network and Its Applications
PyConZA'17 Deep Learning for Computer Vision
cnn ppt.pptx
Convolutional Neural Networks (CNN)
Illustrative Introductory CNN
Convolutional neural network
Deep learning L1-CO2-session-4 CNN .pptx
Classification of Images Using CNN Model and its Variants
A Neural Network that Understands Handwriting
introduction Convolutional Neural Networks.pptx
Faire de la reconnaissance d'images avec le Deep Learning - Cristina & Pierre...
Image classification using cnn
Convolutional neural network complete guide
Basic Introduction to Convolutional Neural Network.pptx
Ad

More from Vincent Tatan (7)

PPTX
Life of a ML Engineer [Redacted].pptx
PPTX
[Master] unboxing design docs for data scientists
PPTX
Listen, check, and pay
PPTX
Intro to ml lesson vincent
PPTX
Overcoming Imposter Syndrome
PPTX
SAS Slides FINALE (2)
PDF
Doc 14 Jan 2016%2c 1014-rotated (1)
Life of a ML Engineer [Redacted].pptx
[Master] unboxing design docs for data scientists
Listen, check, and pay
Intro to ml lesson vincent
Overcoming Imposter Syndrome
SAS Slides FINALE (2)
Doc 14 Jan 2016%2c 1014-rotated (1)

Recently uploaded (20)

PDF
[EN] Industrial Machine Downtime Prediction
PDF
Lecture1 pattern recognition............
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
PPTX
Database Infoormation System (DBIS).pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
Managing Community Partner Relationships
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
modul_python (1).pptx for professional and student
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
Computer network topology notes for revision
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
STERILIZATION AND DISINFECTION-1.ppthhhbx
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
[EN] Industrial Machine Downtime Prediction
Lecture1 pattern recognition............
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
Database Infoormation System (DBIS).pptx
Supervised vs unsupervised machine learning algorithms
oil_refinery_comprehensive_20250804084928 (1).pptx
Data_Analytics_and_PowerBI_Presentation.pptx
Managing Community Partner Relationships
Reliability_Chapter_ presentation 1221.5784
modul_python (1).pptx for professional and student
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Computer network topology notes for revision
IB Computer Science - Internal Assessment.pptx
Acceptance and paychological effects of mandatory extra coach I classes.pptx
.pdf is not working space design for the following data for the following dat...
climate analysis of Dhaka ,Banglades.pptx
STERILIZATION AND DISINFECTION-1.ppthhhbx
MODULE 8 - DISASTER risk PREPAREDNESS.pptx

Classification case study + intro to cnn

  • 1. UI Case Study + Intro to CNN By Vincent Tatan Google Data Analyst (Machine Learning)
  • 3. Meet Vincent Data Analyst (Machine Learning) Trust & Safety Google Medium : towardsdatascience.com/@vincentkernn Linkedin : linkedin.com/in/vincenttatan/ Data Podcast: https://datacast.simplecast.com/
  • 4. Disclaimer This disclaimer informs readers that the views, thoughts, and opinions expressed in the text belong solely to the author, and not necessarily to the author’s employer, organization, committee or other group or individual. This article was made purely as the author’s initiatives and in no way driven by any other hidden agenda.
  • 5. Google: Trust and Safety To prevent phishing @ scale with Data Analytics and ML Google Data Analyst, Machine Learning Aug 19 - Present
  • 9. Case study (CSV, Practice_Colab)
  • 10. Case study (Colab, Article)
  • 13. Colab Demonstration Cat v.s. Dog using CNN https://colab.research.google.com/drive/1OFWBxvT9cnyJpcTcGCPEqYIq_u0Yt90b?authuser=1#scrollTo=tRVDMlsknGDU
  • 14. Proprietary + Confidential Today’s Agenda 1 2 3 4 5 Machine Learning in Image Recognition Principles behind CNN: Convolution, ReLU, Max Pooling CNN stacks + Fully Connected Layer Avoiding Overfitting (Dropout and Image Augmentation) Transfer Learning
  • 15. 1 Machine Learning in Image Recognition Classify objects in images 1
  • 16. Image Recognition is hard -- Are all of these cats? My search for the word “cat”.
  • 17. Warning -- Not all of these are cats. We need an automatic way to determine critical features to identify cats or other objects. Black color Sharp ears
  • 18. We need a way to determine the features scalably
  • 19. 2 Principles behind CNN Convolution, ReLU, Max Pooling
  • 20. Introducing Convolutional Neural Network (CNN) Type of neural network comprising of different layers of convolutions and max pooling mainly for image recognition 1. Convolution 2. ReLU Activation 3. Max Pooling
  • 21. Intuition of Convolutional Neural Network What do you see? Young lady or old grandma or both?
  • 22. Intuition of Convolutional Neural Network Psychologist Edwin Boring introduced the painting of “My Wife and My Mother-in-Law” where the figure seems to morph from young lady to old woman, to the public in 1930. (Source) These boxes determined the features of the object that you would classify. ● The curve that changed into (ears/eyes) ● The straight line that changed into (choker/mouth)
  • 23. Intuition of Convolutional Neural Network This means you are relying on ● Data (strokes of the painting) ● Prior knowledge (your scrolling habits/understanding of faces) To identify Features
  • 24. Intuition of Convolutional Neural Network CNN distinguishes meaningful features from a sequence of pixels rather than pixel per pixel to classify the image 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0
  • 25. What is convolution exactly? Colab -1 -2 -1 0 0 0 1 2 1
  • 26. Principle of CNN: Convolution (1-D) Which order of the element where I see there is a change from 1 to 0? [1,1,1,1,0,0] Hint: answer is [0,0,0,1,0]
  • 27. Principle of CNN: Convolution (1-D) Which order of the element where I see 1 becomes -1? 1 -1 1 1 1 1 0 0 1st element : 1*1 + 1*-1 = 0 2nd element : 1*1 + 1*-1 = 0 3rd element : 1*1 + 1*-1 = 0 4th element : 1*1 + 0*-1 = 1 5th element : 0*1 + 0*-1 = 0 End Result: 0 0 0 1 0
  • 28. Principle of CNN: Convolution (2-D) Same principle also applies to 2-D where you derive the feature map using the kernels (acts as weights in NN). With this kernel you can find diagonal patterns > Data Prior Knowledge Feature map
  • 29. Principle of CNN: Convolution (2-D), 3 stacks Feature Maps
  • 30. Principle of CNN: Activation Function ReLU The ReLU function introduces non linearity to activate on a “big enough” stimulus (sparse activation). This method has been effective to solve vanishing gradients due to its constant 1 for weight more than 1. Weights that are very small will remain as 0 after the ReLU activation function.
  • 31. Principle of CNN: Maxpooling(2-D) CNN uses max pooling to replace output with a max summary to reduce data size and processing time. This allows you to determine features that produce the highest impact and reduces the risk of overfitting.
  • 32. Recap Understanding CNN 1. Convolution 2. ReLU Activation Function 3. Maxpooling
  • 33. 3 CNN Stacks + Fully Connected Layer Generating Real Results
  • 34. CNN Stacks + Fully Connected Layer(2-D) Take the Feature maps from CNN as the inputs and insert it into NN models which will calculate the probabilities of the image to the labels assigned. Finally, we will serve the convolutional and max pooling feature map outputs with Fully Connected Layer (FCL). We flatten the feature outputs to column vector and feed-forward it to FCL. Every node in the previous layer is connected to the last layer and represents which distinct label to output. FCL represents Artificial Neural Network and has the final layer as MultiLayer Perceptron (MLP)
  • 35. CNN Stacks: Cats vs Dogs The discovery of curves
  • 36. Fully Connected Layer Activation: Softmax softmax activation function squashes the probability scores to add up to 1.0.
  • 37. CNN Big Picture: Cats vs Dogs The sensors of the neural network might start by understanding what edges and colors it is looking at. The last layer, called the fully connected layer, summarizes this analysis and gives the probability of whether it is looking at a dog. A third layer is trying to conceptualize what these shapes represent (for instance, is it an animal or something else?). Another layer is trying to understand what shapes it is looking at.
  • 39. Create and Compile our CNN Change to ‘categorical_crossentropy’ for softmax CNN Stacks (conv base) Fully Connected Layer (top or head)
  • 42. Results: Cats vs Dogs Overfitting! loss: 0.0134 acc: 0.9965 val_loss: 3.5137 val_acc: 0.7290
  • 43. Important Resources (Teachable Machine) https://teachablemachine.withgoogle.com/train/image
  • 44. Colab Demonstration Cat v.s. Dog using CNN https://colab.research.google.com/drive/1OFWBxvT9cnyJpcTcGCPEqYIq_u0Yt90b?authuser=1#scrollTo=tRVDMlsknGDU
  • 45. 4 Avoiding Overfitting Improve Generalization with Dropout and Image Augmentation
  • 46. Overfitting Mistakes: CNN Common Mistakes Solutions Using test set as the validation set to test the model Use validation sets as validation tests and test models as final tests Dataset is relatively small Image augmentations to add new variants of images Over Memorization Dropout/ reduce epochs/layers/neurons per layer to increase generalizations
  • 47. Overfitting Solutions: Data Augmentation In the case of small training data set, you need to artificially boost the diversity and number of training examples. One way of doing this is to add image augmentations and creating new variants. These include translating images and creating dimension changes such as zoom, crop, flips, etc.
  • 49. Overfitting Solutions: Dropout You could also use regularization techniques such as Dropout to remove activation unit in every gradient step training. Each epoch training deactivates different neurons. Since the number of gradient steps is usually high, all neurons will averagely have same occurrences for dropout. Intuitively, the more you drop out, the less likely your model memorizes.
  • 52. Results: Cats vs Dogs Much better loss: 0.5622 acc: 0.7145 val_loss: 0.5090 val_acc: 0.7650
  • 53. Results: Cats vs Dogs Overfitting CNN CNN with Dropout and Image Augmentation loss: 0.5622 acc: 0.7145 val_loss: 0.5090 val_acc: 0.7650 loss: 0.0134 acc: 0.9965 val_loss: 3.5137 val_acc: 0.7290
  • 54. 1 Transfer Learning Leverage PreTrained Model by Experts 5
  • 55. Transfer Learning: ImageNet Transfer learning is a technique that reuses an existing model to the current model. You could produce on top of existing models that were carefully designed by experts and trained with millions of pictures. You can freeze the model, then only apply the training for the high level layers.
  • 56. Transfer Learning CNN Stacks Fully Connected Layer CNN Stacks Fully Connected Layer
  • 59. Results: Cats vs Dogs CNN with Dropout and Image Augmentation loss: 0.5622 acc: 0.7145 val_loss: 0.5090 val_acc: 0.7650 Transfer Learning (VGG16)
  • 60. Colab Demonstration Cat v.s. Dog using CNN https://colab.research.google.com/drive/1OFWBxvT9cnyJpcTcGCPEqYIq_u0Yt90b?authuser=1#scrollTo=tRVDMlsknGDU
  • 61. Proprietary + Confidential What’s Next: Explainable ML
  • 63. Proprietary + Confidential Today’s Agenda 1 2 3 4 5 Machine Learning in Image Recognition Principles behind CNN: Convolution, ReLU, Max Pooling CNN stacks + Fully Connected Layer Avoiding Overfitting (Dropout and Image Augmentation) Transfer Learning
  • 64. Proprietary + Confidential Today’s Summary Machine Learning in Image Recognition Principles behind CNN: Convolution, ReLU, Max Pooling CNN stacks + Fully Connected Layer Transfer Learning Avoiding Overfitting + Transfer Learning 04/ 05 ● Data Augmentation: artificially boost diversity and number of training examples ● Dropout: Regularization Techniques to remove activation unit in every gradient step training. Each epoch training deactivates different neurons. ● Transfer learning is a technique that reuses an existing model to the current model. You could produce on top of existing models that were carefully designed by experts and trained with millions of pictures. CNN Stacks +Fully Connected Layer 03 ● Fully Connected Layer: Take the Feature maps from CNN as the inputs and insert it into NN models which will calculate the probabilities of the image to the labels assigned. ● Softmax activation function which assign decimal probabilities for each possible label which add up to 1.0. Principles behind CNN: Convolution, ReLU, and Max Pooling 02 ● Convolution: Same principle also applies to 2-D where you derive from the feature map using the kernels (acts as weights in NN). ● The ReLU function introduces non linearity to activate on a “big enough” stimulus (sparse activation). ● Max pooling to replace output with a max summary to reduce data size and processing time. Machine Learning in Image Recognition 01 ● Classical Image Recognition Allows you to extract features and derive characteristics. ● Convolution Neural Network (CNN) Deep learning techniques using convolutions, max pooling to share weights, produce critical features, and classify labels. Commonly used in image classifications
  • 65. Reach out to me :) Medium : towardsdatascience.com/@vincentkernn Linkedin : linkedin.com/in/vincenttatan/ Survey: tiny.cc/vincent-survey