SlideShare une entreprise Scribd logo
1  sur  54
Google Tech Sprint
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.
Path to Google
Visa
Business Intelligence Intern
May 16 - Jul 16
Lazada Group
Data Scientist Intern
Dec 16 - Apr 17B.Sc., Management Information
Systems and Services
Aug 13 - July 17
Visa
Data & Architecture
Engineer
Jun 17 - Aug 19
Google
Data Analyst, Machine
Learning
Aug 19 - Present
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
Understanding CNN
Medium Articles
https://towardsdatascience.com/understanding-cnn-convolutional-neural-network-69fd626ee7d4
Colab Demonstration
Cat v.s. Dog using CNN
https://colab.sandbox.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/images/classification.ipynb
Colab Demonstration
Cat v.s. Dog using CNN
https://colab.sandbox.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/images/classification.ipynb
Proprietary + Confidential
Today’s Agenda
1
2
3
4
Machine Learning in Image Recognition
Principles behind CNN: Convolution, ReLU, Max Pooling
CNN stacks + Fully Connected Layer
Avoiding Overfitting + Transfer Learning
1
Machine Learning in Image
Recognition
Classify objects in images1
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
● Prior knowledge (your scrolling habits/understanding of faces)
● Data (strokes of the painting)
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
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 -11 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
>
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
Fully Connected Layer
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
4
Avoiding Overfitting + Transfer
Learning
Improve Generalization and leverage pretrained
model
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
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.
Important Resources (Teachable Machine)
https://teachablemachine.withgoogle.com/train/image
Proprietary + Confidential
Today’s Summary
1
2
3
4
Machine Learning in Image Recognition
Principles behind CNN: Convolution, ReLU, Max Pooling
CNN stacks + Fully Connected Layer
Avoiding Overfitting + 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
● 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 Pooling02
● 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
Colab Demonstration
Cat v.s. Dog using CNN
https://colab.sandbox.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/images/classification.ipynb
Reach out to me :)
Medium : towardsdatascience.com/@vincentkernn
Linkedin : linkedin.com/in/vincenttatan/
Survey: tiny.cc/vincent-survey

Contenu connexe

Tendances

Variants of GANs - Jaejun Yoo
Variants of GANs - Jaejun YooVariants of GANs - Jaejun Yoo
Variants of GANs - Jaejun YooJaeJun Yoo
 
Machine learning and vulnerabilities
Machine learning and vulnerabilitiesMachine learning and vulnerabilities
Machine learning and vulnerabilitiesgalazzo
 
Introduction to Deep Learning and Tensorflow
Introduction to Deep Learning and TensorflowIntroduction to Deep Learning and Tensorflow
Introduction to Deep Learning and TensorflowOswald Campesato
 
sentiment analysis using support vector machine
sentiment analysis using support vector machinesentiment analysis using support vector machine
sentiment analysis using support vector machineShital Andhale
 
Matrix Factorization In Recommender Systems
Matrix Factorization In Recommender SystemsMatrix Factorization In Recommender Systems
Matrix Factorization In Recommender SystemsYONG ZHENG
 
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...Edge AI and Vision Alliance
 
Prediction of Exchange Rate Using Deep Neural Network
Prediction of Exchange Rate Using Deep Neural Network  Prediction of Exchange Rate Using Deep Neural Network
Prediction of Exchange Rate Using Deep Neural Network Tomoki Hayashi
 
Learn to Build an App to Find Similar Images using Deep Learning- Piotr Teterwak
Learn to Build an App to Find Similar Images using Deep Learning- Piotr TeterwakLearn to Build an App to Find Similar Images using Deep Learning- Piotr Teterwak
Learn to Build an App to Find Similar Images using Deep Learning- Piotr TeterwakPyData
 
Deep learning (Machine learning) tutorial for beginners
Deep learning (Machine learning) tutorial for beginnersDeep learning (Machine learning) tutorial for beginners
Deep learning (Machine learning) tutorial for beginnersTerry Taewoong Um
 
Camp IT: Making the World More Efficient Using AI & Machine Learning
Camp IT: Making the World More Efficient Using AI & Machine LearningCamp IT: Making the World More Efficient Using AI & Machine Learning
Camp IT: Making the World More Efficient Using AI & Machine LearningKrzysztof Kowalczyk
 
DL Classe 1 - Go Deep or Go Home
DL Classe 1 - Go Deep or Go HomeDL Classe 1 - Go Deep or Go Home
DL Classe 1 - Go Deep or Go HomeGregory Renard
 
Deep Learning Class #1 - Go Deep or Go Home
Deep Learning Class #1 - Go Deep or Go HomeDeep Learning Class #1 - Go Deep or Go Home
Deep Learning Class #1 - Go Deep or Go HomeHolberton School
 
MATLAB Code + Description : Real-Time Object Motion Detection and Tracking
MATLAB Code + Description : Real-Time Object Motion Detection and TrackingMATLAB Code + Description : Real-Time Object Motion Detection and Tracking
MATLAB Code + Description : Real-Time Object Motion Detection and TrackingAhmed Gad
 
Session-Based Recommendations with Recurrent Neural Networks (Balazs Hidasi, ...
Session-Based Recommendations with Recurrent Neural Networks(Balazs Hidasi, ...Session-Based Recommendations with Recurrent Neural Networks(Balazs Hidasi, ...
Session-Based Recommendations with Recurrent Neural Networks (Balazs Hidasi, ...hyunsung lee
 
SVM Tutorial
SVM TutorialSVM Tutorial
SVM Tutorialbutest
 
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...Universitat Politècnica de Catalunya
 

Tendances (20)

Variants of GANs - Jaejun Yoo
Variants of GANs - Jaejun YooVariants of GANs - Jaejun Yoo
Variants of GANs - Jaejun Yoo
 
Machine learning and vulnerabilities
Machine learning and vulnerabilitiesMachine learning and vulnerabilities
Machine learning and vulnerabilities
 
Deep learning-practical
Deep learning-practicalDeep learning-practical
Deep learning-practical
 
Introduction to Deep Learning and Tensorflow
Introduction to Deep Learning and TensorflowIntroduction to Deep Learning and Tensorflow
Introduction to Deep Learning and Tensorflow
 
sentiment analysis using support vector machine
sentiment analysis using support vector machinesentiment analysis using support vector machine
sentiment analysis using support vector machine
 
Java and Deep Learning
Java and Deep LearningJava and Deep Learning
Java and Deep Learning
 
Svm ms
Svm msSvm ms
Svm ms
 
Matrix Factorization In Recommender Systems
Matrix Factorization In Recommender SystemsMatrix Factorization In Recommender Systems
Matrix Factorization In Recommender Systems
 
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...
“Introducing Machine Learning and How to Teach Machines to See,” a Presentati...
 
Prediction of Exchange Rate Using Deep Neural Network
Prediction of Exchange Rate Using Deep Neural Network  Prediction of Exchange Rate Using Deep Neural Network
Prediction of Exchange Rate Using Deep Neural Network
 
Learn to Build an App to Find Similar Images using Deep Learning- Piotr Teterwak
Learn to Build an App to Find Similar Images using Deep Learning- Piotr TeterwakLearn to Build an App to Find Similar Images using Deep Learning- Piotr Teterwak
Learn to Build an App to Find Similar Images using Deep Learning- Piotr Teterwak
 
Deep learning (Machine learning) tutorial for beginners
Deep learning (Machine learning) tutorial for beginnersDeep learning (Machine learning) tutorial for beginners
Deep learning (Machine learning) tutorial for beginners
 
Camp IT: Making the World More Efficient Using AI & Machine Learning
Camp IT: Making the World More Efficient Using AI & Machine LearningCamp IT: Making the World More Efficient Using AI & Machine Learning
Camp IT: Making the World More Efficient Using AI & Machine Learning
 
DL Classe 1 - Go Deep or Go Home
DL Classe 1 - Go Deep or Go HomeDL Classe 1 - Go Deep or Go Home
DL Classe 1 - Go Deep or Go Home
 
Deep Learning Class #1 - Go Deep or Go Home
Deep Learning Class #1 - Go Deep or Go HomeDeep Learning Class #1 - Go Deep or Go Home
Deep Learning Class #1 - Go Deep or Go Home
 
MATLAB Code + Description : Real-Time Object Motion Detection and Tracking
MATLAB Code + Description : Real-Time Object Motion Detection and TrackingMATLAB Code + Description : Real-Time Object Motion Detection and Tracking
MATLAB Code + Description : Real-Time Object Motion Detection and Tracking
 
Session-Based Recommendations with Recurrent Neural Networks (Balazs Hidasi, ...
Session-Based Recommendations with Recurrent Neural Networks(Balazs Hidasi, ...Session-Based Recommendations with Recurrent Neural Networks(Balazs Hidasi, ...
Session-Based Recommendations with Recurrent Neural Networks (Balazs Hidasi, ...
 
SVM Tutorial
SVM TutorialSVM Tutorial
SVM Tutorial
 
Deeplearning in finance
Deeplearning in financeDeeplearning in finance
Deeplearning in finance
 
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...
Generative Models and Adversarial Training (D2L3 Insight@DCU Machine Learning...
 

Similaire à [Revised] Intro to CNN

Ultrasound Nerve Segmentation
Ultrasound Nerve Segmentation Ultrasound Nerve Segmentation
Ultrasound Nerve Segmentation Sneha Ravikumar
 
Deep Neural Network DNN.docx
Deep Neural Network DNN.docxDeep Neural Network DNN.docx
Deep Neural Network DNN.docxjaffarbikat
 
Model Evaluation in the land of Deep Learning
Model Evaluation in the land of Deep LearningModel Evaluation in the land of Deep Learning
Model Evaluation in the land of Deep LearningPramit Choudhary
 
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...IRJET Journal
 
Introduction to Convolutional Neural Networks
Introduction to Convolutional Neural NetworksIntroduction to Convolutional Neural Networks
Introduction to Convolutional Neural NetworksParrotAI
 
Course Title CS591-Advance Artificial Intelligence
Course Title CS591-Advance Artificial Intelligence           Course Title CS591-Advance Artificial Intelligence
Course Title CS591-Advance Artificial Intelligence CruzIbarra161
 
Deep Computer Vision - 1.pptx
Deep Computer Vision - 1.pptxDeep Computer Vision - 1.pptx
Deep Computer Vision - 1.pptxJawadHaider36
 
Convolution Neural Network (CNN)
Convolution Neural Network (CNN)Convolution Neural Network (CNN)
Convolution Neural Network (CNN)Suraj Aavula
 
SVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxSVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxMohamedMonir33
 
2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!
2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!
2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!Bruno Capuano
 
SeRanet introduction
SeRanet introductionSeRanet introduction
SeRanet introductionKosuke Nakago
 

Similaire à [Revised] Intro to CNN (20)

Deep learning
Deep learningDeep learning
Deep learning
 
Ultrasound Nerve Segmentation
Ultrasound Nerve Segmentation Ultrasound Nerve Segmentation
Ultrasound Nerve Segmentation
 
Deep Neural Network DNN.docx
Deep Neural Network DNN.docxDeep Neural Network DNN.docx
Deep Neural Network DNN.docx
 
AI and Deep Learning
AI and Deep Learning AI and Deep Learning
AI and Deep Learning
 
Model Evaluation in the land of Deep Learning
Model Evaluation in the land of Deep LearningModel Evaluation in the land of Deep Learning
Model Evaluation in the land of Deep Learning
 
Deep Learning Demystified
Deep Learning DemystifiedDeep Learning Demystified
Deep Learning Demystified
 
Image captioning
Image captioningImage captioning
Image captioning
 
cnn ppt.pptx
cnn ppt.pptxcnn ppt.pptx
cnn ppt.pptx
 
Human Emotion Recognition
Human Emotion RecognitionHuman Emotion Recognition
Human Emotion Recognition
 
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
 
Introduction to Convolutional Neural Networks
Introduction to Convolutional Neural NetworksIntroduction to Convolutional Neural Networks
Introduction to Convolutional Neural Networks
 
Android and Deep Learning
Android and Deep LearningAndroid and Deep Learning
Android and Deep Learning
 
Course Title CS591-Advance Artificial Intelligence
Course Title CS591-Advance Artificial Intelligence           Course Title CS591-Advance Artificial Intelligence
Course Title CS591-Advance Artificial Intelligence
 
Fake News Detection using Deep Learning
Fake News Detection using Deep LearningFake News Detection using Deep Learning
Fake News Detection using Deep Learning
 
Deep Computer Vision - 1.pptx
Deep Computer Vision - 1.pptxDeep Computer Vision - 1.pptx
Deep Computer Vision - 1.pptx
 
Convolution Neural Network (CNN)
Convolution Neural Network (CNN)Convolution Neural Network (CNN)
Convolution Neural Network (CNN)
 
SVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxSVM & KNN Presentation.pptx
SVM & KNN Presentation.pptx
 
2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!
2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!
2019 05 11 Chicago Codecamp - Deep Learning for everyone? Challenge Accepted!
 
Tensor flow
Tensor flowTensor flow
Tensor flow
 
SeRanet introduction
SeRanet introductionSeRanet introduction
SeRanet introduction
 

Plus de Vincent Tatan

Life of a ML Engineer [Redacted].pptx
Life of a ML Engineer [Redacted].pptxLife of a ML Engineer [Redacted].pptx
Life of a ML Engineer [Redacted].pptxVincent Tatan
 
[Master] unboxing design docs for data scientists
[Master] unboxing design docs for data scientists[Master] unboxing design docs for data scientists
[Master] unboxing design docs for data scientistsVincent Tatan
 
Listen, check, and pay
Listen, check, and payListen, check, and pay
Listen, check, and payVincent Tatan
 
Intro to ml lesson vincent
Intro to ml lesson vincentIntro to ml lesson vincent
Intro to ml lesson vincentVincent Tatan
 
Overcoming Imposter Syndrome
Overcoming Imposter SyndromeOvercoming Imposter Syndrome
Overcoming Imposter SyndromeVincent Tatan
 
SAS Slides FINALE (2)
SAS Slides FINALE (2)SAS Slides FINALE (2)
SAS Slides FINALE (2)Vincent Tatan
 
Doc 14 Jan 2016%2c 1014-rotated (1)
Doc 14 Jan 2016%2c 1014-rotated (1)Doc 14 Jan 2016%2c 1014-rotated (1)
Doc 14 Jan 2016%2c 1014-rotated (1)Vincent Tatan
 

Plus de Vincent Tatan (7)

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

Dernier

Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Dernier (20)

Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 

[Revised] Intro to CNN

  • 1. Google Tech Sprint 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. Path to Google Visa Business Intelligence Intern May 16 - Jul 16 Lazada Group Data Scientist Intern Dec 16 - Apr 17B.Sc., Management Information Systems and Services Aug 13 - July 17 Visa Data & Architecture Engineer Jun 17 - Aug 19 Google Data Analyst, Machine Learning Aug 19 - Present
  • 6. Google: Trust and Safety To prevent phishing @ scale with Data Analytics and ML Google Data Analyst, Machine Learning Aug 19 - Present
  • 10. Colab Demonstration Cat v.s. Dog using CNN https://colab.sandbox.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/images/classification.ipynb
  • 11. Colab Demonstration Cat v.s. Dog using CNN https://colab.sandbox.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/images/classification.ipynb
  • 12. Proprietary + Confidential Today’s Agenda 1 2 3 4 Machine Learning in Image Recognition Principles behind CNN: Convolution, ReLU, Max Pooling CNN stacks + Fully Connected Layer Avoiding Overfitting + Transfer Learning
  • 13. 1 Machine Learning in Image Recognition Classify objects in images1
  • 14. Image Recognition is hard -- Are all of these cats? My search for the word “cat”.
  • 15. 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
  • 16. We need a way to determine the features scalably
  • 17. 2 Principles behind CNN Convolution, ReLU, Max Pooling
  • 18. 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
  • 19. Intuition of Convolutional Neural Network What do you see? Young lady or old grandma or both?
  • 20. 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)
  • 21. Intuition of Convolutional Neural Network This means you are relying on ● Prior knowledge (your scrolling habits/understanding of faces) ● Data (strokes of the painting) To identify Features
  • 22. 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
  • 23. 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]
  • 24. Principle of CNN: Convolution (1-D) Which order of the element where I see 1 becomes -1? 1 -11 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
  • 25. 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 >
  • 26. Principle of CNN: Convolution (2-D), 3 stacks Feature Maps
  • 27. 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.
  • 28. 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.
  • 29. Recap Understanding CNN 1. Convolution 2. ReLU Activation Function 3. Maxpooling
  • 30. 3 CNN Stacks + Fully Connected Layer Generating Real Results
  • 31. 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)
  • 32. CNN Stacks: Cats vs Dogs The discovery of curves
  • 33. Fully Connected Layer Activation: Softmax softmax activation function squashes the probability scores to add up to 1.0.
  • 34. 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.
  • 36. Create and Compile our CNN Change to ‘categorical_crossentropy’ for softmax CNN Stacks Fully Connected Layer
  • 39. Results: Cats vs Dogs Overfitting! loss: 0.0134 acc: 0.9965 val_loss: 3.5137 val_acc: 0.7290
  • 40. 4 Avoiding Overfitting + Transfer Learning Improve Generalization and leverage pretrained model
  • 41. 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
  • 42. 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.
  • 44. 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.
  • 47. Results: Cats vs Dogs Much better loss: 0.5622 acc: 0.7145 val_loss: 0.5090 val_acc: 0.7650
  • 48. 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
  • 49. 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.
  • 50. Important Resources (Teachable Machine) https://teachablemachine.withgoogle.com/train/image
  • 51. Proprietary + Confidential Today’s Summary 1 2 3 4 Machine Learning in Image Recognition Principles behind CNN: Convolution, ReLU, Max Pooling CNN stacks + Fully Connected Layer Avoiding Overfitting + Transfer Learning
  • 52. 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 ● 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 Pooling02 ● 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
  • 53. Colab Demonstration Cat v.s. Dog using CNN https://colab.sandbox.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/images/classification.ipynb
  • 54. Reach out to me :) Medium : towardsdatascience.com/@vincentkernn Linkedin : linkedin.com/in/vincenttatan/ Survey: tiny.cc/vincent-survey