SlideShare a Scribd company logo
Artificial Intelligence
for everyone
Build your 1st solution on
Deep Learning
https://sites.google.com/view/AIforEveryone
AI for Good Workshop
March 2019
Session 4
Topics in this video
1. Define a purpose
2. Apply the Strategy to jump start
3. Hands-on : Create your 1st Deep Learning solution
Jump start your AI journey !
The inspiration
Francois Chollet
Artificial Intelligence Researcher,
Google
ISBN-13: 978-1617294433
Deep Learning with Python
https://www.manning.com/books/deep-learning-with-python
Design of Deep Learning experiment
Define problem What is the purpose
Prepare the data
Collect data, spilit data,
vectorize, reshape,
normalize, OHE
Define the network
architecture
architecture
Define loss,
optimizers
Define the metrics,
optimizers, loss function,
and Compile the model
Train the network Train the network
Improve power to
generalize
Evaluate the network,
Hypertune
Test Test, Predict
Deploy Deploy
1
2
3
4
5
6
7
8AIforEveryone.org
Define the idea
• App idea: Recognize your hand gesture to
unlock your smartphone (Secure unlock)
• Problem: Recognize hand draw gestures to
unlock your phone
Define your
larger purpose
1
visual recognition – image classification
Method: 7 steps to develop your Deep Learning model
1: Define problem
Collect data representing
the purpose
2: Format the data
Spilt data, vectorize, reshape,
normalize, OHE
3: Design the network Design the Neural Network
4: Define loss Think of what to optimize for
5: Train the network
Allow the network to learn
patterns in the data
6: Validate & Improve Power of generalization?
7: Predict Predict
Adjust model’s
capacity to learn
“just the patterns”
Develop model
that overfits
Develop 1st model
A  B
•
X  Y
X = image
Y = Category of image
Simplify your goal
Problem: Users draws a hand drawn gestures, your app identifies it.
Simplified Problem: User can draw any number between 0 to 9
Define your
problem
1
1. Define
problem
Collect the data
representing the
world you what
to predict
Load the data Visualize data
•
Labeled dataset
Method: 7 steps to develop your Deep Learning model
1: Define problem
Collect data representing
the purpose
2: Format the data
Spilt data, vectorize, reshape,
normalize, OHE
3: Design the network Design the Neural Network
4: Define loss Think of what to optimize for
5: Train the network
Allow the network to learn
patterns in the data
6: Validate & Improve Power of generalization?
7: Predict Predict
Adjust model’s
capacity to learn
“just the patterns”
Develop model
that overfits
Develop 1st model
1. Define
problem
Collect the data
representing the
world you what
to predict
Load the data Visualize data
from keras.datasets import mnist
#1: Define problem, Collect data, Visualize it
# Recognize handwritten numbers
(trainX, trainY), (testX, testY) = mnist.load_data(
from keras.datasets import mnist
(trainX, trainY), (testX, testY) = mnist. load_data()
len(trainX)
keras. datasets. mnist. load_data()
type ( myObject )
1. Define
problem
Collect the data
representing the
world you what
to predict
Load the data Visualize data
from keras.datasets import mnist
Visualize it
exampleImage = trainY [2]
pyplot. imshow (exampleImage )
pyplot. show()
from matplotlib import pyplot
matplotlib. pyplot. imshow ( myArrayImage )
Method: 7 steps to develop your Deep Learning model
1: Define problem
Collect data representing
the purpose
2: Format the data
Spilt data, vectorize, reshape,
normalize, OHE
3: Design the network Design the Neural Network
4: Define loss Think of what to optimize for
5: Train the network
Allow the network to learn
patterns in the data
6: Validate & Improve Power of generalization?
7: Predict Predict
Adjust model’s
capacity to learn
“just the patterns”
Develop model
that overfits
Develop 1st model
2. Prepare data
2. Prepare
the data
Spilt data in
training &
testing
Vectortize
as tensors
Reshape Normalize
One Hot
encode
AIforEveryone.org
2. Prepare
the data
Spilt data in
training &
testing
Vectortize
as tensors
Reshape Normalize
One Hot
encode
No of training records = 60000
No of test records = 10000
Shape of training image = (60000, 28, 28)
60000
2. Prepare
the data
Spilt data in
training &
testing
Vectortize
as tensors
Reshape Normalize
One Hot
encode
trainXready = trainX. reshape (800, 28*28)
trainX.shape
Shape of trainX: (800, 28, 28)
Shape of trainXready: (800, 784)
newArray = myArray . reshape (28 * 28)
Multi dimensional Array == Tensor
What_is_size_of_array = myArray.shape
Reshape() an array
2. Prepare
the data
Spilt data in
training &
testing
Vectortize
as tensors
Reshape Normalize
One Hot
encode
trainXready = temptrainX.astype('float32') / 255
newArray = myArray / 255
afloat = aInteger. astype(‘float32’)
One Hot Encoding
Data:
[2]
Data after One Hot Encoding:
[[ 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]]
yNew = to_categorical (y)
2. Prepare
the data
Spilt data in
training &
testing
Vectortize
as tensors
Reshape Normalize
One Hot
encode2. Prepare
the data
Spilt data in
training &
testing
Vectortize
as tensors
Reshape Normalize
One Hot
encode
myArray = keras.utils. to_categorical ( aInteger)
Data: [2]
Data after OHE : [[ 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]]
3. Design the network
AIforEveryone.org
Adjust model’s capacity
to learn
“just the patterns”
Develop model that
overfits
Develop 1st model
Data
RepresentationofData
Method: 7 steps to develop your Deep Learning model
1: Define problem
Collect data representing
the purpose
2: Format the data
Spilt data, vectorize, reshape,
normalize, OHE
3: Design the network Design the Neural Network
4: Define loss Think of what to optimize for
5: Train the network
Allow the network to learn
patterns in the data
6: Validate & Improve Power of generalization?
7: Predict Predict
Adjust model’s
capacity to learn
“just the patterns”
Develop model
that overfits
Develop 1st model
3. Design the network
#Step 3: Define the network architecture
network = models.Sequential()
layer1 = layers.Dense(512, input_shape=(28*28,), activation='relu')
network.add(layer1)
layer2 = layers.Dense(128, activation='relu')
network.add(layer2)
layer3 = layers.Dense(10, activation='softmax')
network.add(layer3)
3. Design the network
#Step 3: Define the network architecture
network = models.Sequential()
layer1 = layers. Dense (512, input_shape=(28*28,))
network.add(layer1)
layer2 = layers. Dense (128)
network.add(layer2)
layer3 = layers. Dense (10)
network.add(layer3)
Method: 7 steps to develop your Deep Learning model
1: Define problem
Collect data representing
the purpose
2: Format the data
Spilt data, vectorize, reshape,
normalize, OHE
3: Design the network Design the Neural Network
4: Define loss Think of what to optimize for
5: Train the network
Allow the network to learn
patterns in the data
6: Validate & Improve Power of generalization?
7: Predict Predict
Adjust model’s
capacity to learn
“just the patterns”
Develop model
that overfits
Develop 1st model
5. Train
4 4 4
myModel.fit(X,Y)
X  Y
X = image
Y = 5
Sample image
Label of the image
7. Predict
Hand
drawing
samples
 0
 1
 .
 9
Classifier
Input Predicted output
y = myModel . Predict(X)
X  Y
•
7. Predict
Problem: Users draws a hand drawn gestures , your app predicts it.
predictedResults = network.predict(testXready[1:3])
Predicted Results:
[ 1.35398892e-08 3.91871922e-08 9.99876499e-01 1.22501457e-04
1.77109036e-10 1.30937892e-07 2.99046292e-07 2.58880729e-11
4.58700157e-07 2.09212196e-11]
Ground Truth OHE : [[ 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]]
Ground Truth : [2]
AIforEveryone.org
Let’s it together
• App idea: Recognize your hand gesture to
unlock your smartphone (Secure unlock)
• Biz outcome: Recognize hand draw gestures
to unlock your phone
Test accuracy is: 0.9157
#Step 6: Evaluate the network
metrics_test_loss, metrics_test_accuracy = network.evaluate(testXready, testYready)
Type this URL
github.com/
rajagopalmotivate1/
DeepLearningLab
/Play_3_MNIST_Predict_wit
h_Dense.ipynb
Design of Deep Learning experiment
Define problem What is the purpose
Prepare the data
Collect data, spilit data,
vectorize, reshape,
normalize, OHE
Define the network
architecture
architecture
Define loss,
optimizers
Define the metrics,
optimizers, loss function,
and Compile the model
Train the network Train the network
Improve power to
generalize
Evaluate the network,
Hypertune
Test Test, Predict
Deploy Deploy
1
2
3
4
5
6
7
8

More Related Content

Similar to Session 4 start coding Tensorflow 2.0

How to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make PredictionsHow to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make Predictions
Developer Helps
 
Learning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleLearning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and Kaggle
Yvonne K. Matos
 
Yufeng Guo | Coding the 7 steps of machine learning | Codemotion Madrid 2018
Yufeng Guo |  Coding the 7 steps of machine learning | Codemotion Madrid 2018 Yufeng Guo |  Coding the 7 steps of machine learning | Codemotion Madrid 2018
Yufeng Guo | Coding the 7 steps of machine learning | Codemotion Madrid 2018
Codemotion
 
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
Dataconomy Media
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
Ganesan Narayanasamy
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
Hichem Felouat
 
OpenPOWER Workshop in Silicon Valley
OpenPOWER Workshop in Silicon ValleyOpenPOWER Workshop in Silicon Valley
OpenPOWER Workshop in Silicon Valley
Ganesan Narayanasamy
 
Training course lect2
Training course lect2Training course lect2
Training course lect2
Noor Dhiya
 
Viktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceViktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning Service
Lviv Startup Club
 
Unsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at ScaleUnsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at Scale
Aaron (Ari) Bornstein
 
Towards a Unified Data Analytics Optimizer with Yanlei Diao
Towards a Unified Data Analytics Optimizer with Yanlei DiaoTowards a Unified Data Analytics Optimizer with Yanlei Diao
Towards a Unified Data Analytics Optimizer with Yanlei Diao
Databricks
 
MCL309_Deep Learning on a Raspberry Pi
MCL309_Deep Learning on a Raspberry PiMCL309_Deep Learning on a Raspberry Pi
MCL309_Deep Learning on a Raspberry Pi
Amazon Web Services
 
Deep Learning for Developers
Deep Learning for DevelopersDeep Learning for Developers
Deep Learning for DevelopersJulien SIMON
 
The ABC of Implementing Supervised Machine Learning with Python.pptx
The ABC of Implementing Supervised Machine Learning with Python.pptxThe ABC of Implementing Supervised Machine Learning with Python.pptx
The ABC of Implementing Supervised Machine Learning with Python.pptx
Ruby Shrestha
 
Deep learning-practical
Deep learning-practicalDeep learning-practical
Deep learning-practical
Hitesh Mohapatra
 
0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc
RohanS38
 
Neural network image recognition
Neural network image recognitionNeural network image recognition
Neural network image recognition
Oleksii Sekundant
 
Baseball Prediction Model on Tensorflow
Baseball Prediction Model on TensorflowBaseball Prediction Model on Tensorflow
Baseball Prediction Model on Tensorflow
Jay Ryu
 
CS301-lec01.ppt
CS301-lec01.pptCS301-lec01.ppt
CS301-lec01.ppt
omair31
 
[PR12] PR-036 Learning to Remember Rare Events
[PR12] PR-036 Learning to Remember Rare Events[PR12] PR-036 Learning to Remember Rare Events
[PR12] PR-036 Learning to Remember Rare Events
Taegyun Jeon
 

Similar to Session 4 start coding Tensorflow 2.0 (20)

How to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make PredictionsHow to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make Predictions
 
Learning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and KaggleLearning Predictive Modeling with TSA and Kaggle
Learning Predictive Modeling with TSA and Kaggle
 
Yufeng Guo | Coding the 7 steps of machine learning | Codemotion Madrid 2018
Yufeng Guo |  Coding the 7 steps of machine learning | Codemotion Madrid 2018 Yufeng Guo |  Coding the 7 steps of machine learning | Codemotion Madrid 2018
Yufeng Guo | Coding the 7 steps of machine learning | Codemotion Madrid 2018
 
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
 
Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117Power ai tensorflowworkloadtutorial-20171117
Power ai tensorflowworkloadtutorial-20171117
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
 
OpenPOWER Workshop in Silicon Valley
OpenPOWER Workshop in Silicon ValleyOpenPOWER Workshop in Silicon Valley
OpenPOWER Workshop in Silicon Valley
 
Training course lect2
Training course lect2Training course lect2
Training course lect2
 
Viktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceViktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning Service
 
Unsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at ScaleUnsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at Scale
 
Towards a Unified Data Analytics Optimizer with Yanlei Diao
Towards a Unified Data Analytics Optimizer with Yanlei DiaoTowards a Unified Data Analytics Optimizer with Yanlei Diao
Towards a Unified Data Analytics Optimizer with Yanlei Diao
 
MCL309_Deep Learning on a Raspberry Pi
MCL309_Deep Learning on a Raspberry PiMCL309_Deep Learning on a Raspberry Pi
MCL309_Deep Learning on a Raspberry Pi
 
Deep Learning for Developers
Deep Learning for DevelopersDeep Learning for Developers
Deep Learning for Developers
 
The ABC of Implementing Supervised Machine Learning with Python.pptx
The ABC of Implementing Supervised Machine Learning with Python.pptxThe ABC of Implementing Supervised Machine Learning with Python.pptx
The ABC of Implementing Supervised Machine Learning with Python.pptx
 
Deep learning-practical
Deep learning-practicalDeep learning-practical
Deep learning-practical
 
0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc0_ML lab programs updated123 (3).1687933796093.doc
0_ML lab programs updated123 (3).1687933796093.doc
 
Neural network image recognition
Neural network image recognitionNeural network image recognition
Neural network image recognition
 
Baseball Prediction Model on Tensorflow
Baseball Prediction Model on TensorflowBaseball Prediction Model on Tensorflow
Baseball Prediction Model on Tensorflow
 
CS301-lec01.ppt
CS301-lec01.pptCS301-lec01.ppt
CS301-lec01.ppt
 
[PR12] PR-036 Learning to Remember Rare Events
[PR12] PR-036 Learning to Remember Rare Events[PR12] PR-036 Learning to Remember Rare Events
[PR12] PR-036 Learning to Remember Rare Events
 

More from Rajagopal A

How to architect Deep Learning
How to architect Deep Learning How to architect Deep Learning
How to architect Deep Learning
Rajagopal A
 
Session 5 coding handson Tensorflow
Session 5 coding handson Tensorflow Session 5 coding handson Tensorflow
Session 5 coding handson Tensorflow
Rajagopal A
 
Deep Learning: Session 3 : How to succeed
Deep Learning: Session 3 : How to succeedDeep Learning: Session 3 : How to succeed
Deep Learning: Session 3 : How to succeed
Rajagopal A
 
Deep Learning: Session 2 how to architect
Deep Learning: Session 2 how to architect Deep Learning: Session 2 how to architect
Deep Learning: Session 2 how to architect
Rajagopal A
 
Deep Learning Session 1 : bright future for you summary
Deep Learning Session 1 : bright future for you summaryDeep Learning Session 1 : bright future for you summary
Deep Learning Session 1 : bright future for you summary
Rajagopal A
 
2 day Deep Learning Workshop - Session 3
2 day Deep Learning Workshop - Session 3 2 day Deep Learning Workshop - Session 3
2 day Deep Learning Workshop - Session 3
Rajagopal A
 
2 day Deep Learning Workshop at Karunya - Session 2
2 day Deep Learning Workshop at Karunya - Session 22 day Deep Learning Workshop at Karunya - Session 2
2 day Deep Learning Workshop at Karunya - Session 2
Rajagopal A
 
2 day Deep Learning Workshop at Karunya - Session 1
2 day Deep Learning Workshop at Karunya - Session 12 day Deep Learning Workshop at Karunya - Session 1
2 day Deep Learning Workshop at Karunya - Session 1
Rajagopal A
 

More from Rajagopal A (8)

How to architect Deep Learning
How to architect Deep Learning How to architect Deep Learning
How to architect Deep Learning
 
Session 5 coding handson Tensorflow
Session 5 coding handson Tensorflow Session 5 coding handson Tensorflow
Session 5 coding handson Tensorflow
 
Deep Learning: Session 3 : How to succeed
Deep Learning: Session 3 : How to succeedDeep Learning: Session 3 : How to succeed
Deep Learning: Session 3 : How to succeed
 
Deep Learning: Session 2 how to architect
Deep Learning: Session 2 how to architect Deep Learning: Session 2 how to architect
Deep Learning: Session 2 how to architect
 
Deep Learning Session 1 : bright future for you summary
Deep Learning Session 1 : bright future for you summaryDeep Learning Session 1 : bright future for you summary
Deep Learning Session 1 : bright future for you summary
 
2 day Deep Learning Workshop - Session 3
2 day Deep Learning Workshop - Session 3 2 day Deep Learning Workshop - Session 3
2 day Deep Learning Workshop - Session 3
 
2 day Deep Learning Workshop at Karunya - Session 2
2 day Deep Learning Workshop at Karunya - Session 22 day Deep Learning Workshop at Karunya - Session 2
2 day Deep Learning Workshop at Karunya - Session 2
 
2 day Deep Learning Workshop at Karunya - Session 1
2 day Deep Learning Workshop at Karunya - Session 12 day Deep Learning Workshop at Karunya - Session 1
2 day Deep Learning Workshop at Karunya - Session 1
 

Recently uploaded

一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
yuhofha
 
MISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMA
MISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMAMISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMA
MISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMA
DK PAGEANT
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
kakomaeric00
 
RECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdf
RECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdfRECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdf
RECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdf
AlessandroMartins454470
 
Erection Methodology (KG Marg) MLCP.pptx
Erection Methodology (KG Marg) MLCP.pptxErection Methodology (KG Marg) MLCP.pptx
Erection Methodology (KG Marg) MLCP.pptx
zrahman0161
 
lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789
Ghh
 
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdfDOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
Pushpendra Kumar
 
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
dsnow9802
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
2zjra9bn
 
'Guidance and counselling- role of Psychologist in Guidance and Counselling.
'Guidance and counselling- role of Psychologist in Guidance and Counselling.'Guidance and counselling- role of Psychologist in Guidance and Counselling.
'Guidance and counselling- role of Psychologist in Guidance and Counselling.
PaviBangera
 
一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理
yuhofha
 
Full Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptxFull Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptx
mmorales2173
 
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
2zjra9bn
 
一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理
一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理
一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理
pxyhy
 
Personal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignmentPersonal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignment
ragingokie
 
一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理
一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理
一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理
taqyed
 
labb123456789123456789123456789123456789
labb123456789123456789123456789123456789labb123456789123456789123456789123456789
labb123456789123456789123456789123456789
Ghh
 
Exploring Career Paths in Cybersecurity for Technical Communicators
Exploring Career Paths in Cybersecurity for Technical CommunicatorsExploring Career Paths in Cybersecurity for Technical Communicators
Exploring Career Paths in Cybersecurity for Technical Communicators
Ben Woelk, CISSP, CPTC
 
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
atwvhyhm
 
一比一原版(QU毕业证)皇后大学毕业证如何办理
一比一原版(QU毕业证)皇后大学毕业证如何办理一比一原版(QU毕业证)皇后大学毕业证如何办理
一比一原版(QU毕业证)皇后大学毕业证如何办理
yuhofha
 

Recently uploaded (20)

一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
 
MISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMA
MISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMAMISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMA
MISS TEEN GONDA 2024 - WINNER ABHA VISHWAKARMA
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
 
RECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdf
RECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdfRECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdf
RECOGNITION AWARD 13 - TO ALESSANDRO MARTINS.pdf
 
Erection Methodology (KG Marg) MLCP.pptx
Erection Methodology (KG Marg) MLCP.pptxErection Methodology (KG Marg) MLCP.pptx
Erection Methodology (KG Marg) MLCP.pptx
 
lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789
 
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdfDOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
 
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
Jill Pizzola's Tenure as Senior Talent Acquisition Partner at THOMSON REUTERS...
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
 
'Guidance and counselling- role of Psychologist in Guidance and Counselling.
'Guidance and counselling- role of Psychologist in Guidance and Counselling.'Guidance and counselling- role of Psychologist in Guidance and Counselling.
'Guidance and counselling- role of Psychologist in Guidance and Counselling.
 
一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理
 
Full Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptxFull Sail_Morales_Michael_SMM_2024-05.pptx
Full Sail_Morales_Michael_SMM_2024-05.pptx
 
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
 
一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理
一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理
一比一原版(SFU毕业证)西蒙弗雷泽大学毕业证如何办理
 
Personal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignmentPersonal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignment
 
一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理
一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理
一比一原版(U-Barcelona毕业证)巴塞罗那大学毕业证成绩单如何办理
 
labb123456789123456789123456789123456789
labb123456789123456789123456789123456789labb123456789123456789123456789123456789
labb123456789123456789123456789123456789
 
Exploring Career Paths in Cybersecurity for Technical Communicators
Exploring Career Paths in Cybersecurity for Technical CommunicatorsExploring Career Paths in Cybersecurity for Technical Communicators
Exploring Career Paths in Cybersecurity for Technical Communicators
 
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
 
一比一原版(QU毕业证)皇后大学毕业证如何办理
一比一原版(QU毕业证)皇后大学毕业证如何办理一比一原版(QU毕业证)皇后大学毕业证如何办理
一比一原版(QU毕业证)皇后大学毕业证如何办理
 

Session 4 start coding Tensorflow 2.0

  • 1. Artificial Intelligence for everyone Build your 1st solution on Deep Learning https://sites.google.com/view/AIforEveryone AI for Good Workshop March 2019 Session 4
  • 2. Topics in this video 1. Define a purpose 2. Apply the Strategy to jump start 3. Hands-on : Create your 1st Deep Learning solution Jump start your AI journey !
  • 3. The inspiration Francois Chollet Artificial Intelligence Researcher, Google ISBN-13: 978-1617294433 Deep Learning with Python https://www.manning.com/books/deep-learning-with-python
  • 4. Design of Deep Learning experiment Define problem What is the purpose Prepare the data Collect data, spilit data, vectorize, reshape, normalize, OHE Define the network architecture architecture Define loss, optimizers Define the metrics, optimizers, loss function, and Compile the model Train the network Train the network Improve power to generalize Evaluate the network, Hypertune Test Test, Predict Deploy Deploy 1 2 3 4 5 6 7 8AIforEveryone.org
  • 5. Define the idea • App idea: Recognize your hand gesture to unlock your smartphone (Secure unlock) • Problem: Recognize hand draw gestures to unlock your phone Define your larger purpose 1
  • 6.
  • 7. visual recognition – image classification
  • 8. Method: 7 steps to develop your Deep Learning model 1: Define problem Collect data representing the purpose 2: Format the data Spilt data, vectorize, reshape, normalize, OHE 3: Design the network Design the Neural Network 4: Define loss Think of what to optimize for 5: Train the network Allow the network to learn patterns in the data 6: Validate & Improve Power of generalization? 7: Predict Predict Adjust model’s capacity to learn “just the patterns” Develop model that overfits Develop 1st model
  • 9.
  • 11. X  Y X = image Y = Category of image
  • 12. Simplify your goal Problem: Users draws a hand drawn gestures, your app identifies it. Simplified Problem: User can draw any number between 0 to 9 Define your problem 1
  • 13.
  • 14.
  • 15. 1. Define problem Collect the data representing the world you what to predict Load the data Visualize data • Labeled dataset
  • 16. Method: 7 steps to develop your Deep Learning model 1: Define problem Collect data representing the purpose 2: Format the data Spilt data, vectorize, reshape, normalize, OHE 3: Design the network Design the Neural Network 4: Define loss Think of what to optimize for 5: Train the network Allow the network to learn patterns in the data 6: Validate & Improve Power of generalization? 7: Predict Predict Adjust model’s capacity to learn “just the patterns” Develop model that overfits Develop 1st model
  • 17. 1. Define problem Collect the data representing the world you what to predict Load the data Visualize data from keras.datasets import mnist #1: Define problem, Collect data, Visualize it # Recognize handwritten numbers (trainX, trainY), (testX, testY) = mnist.load_data( from keras.datasets import mnist (trainX, trainY), (testX, testY) = mnist. load_data() len(trainX) keras. datasets. mnist. load_data() type ( myObject )
  • 18. 1. Define problem Collect the data representing the world you what to predict Load the data Visualize data from keras.datasets import mnist Visualize it exampleImage = trainY [2] pyplot. imshow (exampleImage ) pyplot. show() from matplotlib import pyplot matplotlib. pyplot. imshow ( myArrayImage )
  • 19. Method: 7 steps to develop your Deep Learning model 1: Define problem Collect data representing the purpose 2: Format the data Spilt data, vectorize, reshape, normalize, OHE 3: Design the network Design the Neural Network 4: Define loss Think of what to optimize for 5: Train the network Allow the network to learn patterns in the data 6: Validate & Improve Power of generalization? 7: Predict Predict Adjust model’s capacity to learn “just the patterns” Develop model that overfits Develop 1st model
  • 20. 2. Prepare data 2. Prepare the data Spilt data in training & testing Vectortize as tensors Reshape Normalize One Hot encode AIforEveryone.org
  • 21. 2. Prepare the data Spilt data in training & testing Vectortize as tensors Reshape Normalize One Hot encode No of training records = 60000 No of test records = 10000 Shape of training image = (60000, 28, 28) 60000
  • 22. 2. Prepare the data Spilt data in training & testing Vectortize as tensors Reshape Normalize One Hot encode trainXready = trainX. reshape (800, 28*28) trainX.shape Shape of trainX: (800, 28, 28) Shape of trainXready: (800, 784) newArray = myArray . reshape (28 * 28)
  • 23. Multi dimensional Array == Tensor What_is_size_of_array = myArray.shape
  • 25. 2. Prepare the data Spilt data in training & testing Vectortize as tensors Reshape Normalize One Hot encode trainXready = temptrainX.astype('float32') / 255 newArray = myArray / 255 afloat = aInteger. astype(‘float32’)
  • 26. One Hot Encoding Data: [2] Data after One Hot Encoding: [[ 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]] yNew = to_categorical (y)
  • 27. 2. Prepare the data Spilt data in training & testing Vectortize as tensors Reshape Normalize One Hot encode2. Prepare the data Spilt data in training & testing Vectortize as tensors Reshape Normalize One Hot encode myArray = keras.utils. to_categorical ( aInteger) Data: [2] Data after OHE : [[ 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]]
  • 28. 3. Design the network AIforEveryone.org Adjust model’s capacity to learn “just the patterns” Develop model that overfits Develop 1st model Data RepresentationofData
  • 29. Method: 7 steps to develop your Deep Learning model 1: Define problem Collect data representing the purpose 2: Format the data Spilt data, vectorize, reshape, normalize, OHE 3: Design the network Design the Neural Network 4: Define loss Think of what to optimize for 5: Train the network Allow the network to learn patterns in the data 6: Validate & Improve Power of generalization? 7: Predict Predict Adjust model’s capacity to learn “just the patterns” Develop model that overfits Develop 1st model
  • 30.
  • 31. 3. Design the network #Step 3: Define the network architecture network = models.Sequential() layer1 = layers.Dense(512, input_shape=(28*28,), activation='relu') network.add(layer1) layer2 = layers.Dense(128, activation='relu') network.add(layer2) layer3 = layers.Dense(10, activation='softmax') network.add(layer3)
  • 32. 3. Design the network #Step 3: Define the network architecture network = models.Sequential() layer1 = layers. Dense (512, input_shape=(28*28,)) network.add(layer1) layer2 = layers. Dense (128) network.add(layer2) layer3 = layers. Dense (10) network.add(layer3)
  • 33.
  • 34. Method: 7 steps to develop your Deep Learning model 1: Define problem Collect data representing the purpose 2: Format the data Spilt data, vectorize, reshape, normalize, OHE 3: Design the network Design the Neural Network 4: Define loss Think of what to optimize for 5: Train the network Allow the network to learn patterns in the data 6: Validate & Improve Power of generalization? 7: Predict Predict Adjust model’s capacity to learn “just the patterns” Develop model that overfits Develop 1st model
  • 37. X  Y X = image Y = 5 Sample image Label of the image
  • 38.
  • 39. 7. Predict Hand drawing samples  0  1  .  9 Classifier Input Predicted output
  • 40. y = myModel . Predict(X)
  • 42. 7. Predict Problem: Users draws a hand drawn gestures , your app predicts it. predictedResults = network.predict(testXready[1:3]) Predicted Results: [ 1.35398892e-08 3.91871922e-08 9.99876499e-01 1.22501457e-04 1.77109036e-10 1.30937892e-07 2.99046292e-07 2.58880729e-11 4.58700157e-07 2.09212196e-11] Ground Truth OHE : [[ 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.]] Ground Truth : [2] AIforEveryone.org
  • 43. Let’s it together • App idea: Recognize your hand gesture to unlock your smartphone (Secure unlock) • Biz outcome: Recognize hand draw gestures to unlock your phone Test accuracy is: 0.9157 #Step 6: Evaluate the network metrics_test_loss, metrics_test_accuracy = network.evaluate(testXready, testYready)
  • 45. Design of Deep Learning experiment Define problem What is the purpose Prepare the data Collect data, spilit data, vectorize, reshape, normalize, OHE Define the network architecture architecture Define loss, optimizers Define the metrics, optimizers, loss function, and Compile the model Train the network Train the network Improve power to generalize Evaluate the network, Hypertune Test Test, Predict Deploy Deploy 1 2 3 4 5 6 7 8