SlideShare a Scribd company logo
1 of 32
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deep Learning for Developers:
An Introduction
Lai Wei
Software Engineer– Deep Learning
Amazon Web Services
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
• Deep learning is a big deal!
• Brief introduction to deep learning
• Starting to code neural networks
• Hands on example: training to
inference
By the end of this session, you
will understand what deep
learning is, and how you can
start using it today!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
“Deep Learning is a superpower.
With it you can make a computer see,
synthesize novel art, translate language
... If that isn’t a superpower, I don’t know
what is.”
– Andrew Ng
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Artificial
intelligence
Machine
learning
Deep
learning
Can machines think?
Can machines do what we can?
(Turing, 1950)
Machine Learning
Data
Answers
Rules
Traditional
programming
Data
Rules
Answers
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deep learning is a big deal
It has a growing impact on our lives
Personalization Logistics Voice
Autonomous
vehicles
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deep learning is a big deal
It is able to do better than humans
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Inspired by the brain’s neurons
We have ~100B of them, and ~1Q synapses
ANN is a simple computation construct:
w1
w2
wn
x1
x2
xn
Σ φ 𝑦
…
𝑦 = 𝜑(
đť‘—=1
đť‘›
𝑤𝑗 𝑥𝑗)
Artificialneurons
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fullyconnected layer
Networks are comprised of
stacked layers (mostly)
Composed of artificial neurons,
each fully connected to the
previous layer, and to the next
Connections have an associated
“weight” learned during training
Fully connected
layer
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Convolution layer
Operator is “sliding” a kernel
across the input, computing
value at each position in the
output tensor
The kernel values are the
learned parameters of the layer
Convolution layers are effective
in perceptual problems involving
visual data
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Convolution layer
When combined across multiple layers, convolution is able to
learn hierarchical features, with increasing levels of abstraction
Layer 1 – Edges Layer 2 – Curves
Layer N –
Classes
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Recurrent neural networklayer
In some problems, predicting a given
point in time depends on input
context from an earlier time
RNN layer “remembers the past” –
using loops!
RNNs are effective for time series
and natural language problems
A
X
y
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Recurrent neural networklayer
We can “unroll” an RNN layer to understand how it works
A
x0
h0
A
x1
h1
A
x2
h2
A
xt
ht
…A
X
y
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Neuralnetwork
Output
layer
Input
layer
Hidden
layers
ManyMore…
• Non-linear
• Hierarchical
feature learning
• Scalable architecture
• Computationally
intensive
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Forward pass
Backwards pass
Input Data
Neural
Network
Output
Loss
Back
Propagate
Update
Weights
Forward-backward repeats across multiple epochs, each
epoch goes through the entire training dataset.
Training neural networks
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thefirststepistosetup adev environment
Amazon
SageMaker
AWS Deep
Learning AMI
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building aneural networkfor imageclassification
live example
0.86
-1.08
-0.95
-0.93
-1.02
-1.05
-1.10
-0.95
-0.95
-0.85
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building aneural networkfor imageclassification
from mxnet.gluon import nn
net = nn.Sequential()
net.add(nn.Conv2D(channels=6, kernel_size=5, activation='relu'),
nn.MaxPool2D(pool_size=2, strides=2),
nn.Conv2D(channels=16, kernel_size=3, activation='relu'),
nn.MaxPool2D(pool_size=2, strides=2),
nn.Flatten(),
nn.Dense(120, activation="relu"),
nn.Dense(84, activation="relu"),
nn.Dense(10))
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Training aneural networkfor image classification
loss_function = gluon.loss.SoftmaxCrossEntropyLoss()
trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': 0.1})
for epoch in range(num_epochs):
for X, Y in train_data:
with autograd.record():
Y_hat = net(X)
loss = loss_function(Y_hat, Y)
loss.backward()
trainer.step(batch_size)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using apre-trained model
Model zoo for vision,
NLU, and more…
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Using apre-trained model
# Loading a pre-trained model
from mxnet.gluon.model_zoo import vision
model = vision.resnet18_v1(pretrained=True)
# Invoking inference on an input tensor x
output = model(x)
# Computing probabilities, and extracting the top 5 classes
output.softmax().topk(k=5)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deploying atrained model
Deploying
trained models
Amazon SageMaker – Cloud
AWS Greengrass – IoT
Amazon EC2
Amazon ECS
Mobile or Edge devices
Your own solution
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Inference on non-Python stacks
// Set the CPU context
List<Context> context = Arrays.asList(Context.cpu());
// Initialize the input descriptor
List<DataDesc> inputDesc = Arrays.asList(
new DataDesc("data", new Shape(new int[]{1, 3, 224, 224}), DType.Float32(), "NCHW"));
// Initialize the model predictor
Predictor predictor = new Predictor(app.modelPathPrefix, inputDesc, context, 0);
// Prepare input image
BufferedImage img = resizeImage(loadImageFromFile(app.inputImagePath), 224, 224);
// predict
float[][] result = predictor.predict(new float[][]{imagePreprocess(img)});
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GettingStartedwithDeep Learning
Personalization Logistics Voice
Autonomous
Vehicles
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GettingStartedwithDeep Learning
Finance Cyber RoboticsHealthcare
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Getting startedwithdeep learning
http://gluon-crash-course.mxnet.io
http://mxnet.io
http://aws.amazon.com/sagemaker/
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
https://github.com/TalkAI/facial-emotion-recognition-gluon
Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lai Wei
Software Engineer– Deep Learning
Amazon Web Services

More Related Content

Recently uploaded

Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 

Recently uploaded (20)

Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 

Featured

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data ScienceChristy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slidesAlireza Esmikhani
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Deep learning for developers

  • 1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Deep Learning for Developers: An Introduction Lai Wei Software Engineer– Deep Learning Amazon Web Services
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda • Deep learning is a big deal! • Brief introduction to deep learning • Starting to code neural networks • Hands on example: training to inference By the end of this session, you will understand what deep learning is, and how you can start using it today!
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 4. “Deep Learning is a superpower. With it you can make a computer see, synthesize novel art, translate language ... If that isn’t a superpower, I don’t know what is.” – Andrew Ng
  • 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Artificial intelligence Machine learning Deep learning Can machines think? Can machines do what we can? (Turing, 1950) Machine Learning Data Answers Rules Traditional programming Data Rules Answers
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Deep learning is a big deal It has a growing impact on our lives Personalization Logistics Voice Autonomous vehicles
  • 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Deep learning is a big deal It is able to do better than humans
  • 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Inspired by the brain’s neurons We have ~100B of them, and ~1Q synapses ANN is a simple computation construct: w1 w2 wn x1 x2 xn ÎŁ φ 𝑦 … 𝑦 = đťś‘( đť‘—=1 đť‘› 𝑤𝑗 đť‘Ąđť‘—) Artificialneurons
  • 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Fullyconnected layer Networks are comprised of stacked layers (mostly) Composed of artificial neurons, each fully connected to the previous layer, and to the next Connections have an associated “weight” learned during training Fully connected layer
  • 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Convolution layer Operator is “sliding” a kernel across the input, computing value at each position in the output tensor The kernel values are the learned parameters of the layer Convolution layers are effective in perceptual problems involving visual data
  • 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Convolution layer When combined across multiple layers, convolution is able to learn hierarchical features, with increasing levels of abstraction Layer 1 – Edges Layer 2 – Curves Layer N – Classes
  • 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Recurrent neural networklayer In some problems, predicting a given point in time depends on input context from an earlier time RNN layer “remembers the past” – using loops! RNNs are effective for time series and natural language problems A X y
  • 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Recurrent neural networklayer We can “unroll” an RNN layer to understand how it works A x0 h0 A x1 h1 A x2 h2 A xt ht …A X y
  • 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Neuralnetwork Output layer Input layer Hidden layers ManyMore… • Non-linear • Hierarchical feature learning • Scalable architecture • Computationally intensive
  • 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Forward pass Backwards pass Input Data Neural Network Output Loss Back Propagate Update Weights Forward-backward repeats across multiple epochs, each epoch goes through the entire training dataset. Training neural networks
  • 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thefirststepistosetup adev environment Amazon SageMaker AWS Deep Learning AMI
  • 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building aneural networkfor imageclassification live example 0.86 -1.08 -0.95 -0.93 -1.02 -1.05 -1.10 -0.95 -0.95 -0.85
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building aneural networkfor imageclassification from mxnet.gluon import nn net = nn.Sequential() net.add(nn.Conv2D(channels=6, kernel_size=5, activation='relu'), nn.MaxPool2D(pool_size=2, strides=2), nn.Conv2D(channels=16, kernel_size=3, activation='relu'), nn.MaxPool2D(pool_size=2, strides=2), nn.Flatten(), nn.Dense(120, activation="relu"), nn.Dense(84, activation="relu"), nn.Dense(10))
  • 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Training aneural networkfor image classification loss_function = gluon.loss.SoftmaxCrossEntropyLoss() trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': 0.1}) for epoch in range(num_epochs): for X, Y in train_data: with autograd.record(): Y_hat = net(X) loss = loss_function(Y_hat, Y) loss.backward() trainer.step(batch_size)
  • 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Using apre-trained model Model zoo for vision, NLU, and more…
  • 25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Using apre-trained model # Loading a pre-trained model from mxnet.gluon.model_zoo import vision model = vision.resnet18_v1(pretrained=True) # Invoking inference on an input tensor x output = model(x) # Computing probabilities, and extracting the top 5 classes output.softmax().topk(k=5)
  • 26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Deploying atrained model Deploying trained models Amazon SageMaker – Cloud AWS Greengrass – IoT Amazon EC2 Amazon ECS Mobile or Edge devices Your own solution
  • 27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Inference on non-Python stacks // Set the CPU context List<Context> context = Arrays.asList(Context.cpu()); // Initialize the input descriptor List<DataDesc> inputDesc = Arrays.asList( new DataDesc("data", new Shape(new int[]{1, 3, 224, 224}), DType.Float32(), "NCHW")); // Initialize the model predictor Predictor predictor = new Predictor(app.modelPathPrefix, inputDesc, context, 0); // Prepare input image BufferedImage img = resizeImage(loadImageFromFile(app.inputImagePath), 224, 224); // predict float[][] result = predictor.predict(new float[][]{imagePreprocess(img)});
  • 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GettingStartedwithDeep Learning Personalization Logistics Voice Autonomous Vehicles
  • 29. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GettingStartedwithDeep Learning Finance Cyber RoboticsHealthcare
  • 30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Getting startedwithdeep learning http://gluon-crash-course.mxnet.io http://mxnet.io http://aws.amazon.com/sagemaker/
  • 31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. https://github.com/TalkAI/facial-emotion-recognition-gluon
  • 32. Thank you! © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lai Wei Software Engineer– Deep Learning Amazon Web Services