SlideShare a Scribd company logo
1 of 17
Download to read offline
⚔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 DelegatesKoan-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 PreviewModulabs
 
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 19Jeongkyu 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 antipatternsLenses.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 FrameworkNavid 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" applicationsRokesh Jankie
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to TitaniumGraham Weldon
 
Delta Engine @ CeBit 2011
Delta Engine @ CeBit 2011Delta Engine @ CeBit 2011
Delta Engine @ CeBit 2011Karsten 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 212Mahmoud Samir Fayed
 
Presentation of programming languages for beginners
Presentation of programming languages for beginnersPresentation of programming languages for beginners
Presentation of programming languages for beginnersClement 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 PoetsMobileFest2018
 
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 toolsmelbats
 
Info Session GDSC USICT
Info Session GDSC USICTInfo Session GDSC USICT
Info Session GDSC USICTDSCUSICT
 
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

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 

Recently uploaded (20)

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 

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