SlideShare a Scribd company logo
Keith Moon - Senior iOS Developer
Machine Learning for
iOS Developers
UnitedDefConf - Minsk
April 2017
2
• iOS Developer since 2010
• Worked with BBC News, Hotels.com and Travelex
• “Swift 3 Cookbook” to be published by Pakt
Who am I?
@keefmoon
3
• Help users discover great local food
• Make it quick and easy to order from a wide variety of takeaways
• Available on:
–Web
–iOS
–tvOS
–Android
–Amazon Echo
What is Just Eat?
3
4
• Australia
• Brazil
• Canada
• Denmark
• France
• Ireland
• Italy
• Mexico
What is Just Eat?
Global Business
• New Zealand
• Norway
• Spain
• Switzerland
• UK
7
What this talk isn’t?
• Not a ML expert
• Not a Python expert
• Not great at Maths
• Not a deep dive into ML
So what is this talk?
So what is this talk?
8
• ML from an iOS developer’s point of view
• High level overview of ML
• What features are appropriate uses of ML?
• How can you use ML in your apps?
• Current state of ML tools
• What does the future hold?
Glossary
9
Machine Learning
Artificial Intelligence Neural Network
Deep Learning
Glossary
10
Machine Learning
Artificial Intelligence
Neural Network
Deep Learning
Artificial Intelligence
Glossary
11
Machine Learning
Neural Network
Deep Learning
Artificial Intelligence
Glossary
12
Machine Learning
Neural Network
Deep Learning
Artificial Intelligence
Glossary
13
Machine Learning
Deep Learning
Neural Network
Machine Learning Examples
14
ML Use Cases
15
• Spam
• Recommendations
• Handwriting recognition
• Speech recognition
• Face Detection
• Entity extraction
• Facial Recognition
• Object Recognition
• Text Prediction
• Sentiment Analysis
• Image Style transfer
Machine Learning Goal
16
Neural Network Output Answer
Training Input
Input Question
Classifier
17
Untrained
Neural Network
Training Input
Data
Data
Data
Input to categorise
Category 1
Category 2
Category 3
1
1
2
2
3
3
Classifier
18
Trained
Neural Network
Training Input
Input to categorise
Category 1
Category 2
Category 3
Classifier
19
Neural Network
Input
Input to categorise
Hidden
Training Input
Data
Data
Data
1
2
3
Category 1
Category 2
Category 3
1
2
3
Output
⨍( )
Training the model
20
w1
w2
w3
∑i xi * wi + bx1
x2
x3
b
Forward Propagation
eg. Softmax
Training the model
21
w1
w2
w3
x1
x2
x3
b
Back Propagation
g = gradient
The extent to which
changing the value
reduces the error
g
Difference between
expected and actual
= error
g
g
g
Classifier
22
Neural Network
Input
Input to categorise
Hidden
Training Input
Data
Data
Data
1
2
3
Category 1
Category 2
Category 3
1
2
3
Output
Handwriting Image Input
25
Input
?
?
?
?
from the MNIST dataset
Handwriting Image Input
26
Input
?
?
?
?
14 pixels x 14 pixels 14 x 14 = 196 values
between 0 and 1
Handwriting Image Input
27
Input
14 pixels x 14 pixels 14 x 14 = 196 values
between 0 and 1
…
px 1
px 2
px 3
px 4
px 5
px 6
px 196
Your
App
API
Adding a ML Feature
28
What are my options?
Train
Use
1) Managed Machine Learning driven API
29
• No ML knowledge required
• Simple to implement
• Light on resources
• Only solves common ML problems
• Third-Party dependancy
• Needs connectivity
• Data ownership issues
• No control over model improvement
Adding a ML Feature What are my options?
1) Managed Machine Learning driven API
30
Adding a ML Feature What are my options?
2) Custom Model Trained and Used on Server
Your
App
API
Train
Use
31
• Can customise the model to your
needs
• Make use of open source models
• Light on mobile resources
• You control the data
• You control model improvement
• Knowledge of ML tools / Python
needed
• Server management overhead
• App friendly API needed
• Needs connectivity
Adding a ML Feature What are my options?
2) Custom Model Trained and Used on Server
32
Adding a ML Feature What are my options?
3) Custom Model Trained on Server. Used on Phone.
API
Train
Trained ModelAccelerate
Framework
Metal
Framework
GPU
CPU
33
• Can customise the model to your
needs
• Make use of open source models
• User can control the data
• Can work offline
• Knowledge of ML tools / Python needed
• Server management overhead
• Need to transfer complex model to phone
• May limit the scope of model
improvement
Adding a ML Feature What are my options?
3) Custom Model Trained on Server. Used on Phone.
35
Adding a ML Feature What are my options?
3) Custom Model Trained on Server. Used on Phone.
2) Custom Model Trained and Used on Server
1) Managed Machine Learning driven API
Future of Machine Learning on iOS
● Easier model transfer from server to phone
● Trainable network APIs from Apple
● Ability to plug and play ML models together
● Further development of Swift ML tools
36
References
Machine Learning APIs:
Google Prediction: https://cloud.google.com/prediction
Google Natural Language: https://cloud.google.com/natural-language
Microsoft Cognitive Services: https://www.microsoft.com/cognitive-services
Amazon ML: https://aws.amazon.com/documentation/machine-learning
IBM Watson: https://www.ibm.com/watson/developercloud
Open Source Model:
Tensor Flow Models: https://github.com/tensorflow/models
FaceNet for TensorFlow: https://github.com/davidsandberg/facenet
37
References
Machine Learning Frameworks:
Torch: http://torch.ch
TensorFlow: https://www.tensorflow.org
Caffe: https://github.com/BVLC/caffe
Awesome Machine Learning resources: https://github.com/josephmisiti/awesome-machine-learning
Hosting:
Amazon Web Services: https://aws.amazon.com
Amazon Deep Learning AMI - Ubuntu Edition https://aws.amazon.com/marketplace/pp/B06VSPXKDX
Digital Ocean https://www.digitalocean.com
38
References
Machine Learning Frameworks on iOS:
Torch: https://github.com/clementfarabet/torch-ios
TensorFlow: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/ios_examples
http://www.mattrajca.com/2016/11/25/getting-started-with-deep-mnist-and-tensorflow-on-ios.html
Caffe: https://github.com/noradaiko/caffe-ios-sample
Using Metal Performance Shaders with a TensorFlow trained model:
https://developer.apple.com/library/content/samplecode/MPSCNNHelloWorld
Neural Networks and Accelerate: https://developer.apple.com/videos/play/wwdc2016/715
BNNS in Accelerate: https://developer.apple.com/reference/accelerate/bnns
List of ML resources for iOS: https://github.com/alexsosn/iOS_ML
39
References
Open Source:
Face Entry Example:
https://github.com/keefmoon/faceentry
Just Eat Open Source:
https://github.com/justeat
40
Thanks! @keefmoon
keith.moon@just-eat.com
keefmoon

More Related Content

Similar to Machine Learning for iOS developers

Embedded systems robotics and this mva training series
Embedded systems robotics and this mva training seriesEmbedded systems robotics and this mva training series
Embedded systems robotics and this mva training series
Nitin Mulchandani
 
Strata London - Deep Learning 05-2015
Strata London - Deep Learning 05-2015Strata London - Deep Learning 05-2015
Strata London - Deep Learning 05-2015
Turi, Inc.
 
Persian MNIST in 5 Minutes
Persian MNIST in 5 MinutesPersian MNIST in 5 Minutes
Persian MNIST in 5 Minutes
Shahriar Yazdipour
 
Resume_Mayur_Jadhav
Resume_Mayur_JadhavResume_Mayur_Jadhav
Resume_Mayur_Jadhav
Mayur Jadhav
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View Control
Teamstudio
 
Geotech presentation 2012
Geotech presentation 2012Geotech presentation 2012
Geotech presentation 2012
Pradipta Sen
 
AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...
AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...
AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...
Amazon Web Services
 
Siddha Ganju. Deep learning on mobile
Siddha Ganju. Deep learning on mobileSiddha Ganju. Deep learning on mobile
Siddha Ganju. Deep learning on mobile
Lviv Startup Club
 
Siddha Ganju, NVIDIA. Deep Learning for Mobile
Siddha Ganju, NVIDIA. Deep Learning for MobileSiddha Ganju, NVIDIA. Deep Learning for Mobile
Siddha Ganju, NVIDIA. Deep Learning for Mobile
IT Arena
 
Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...
Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...
Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...
Databricks
 
Introduction to Software Engineering Notes
Introduction to Software Engineering NotesIntroduction to Software Engineering Notes
Introduction to Software Engineering Notes
Dr Anuranjan Misra
 
Combining Machine Learning with Physical Computing - June 2023
Combining Machine Learning with Physical Computing - June 2023Combining Machine Learning with Physical Computing - June 2023
Combining Machine Learning with Physical Computing - June 2023
Hal Speed
 
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Unity and Microsoft Azure Cognitive Services - DIGITREK21 WorkshopUnity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Pablo Farías Navarro
 
Generative AI at the edge.pdf
Generative AI at the edge.pdfGenerative AI at the edge.pdf
Generative AI at the edge.pdf
Qualcomm Research
 
201906 02 Introduction to AutoML with ML.NET 1.0
201906 02 Introduction to AutoML with ML.NET 1.0201906 02 Introduction to AutoML with ML.NET 1.0
201906 02 Introduction to AutoML with ML.NET 1.0
Mark Tabladillo
 
Designing Cross-Domain Semantic Web of Things Applications
Designing Cross-Domain Semantic Web of Things ApplicationsDesigning Cross-Domain Semantic Web of Things Applications
Designing Cross-Domain Semantic Web of Things Applications
Amélie Gyrard
 
Machine Learning with Data Science Online Course | Learn and Build
 Machine Learning with Data Science Online Course | Learn and Build  Machine Learning with Data Science Online Course | Learn and Build
Machine Learning with Data Science Online Course | Learn and Build
Learn and Build
 
AI at Microsoft for HEC
AI at Microsoft for HECAI at Microsoft for HEC
AI at Microsoft for HEC
Alex Danvy
 
Artificial intelligence in android development
Artificial intelligence in android developmentArtificial intelligence in android development
Artificial intelligence in android development
anikeshkumar11
 
Internet trends and ICT knowledge necessary in the next years - 2013 ed.
Internet trends and ICT knowledge necessary in the next years - 2013 ed.Internet trends and ICT knowledge necessary in the next years - 2013 ed.
Internet trends and ICT knowledge necessary in the next years - 2013 ed.
Antonio Ciccarelli, PMP
 

Similar to Machine Learning for iOS developers (20)

Embedded systems robotics and this mva training series
Embedded systems robotics and this mva training seriesEmbedded systems robotics and this mva training series
Embedded systems robotics and this mva training series
 
Strata London - Deep Learning 05-2015
Strata London - Deep Learning 05-2015Strata London - Deep Learning 05-2015
Strata London - Deep Learning 05-2015
 
Persian MNIST in 5 Minutes
Persian MNIST in 5 MinutesPersian MNIST in 5 Minutes
Persian MNIST in 5 Minutes
 
Resume_Mayur_Jadhav
Resume_Mayur_JadhavResume_Mayur_Jadhav
Resume_Mayur_Jadhav
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View Control
 
Geotech presentation 2012
Geotech presentation 2012Geotech presentation 2012
Geotech presentation 2012
 
AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...
AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...
AWS re:Invent 2016: Deep Learning at Cloud Scale: Improving Video Discoverabi...
 
Siddha Ganju. Deep learning on mobile
Siddha Ganju. Deep learning on mobileSiddha Ganju. Deep learning on mobile
Siddha Ganju. Deep learning on mobile
 
Siddha Ganju, NVIDIA. Deep Learning for Mobile
Siddha Ganju, NVIDIA. Deep Learning for MobileSiddha Ganju, NVIDIA. Deep Learning for Mobile
Siddha Ganju, NVIDIA. Deep Learning for Mobile
 
Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...
Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...
Bringing an AI Ecosystem to the Domain Expert and Enterprise AI Developer wit...
 
Introduction to Software Engineering Notes
Introduction to Software Engineering NotesIntroduction to Software Engineering Notes
Introduction to Software Engineering Notes
 
Combining Machine Learning with Physical Computing - June 2023
Combining Machine Learning with Physical Computing - June 2023Combining Machine Learning with Physical Computing - June 2023
Combining Machine Learning with Physical Computing - June 2023
 
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Unity and Microsoft Azure Cognitive Services - DIGITREK21 WorkshopUnity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
 
Generative AI at the edge.pdf
Generative AI at the edge.pdfGenerative AI at the edge.pdf
Generative AI at the edge.pdf
 
201906 02 Introduction to AutoML with ML.NET 1.0
201906 02 Introduction to AutoML with ML.NET 1.0201906 02 Introduction to AutoML with ML.NET 1.0
201906 02 Introduction to AutoML with ML.NET 1.0
 
Designing Cross-Domain Semantic Web of Things Applications
Designing Cross-Domain Semantic Web of Things ApplicationsDesigning Cross-Domain Semantic Web of Things Applications
Designing Cross-Domain Semantic Web of Things Applications
 
Machine Learning with Data Science Online Course | Learn and Build
 Machine Learning with Data Science Online Course | Learn and Build  Machine Learning with Data Science Online Course | Learn and Build
Machine Learning with Data Science Online Course | Learn and Build
 
AI at Microsoft for HEC
AI at Microsoft for HECAI at Microsoft for HEC
AI at Microsoft for HEC
 
Artificial intelligence in android development
Artificial intelligence in android developmentArtificial intelligence in android development
Artificial intelligence in android development
 
Internet trends and ICT knowledge necessary in the next years - 2013 ed.
Internet trends and ICT knowledge necessary in the next years - 2013 ed.Internet trends and ICT knowledge necessary in the next years - 2013 ed.
Internet trends and ICT knowledge necessary in the next years - 2013 ed.
 

Recently uploaded

Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
GDSC PJATK
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 

Recently uploaded (20)

Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 

Machine Learning for iOS developers

  • 1. Keith Moon - Senior iOS Developer Machine Learning for iOS Developers UnitedDefConf - Minsk April 2017
  • 2. 2 • iOS Developer since 2010 • Worked with BBC News, Hotels.com and Travelex • “Swift 3 Cookbook” to be published by Pakt Who am I? @keefmoon
  • 3. 3 • Help users discover great local food • Make it quick and easy to order from a wide variety of takeaways • Available on: –Web –iOS –tvOS –Android –Amazon Echo What is Just Eat? 3
  • 4. 4 • Australia • Brazil • Canada • Denmark • France • Ireland • Italy • Mexico What is Just Eat? Global Business • New Zealand • Norway • Spain • Switzerland • UK
  • 5. 7 What this talk isn’t? • Not a ML expert • Not a Python expert • Not great at Maths • Not a deep dive into ML So what is this talk?
  • 6. So what is this talk? 8 • ML from an iOS developer’s point of view • High level overview of ML • What features are appropriate uses of ML? • How can you use ML in your apps? • Current state of ML tools • What does the future hold?
  • 13. ML Use Cases 15 • Spam • Recommendations • Handwriting recognition • Speech recognition • Face Detection • Entity extraction • Facial Recognition • Object Recognition • Text Prediction • Sentiment Analysis • Image Style transfer
  • 14. Machine Learning Goal 16 Neural Network Output Answer Training Input Input Question
  • 15. Classifier 17 Untrained Neural Network Training Input Data Data Data Input to categorise Category 1 Category 2 Category 3 1 1 2 2 3 3
  • 16. Classifier 18 Trained Neural Network Training Input Input to categorise Category 1 Category 2 Category 3
  • 17. Classifier 19 Neural Network Input Input to categorise Hidden Training Input Data Data Data 1 2 3 Category 1 Category 2 Category 3 1 2 3 Output
  • 18. ⨍( ) Training the model 20 w1 w2 w3 ∑i xi * wi + bx1 x2 x3 b Forward Propagation eg. Softmax
  • 19. Training the model 21 w1 w2 w3 x1 x2 x3 b Back Propagation g = gradient The extent to which changing the value reduces the error g Difference between expected and actual = error g g g
  • 20. Classifier 22 Neural Network Input Input to categorise Hidden Training Input Data Data Data 1 2 3 Category 1 Category 2 Category 3 1 2 3 Output
  • 22. Handwriting Image Input 26 Input ? ? ? ? 14 pixels x 14 pixels 14 x 14 = 196 values between 0 and 1
  • 23. Handwriting Image Input 27 Input 14 pixels x 14 pixels 14 x 14 = 196 values between 0 and 1 … px 1 px 2 px 3 px 4 px 5 px 6 px 196
  • 24. Your App API Adding a ML Feature 28 What are my options? Train Use 1) Managed Machine Learning driven API
  • 25. 29 • No ML knowledge required • Simple to implement • Light on resources • Only solves common ML problems • Third-Party dependancy • Needs connectivity • Data ownership issues • No control over model improvement Adding a ML Feature What are my options? 1) Managed Machine Learning driven API
  • 26. 30 Adding a ML Feature What are my options? 2) Custom Model Trained and Used on Server Your App API Train Use
  • 27. 31 • Can customise the model to your needs • Make use of open source models • Light on mobile resources • You control the data • You control model improvement • Knowledge of ML tools / Python needed • Server management overhead • App friendly API needed • Needs connectivity Adding a ML Feature What are my options? 2) Custom Model Trained and Used on Server
  • 28. 32 Adding a ML Feature What are my options? 3) Custom Model Trained on Server. Used on Phone. API Train Trained ModelAccelerate Framework Metal Framework GPU CPU
  • 29. 33 • Can customise the model to your needs • Make use of open source models • User can control the data • Can work offline • Knowledge of ML tools / Python needed • Server management overhead • Need to transfer complex model to phone • May limit the scope of model improvement Adding a ML Feature What are my options? 3) Custom Model Trained on Server. Used on Phone.
  • 30. 35 Adding a ML Feature What are my options? 3) Custom Model Trained on Server. Used on Phone. 2) Custom Model Trained and Used on Server 1) Managed Machine Learning driven API
  • 31. Future of Machine Learning on iOS ● Easier model transfer from server to phone ● Trainable network APIs from Apple ● Ability to plug and play ML models together ● Further development of Swift ML tools 36
  • 32. References Machine Learning APIs: Google Prediction: https://cloud.google.com/prediction Google Natural Language: https://cloud.google.com/natural-language Microsoft Cognitive Services: https://www.microsoft.com/cognitive-services Amazon ML: https://aws.amazon.com/documentation/machine-learning IBM Watson: https://www.ibm.com/watson/developercloud Open Source Model: Tensor Flow Models: https://github.com/tensorflow/models FaceNet for TensorFlow: https://github.com/davidsandberg/facenet 37
  • 33. References Machine Learning Frameworks: Torch: http://torch.ch TensorFlow: https://www.tensorflow.org Caffe: https://github.com/BVLC/caffe Awesome Machine Learning resources: https://github.com/josephmisiti/awesome-machine-learning Hosting: Amazon Web Services: https://aws.amazon.com Amazon Deep Learning AMI - Ubuntu Edition https://aws.amazon.com/marketplace/pp/B06VSPXKDX Digital Ocean https://www.digitalocean.com 38
  • 34. References Machine Learning Frameworks on iOS: Torch: https://github.com/clementfarabet/torch-ios TensorFlow: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/ios_examples http://www.mattrajca.com/2016/11/25/getting-started-with-deep-mnist-and-tensorflow-on-ios.html Caffe: https://github.com/noradaiko/caffe-ios-sample Using Metal Performance Shaders with a TensorFlow trained model: https://developer.apple.com/library/content/samplecode/MPSCNNHelloWorld Neural Networks and Accelerate: https://developer.apple.com/videos/play/wwdc2016/715 BNNS in Accelerate: https://developer.apple.com/reference/accelerate/bnns List of ML resources for iOS: https://github.com/alexsosn/iOS_ML 39
  • 35. References Open Source: Face Entry Example: https://github.com/keefmoon/faceentry Just Eat Open Source: https://github.com/justeat 40

Editor's Notes

  1. Quickly demo MSQRD Talk about face detection, position, rotation in 3D space
  2. Select use cases are classification problems. They take a given input and the problem involves deciding which category to put the answer in, and how well do they fit into that category. There is finite number of the categories. For spam is either spam, or not spam For handwriting recognition the category is a letter or word, for facial recognition it is a specific person.
  3. Lets look at how would use a neural network to do machine learning. We want to train a neural network to get good at turning inputs into outputs with known data, so that it can use do the same with inputs where we don’t know the expected output. What does that mean, to train the network?
  4. Let’s talk specifically about using a neural network to work on a classification problem. We feed data into one end of the neural network, and we expect those inputs to produce an expected output category, if it doesn’t, we need to neural network until it does. Do that with enough data, and the network becomes good at putting the right type of data in the right categories.
  5. Now that we have a trained network, we put in data where we don’t know the category it belongs in, and the network uses the accumulated information from it’s training to produce the right category as an output. Ok, but what is a neural network’s structure?
  6. Like any other network, a neural network is made up of nodes and connections. Neural Networks are organised in layers. Often with all the nodes in one layer connected to all the nodes in the next layer. The input layer receives in input data, we will get to how that happens soon. Information then passes to a number of hidden layer. Called hidden because they aren’t related to input of output. Deep learning, a term we discussed early, refers to how deep the network is, or how many hidden layers there are.
  7. Define: Model - The structure of the neural network Trained Model - The structure + the weights and bias’ determined during training
  8. Define: Model - The structure of the neural network Trained Model - The structure + the weights and bias’ determined during training
  9. Like any other network, a neural network is made up of nodes and connections. Neural Networks are organised in layers. Often with all the nodes in one layer connected to all the nodes in the next layer. The input layer receives in input data, we will get to how that happens soon. Information then passes to a number of hidden layer. Called hidden because they aren’t related to input of output. Deep learning, a term we discussed early, refers to how deep the network is, or how many hidden layers there are.
  10. Define: Model - The structure of the neural network Trained Model - The structure + the weights and bias’ determined during training
  11. Show FaceEntry to explain input preparation
  12. Define: Model - The structure of the neural network Trained Model - The structure + the weights and bias’ determined during training
  13. Define: Model - The structure of the neural network Trained Model - The structure + the weights and bias’ determined during training
  14. Define: Model - The structure of the neural network Trained Model - The structure + the weights and bias’ determined during training
  15. Show FaceEntry as an example
  16. Show MNIST on AWS as example