SlideShare a Scribd company logo
⚔Bringing TensorFlow To Android - a War Story⚔
YoniTsafir, DroidconTel-Aviv 2017
About Me 🤓
• Tech Lead @
• Mobile Developer, new to ML
• https://medium.com/@theyonibomber/
• Twitter: @theyonibomber
Simply Piano 🎹
• Teaches the world to play piano
• Works with any piano or keyboard
• iOS: 2015,Android: 2017
• Google 💗,“Best Apps of 2017”
• Technically interesting: UX, rendering,
audio and ML challenges
Machine Learning in Simply Piano 🤖
Deep Learning acoustic engine for recognizing notes:
• Polyphonic, with background music and in noisy environments
• Cutting-edge ML concepts
• Low latency, real-time performance
Why on-device ML? 📱
• Real-time
• Network issues
• Cheap processing power
• Example apps: GoogleTranslate, Not Hotdog
https://play.google.com/store/apps/details?id=com.seefoodtechnologies.nothotdog&hl=en
https://play.google.com/store/apps/details?id=com.google.android.apps.translate&hl=en
Our Old Solution 🐢
• Implement model in code
• Some 3rd parties for acceleration, but most of heavy-lifting ourselves
• Unlike iOS: performance & audio issues => smaller model & worse results
• New model implementation takes weeks
• Differences between research and production
What Is TensorFlow? 🤔
• Google’s Open Source ML framework
• Used in out research environment
• Usually:“TensorFlow Serving”
• Can also be compiled to mobile…
TensorFlow in Production -
Motivation )
• From research to production: trivial
• Reduce implementation diff
‣ Except for frame rate & pre/post-processing
• Better optimization => Better performance
Our New Solution 🐇
• Obtain frozenTensorFlow model (.pb)
• Add to .apk or download
• AddTensorFlow libs
• Run model:
// Initialize
tensorflow = new TensorFlowInferenceInterface(assetManager, modelFileName);
// Run single inference
tensorflow.feed("input", input, shape);
tensorflow.run(new String[] {"output"});
tensorflow.fetch("output", output);
TensorFlow Libs - Then (Mar 2017) +
• Clone & compile
• Little documentation, hard to troubleshoot
• Didn’t support all required Ops
• Specific NDK version must be used
• A guide written in blood 💉

http://joytun.es/tf-guide
TensorFlow Libs - Today -
• Since 1.2.0, available via Gradle:

compile('org.tensorflow:tensorflow-android:1.2.0')
• November 2017,TF Lite developer beta:
‣ Optimized for mobile
‣ Needs conversion to .tflite
‣ Subset of architectures and Ops
• We still compile, but you probably don’t have to!
https://techcrunch.com/2017/05/17/googles-tensorflow-lite-brings-machine-learning-to-android-devices/
APK Size: Selective Registration 🔍
Build -> Analyze APK…
~16MB
~6MB
61% Saved
Step I - Compare Same Model ⚖
• Branch withTF-based infra
• Manual testing: up to x4 faster
• Rollout to 50% in Play Console
• Compare major KPIs across a few weeks (conversion, % course completion)
Step I - Results 📊
• At first, old solution = 10% better conversion 😣
• Reasons:
‣ JNI leak
‣ Model wasTOO fast!
• After fix - slight advantage toTF impl.
https://www.klipfolio.com/resources/articles/what-is-digital-dashboard
Next Up - New Model Pipeline 2
• Test in research environment => Candidate
• Android based debug tool (in development)
• Infra improvements? 

Staged rollout on same model
• Same Infra? 

Our internal A/B testing framework on various models
The War Is Not Over 3
• A performance bug I opened a few days ago:
• To be continued…
TF 1.0.1
TF 1.4.0
4Questions? 5

More Related Content

Similar to Bringing TensorFlow to Android - a War Story

Introduction to TensorFlow Lite
Introduction to TensorFlow Lite Introduction to TensorFlow Lite
Introduction to TensorFlow Lite
Koan-Sin Tan
 
TFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU DelegatesTFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU Delegates
Koan-Sin Tan
 
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite PreviewMachine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Modulabs
 
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
NCCOMMS
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium IntroNicholas Jansma
 
Machine Learning in Google I/O 19
Machine Learning in Google I/O 19Machine Learning in Google I/O 19
Machine Learning in Google I/O 19
Jeongkyu Shin
 
Docker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatternsDocker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatterns
Lenses.io
 
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
Joseph Labrecque
 
How to Choose a Deep Learning Framework
How to Choose a Deep Learning FrameworkHow to Choose a Deep Learning Framework
How to Choose a Deep Learning Framework
Navid Kalaei
 
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Holden Karau
 
Introducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applicationsIntroducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applications
Rokesh Jankie
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to Titanium
Graham Weldon
 
Delta Engine @ CeBit 2011
Delta Engine @ CeBit 2011Delta Engine @ CeBit 2011
Delta Engine @ CeBit 2011
Karsten Wysk
 
The Ring programming language version 1.10 book - Part 6 of 212
The Ring programming language version 1.10 book - Part 6 of 212The Ring programming language version 1.10 book - Part 6 of 212
The Ring programming language version 1.10 book - Part 6 of 212
Mahmoud Samir Fayed
 
Presentation of programming languages for beginners
Presentation of programming languages for beginnersPresentation of programming languages for beginners
Presentation of programming languages for beginners
Clement Levallois
 
Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets
Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile PoetsMobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets
Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets
MobileFest2018
 
ECMFA 2018 - Keynote : The future of modeling tools
ECMFA 2018 - Keynote : The future of modeling toolsECMFA 2018 - Keynote : The future of modeling tools
ECMFA 2018 - Keynote : The future of modeling tools
melbats
 
Info Session GDSC USICT
Info Session GDSC USICTInfo Session GDSC USICT
Info Session GDSC USICT
DSCUSICT
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
Heiko Voigt
 

Similar to Bringing TensorFlow to Android - a War Story (20)

Introduction to TensorFlow Lite
Introduction to TensorFlow Lite Introduction to TensorFlow Lite
Introduction to TensorFlow Lite
 
TFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU DelegatesTFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU Delegates
 
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite PreviewMachine Learning on Your Hand - Introduction to Tensorflow Lite Preview
Machine Learning on Your Hand - Introduction to Tensorflow Lite Preview
 
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
O365Con19 - Things I've Learned While Building a Product on SharePoint Modern...
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
 
Machine Learning in Google I/O 19
Machine Learning in Google I/O 19Machine Learning in Google I/O 19
Machine Learning in Google I/O 19
 
Docker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatternsDocker for business: How I stopped worrying about antipatterns
Docker for business: How I stopped worrying about antipatterns
 
Tizen 2.0 overview
Tizen 2.0 overviewTizen 2.0 overview
Tizen 2.0 overview
 
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
What’s Going On with the Adobe® Flash® Platform and why it is still Relevant ...
 
How to Choose a Deep Learning Framework
How to Choose a Deep Learning FrameworkHow to Choose a Deep Learning Framework
How to Choose a Deep Learning Framework
 
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
 
Introducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applicationsIntroducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applications
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to Titanium
 
Delta Engine @ CeBit 2011
Delta Engine @ CeBit 2011Delta Engine @ CeBit 2011
Delta Engine @ CeBit 2011
 
The Ring programming language version 1.10 book - Part 6 of 212
The Ring programming language version 1.10 book - Part 6 of 212The Ring programming language version 1.10 book - Part 6 of 212
The Ring programming language version 1.10 book - Part 6 of 212
 
Presentation of programming languages for beginners
Presentation of programming languages for beginnersPresentation of programming languages for beginners
Presentation of programming languages for beginners
 
Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets
Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile PoetsMobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets
Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets
 
ECMFA 2018 - Keynote : The future of modeling tools
ECMFA 2018 - Keynote : The future of modeling toolsECMFA 2018 - Keynote : The future of modeling tools
ECMFA 2018 - Keynote : The future of modeling tools
 
Info Session GDSC USICT
Info Session GDSC USICTInfo Session GDSC USICT
Info Session GDSC USICT
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
 

Recently uploaded

Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 

Recently uploaded (20)

Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 

Bringing TensorFlow to Android - a War Story

  • 1. ⚔Bringing TensorFlow To Android - a War Story⚔ YoniTsafir, DroidconTel-Aviv 2017
  • 2. About Me 🤓 • Tech Lead @ • Mobile Developer, new to ML • https://medium.com/@theyonibomber/ • Twitter: @theyonibomber
  • 3. Simply Piano 🎹 • Teaches the world to play piano • Works with any piano or keyboard • iOS: 2015,Android: 2017 • Google 💗,“Best Apps of 2017” • Technically interesting: UX, rendering, audio and ML challenges
  • 4. Machine Learning in Simply Piano 🤖 Deep Learning acoustic engine for recognizing notes: • Polyphonic, with background music and in noisy environments • Cutting-edge ML concepts • Low latency, real-time performance
  • 5. Why on-device ML? 📱 • Real-time • Network issues • Cheap processing power • Example apps: GoogleTranslate, Not Hotdog https://play.google.com/store/apps/details?id=com.seefoodtechnologies.nothotdog&hl=en https://play.google.com/store/apps/details?id=com.google.android.apps.translate&hl=en
  • 6. Our Old Solution 🐢 • Implement model in code • Some 3rd parties for acceleration, but most of heavy-lifting ourselves • Unlike iOS: performance & audio issues => smaller model & worse results • New model implementation takes weeks • Differences between research and production
  • 7. What Is TensorFlow? 🤔 • Google’s Open Source ML framework • Used in out research environment • Usually:“TensorFlow Serving” • Can also be compiled to mobile…
  • 8. TensorFlow in Production - Motivation ) • From research to production: trivial • Reduce implementation diff ‣ Except for frame rate & pre/post-processing • Better optimization => Better performance
  • 9. Our New Solution 🐇 • Obtain frozenTensorFlow model (.pb) • Add to .apk or download • AddTensorFlow libs • Run model: // Initialize tensorflow = new TensorFlowInferenceInterface(assetManager, modelFileName); // Run single inference tensorflow.feed("input", input, shape); tensorflow.run(new String[] {"output"}); tensorflow.fetch("output", output);
  • 10. TensorFlow Libs - Then (Mar 2017) + • Clone & compile • Little documentation, hard to troubleshoot • Didn’t support all required Ops • Specific NDK version must be used • A guide written in blood 💉
 http://joytun.es/tf-guide
  • 11. TensorFlow Libs - Today - • Since 1.2.0, available via Gradle:
 compile('org.tensorflow:tensorflow-android:1.2.0') • November 2017,TF Lite developer beta: ‣ Optimized for mobile ‣ Needs conversion to .tflite ‣ Subset of architectures and Ops • We still compile, but you probably don’t have to! https://techcrunch.com/2017/05/17/googles-tensorflow-lite-brings-machine-learning-to-android-devices/
  • 12. APK Size: Selective Registration 🔍 Build -> Analyze APK… ~16MB ~6MB 61% Saved
  • 13. Step I - Compare Same Model ⚖ • Branch withTF-based infra • Manual testing: up to x4 faster • Rollout to 50% in Play Console • Compare major KPIs across a few weeks (conversion, % course completion)
  • 14. Step I - Results 📊 • At first, old solution = 10% better conversion 😣 • Reasons: ‣ JNI leak ‣ Model wasTOO fast! • After fix - slight advantage toTF impl. https://www.klipfolio.com/resources/articles/what-is-digital-dashboard
  • 15. Next Up - New Model Pipeline 2 • Test in research environment => Candidate • Android based debug tool (in development) • Infra improvements? 
 Staged rollout on same model • Same Infra? 
 Our internal A/B testing framework on various models
  • 16. The War Is Not Over 3 • A performance bug I opened a few days ago: • To be continued… TF 1.0.1 TF 1.4.0