Contenu connexe Similaire à Developing Sophisticated Serverless Applications with AI (20) Plus de Adrian Hornsby (18) Developing Sophisticated Serverless Applications with AI1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Adrian Hornsby, Technical Evangelist
http://inserverless.com - 2017
Developing Sophisticated
Serverless Applications with AI
2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Technical Evangelist, Developer Advocate,
… Software Engineer
• Own bed in Finland
• Previously:
• Solutions Architect @AWS
• Lead Cloud Architect @Dreambroker
• Director of Engineering, Software Engineer, DevOps, Manager, ... @Hdm
• Researcher @Nokia Research Center
• and a bunch of other stuff.
• Climber, like Ginger shots.
3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What to expect
• Quick intro
• 3 demo applications
• Polly
• Rekognition
• MXnet
• Wrap up.
4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AI and Serverless
…like Salt and Pepper
5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Event driven
A B CEvent on B by A triggers C
Invocation
Lambda functions
Action
6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How Lambda works
S3 event
notifications
DynamoDB
Streams
Kinesis
events
Cognito
events
SNS
events
Custom
events
CloudTrail
events
LambdaDynamoDB
Kinesis S3
Any custom
Invoked in response to events
- Changes in data
- Changes in state
Redshift
SNS
Access any service,
including your own
Such as…
Lambda functions
CloudWatch
events
7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Event-driven using Lambda
AWS Lambda:
Resize Images
Users upload photos
S3:
Source Bucket
S3:
Destination Bucket
Triggered on
PUTs
8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
No servers to provision
or manage
Scales with usage
Never pay for idle Availability and fault
tolerance built in
Serverless means…
9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EVENT DRIVEN CONTINUOUS SCALING PAY BY USAGE
Serverless means…
10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
The rise of AI
11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
The Advent of AI & Deep Learning
Data
GPUs
& Acceleration
Cloud
Computing
Algorithms
AWS
12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AI On AWS Today
14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AI & Deep Learning in the hands of every developer
15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Voice enabled applications
16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Polly: Text In, Life-like Speech Out
Amazon Polly
“Today in Seattle, WA
it’s 11°F”
“Today in Seattle Washington
it’s 11 degrees Fahrenheit”
17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
https://www.w3.org/TR/speech-synthesis/
<speak>
The spelling of my name is
<prosody rate='x-slow'>
<say-as interpret-as="characters">Adrian</say-as>
</prosody>
</speak>
A Focus On Voice Quality & Pronunciation
18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
<API>
Amazon Polly
</API>
aws polly synthesize-speech
--text "It was nice to live such a wonderful live show"
--output-format mp3
--voice-id Joanna
--text-type text johanna.mp3
19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
<demo>
PollyCast
</demo>
* Initial project by James Siri, Piotr Lewalski
https://github.com/adhorn/pollycast
22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Image analysis
23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon
Rekognition
Object and scene detection
Facial analysis
Face comparison
Celebrity recognition
Image moderation
Rekognition: Images In, Rich Metadata Out
24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
<API>
Amazon Rekognition
</API>
aws rekognition detect-faces
--image '{"S3Object":{"Bucket":"adhorn-reko","Name":"horse.jpg"}}'
--attributes "ALL"
aws rekognition detect-labels
--image '{"S3Object":{"Bucket":"adhorn-reko","Name":"horse.jpg"}}'
25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Detect labels with
Rekognition
28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Add
Rekognition tags
29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Extract Image
Metadata
30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Step Functions:
Orchestrate a Serverless processing
workflow using AWS Lambda
31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
<demo>
Image Recognition and Processing Backend
Step Functions
</demo>
https://github.com/awslabs/lambda-refarch-imagerecognition
32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
<demo>
Image Recognition and Processing Backend
Step Functions
</demo>
https://github.com/awslabs/lambda-refarch-imagerecognition
33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
<demo>
Poliko
powered by Amazon Polly & Rekognition
</demo>
http://poliko.adhorn.me
34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Demo - Poliko
Poliko
Take Pic
Amazon Cognito
2. Detect Labels
4. Synthesize-speech
Amazon Rekognition
Amazon Polly
3. Detect Faces
Amazon S3
“Static website hosting” enabled
35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Deep Learning enabled applications
36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
One-Click
Deep Learning
AWS Deep Learning AMIs
Amazon Linux & Ubuntu
Up to~40k CUDA cores
Apache MXNet
TensorFlow
Theano
Keras
Caffe
CNTK
Torch
Pre-configured CUDA drivers
Anaconda, Python3
Out-of-the-box Tutorials
+ CloudFormation template
+ Container Image
Available in the AWS Marketplace
AI Frameworks on AWS
37. 0.2
-0.1
...
0.7
Input Output
1 1 1
1 0 1
0 0 0
3
mx.sym.Pooling(data, pool_type="max", kernel=(2,2), stride=(2,2)
lstm.lstm_unroll(num_lstm_layer, seq_len, len, num_hidden, num_embed)
4 2
2 0
4=Max
1
3
...
4
0.2
-0.1
...
0.7
mx.sym.FullyConnected(data, num_hidden=128)
2
mx.symbol.Embedding(data, input_dim, output_dim = k)
Queen
4 2
2 0
2=Avg
Input Weights
cos(w, queen) = cos(w, king) - cos(w, man) + cos(w, woman)
mx.sym.Activation(data, act_type="xxxx")
"relu"
"tanh"
"sigmoid"
"softrelu"
Neural Art
Face Search
Image Segmentation
Image Caption
“People Riding Bikes”
Bicycle, People,
Road, Sport
Image Labels
Image
Video
Speech
Text
“People Riding Bikes”
Machine Translation
“Οι άνθρωποι
ιππασίας ποδήλατα”
Events
mx.model.FeedForward model.fit
mx.sym.SoftmaxOutput
Anatomy of a Deep Learning Model
mx.sym.Convolution(data, kernel=(5,5), num_filter=20)
38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Early detection of diabetic
complications
39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Autonomous Driving Systems
40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Real Time, Per Pixel Object Segmentation
41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Pre-trained MXNet
models
http://data.mxnet.io/models/imagenet/
42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ResNet – Deep Learning
Based on:
Deep Residual Learning for Image Recognition
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
https://arxiv.org/pdf/1512.03385.pdf
https://medium.com/towards-data-science/neural-network-architectures-156e5bad51ba
43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scale Predictions with AWS Lambda and MXNet
AWS LambdaAmazon
API Gateway
Amazon S3
Training
Inference
https://aws.amazon.com/blogs/compute/seamlessly-scale-predictions-with-aws-lambda-and-mxnet/
44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Predict with AWS Lambda
45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Predict with AWS Lambda
46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Predict with AWS Lambda
47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Predict with AWS Lambda
48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AI for everyone!
49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thanks you!