Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GIDS18_SupriyaSrivatsa.pdf
Search
Supriya Srivatsa
April 24, 2018
Technology
0
520
GIDS18_SupriyaSrivatsa.pdf
Supriya Srivatsa
April 24, 2018
Tweet
Share
More Decks by Supriya Srivatsa
See All by Supriya Srivatsa
Forgotten Histories
supriyasrivatsa
0
570
The Story of Villagers, Marbles and Oh, A Blockchain!
supriyasrivatsa
0
550
Going Multiplatform With Kotlin
supriyasrivatsa
0
650
Mobile, AI and TensorFlow
supriyasrivatsa
0
530
Other Decks in Technology
See All in Technology
AWS アーキテクチャ作図入門/aws-architecture-diagram-101
ma2shita
29
11k
M3 Expressiveの思想に迫る
chnotchy
0
100
登壇ネタの見つけ方 / How to find talk topics
pinkumohikan
3
360
Microsoft Build 2025 技術/製品動向 for Microsoft Startup Tech Community
torumakabe
2
260
AIのAIによるAIのための出力評価と改善
chocoyama
2
540
Amazon Bedrockで実現する 新たな学習体験
kzkmaeda
1
530
mrubyと micro-ROSが繋ぐロボットの世界
kishima
2
200
OpenHands🤲にContributeしてみた
kotauchisunsun
1
420
Clineを含めたAIエージェントを 大規模組織に導入し、投資対効果を考える / Introducing AI agents into your organization
i35_267
4
1.6k
PHPでWebブラウザのレンダリングエンジンを実装する
dip_tech
PRO
0
200
Liquid Glass革新とSwiftUI/UIKit進化
fumiyasac0921
0
200
BrainPadプログラミングコンテスト記念LT会2025_社内イベント&問題解説
brainpadpr
1
160
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
Agile that works and the tools we love
rasmusluckow
329
21k
Gamification - CAS2011
davidbonilla
81
5.3k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
KATA
mclloyd
29
14k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Why Our Code Smells
bkeepers
PRO
337
57k
BBQ
matthewcrist
89
9.7k
Practical Orchestrator
shlominoach
188
11k
Adopting Sorbet at Scale
ufuk
77
9.4k
The Cult of Friendly URLs
andyhume
79
6.5k
Transcript
TensorFlow for Mobile Machine Learning Supriya Srivatsa, Software Engineer, Xome
Overview • AI and Mobile – the Convergence • Inference
– Today and Tomorrow • TensorFlow Primer • TensorFlow in your Pocket – TensorFlow Mobile – TensorFlow Lite • PokéDemo • Applications and Case Studies • Q & A
AI AND MOBILE – THE CONVERGENCE
INFERENCE - TODAY AND TOMORROW
The “Transfer to Infer” Approach
Why On Device Prediction • Data Privacy • Poor Internet
Connection • Questionable User Experience
Why On Device Prediction Case Study: Portrait Mode
TENSORFLOW PRIMER
None
TensorFlow – Deferred Execution Model (Building the Computational Graph) import
tensorflow as tf num1 = tf.constant(5) num2 = tf.constant(10) sum = num1 + num2 print(sum) #O/P: Tensor("add:0", shape=(), dtype=int32)
TensorFlow – Deferred Execution Model (Running the Computational Graph) import
tensorflow as tf num1 = tf.constant(5) num2 = tf.constant(10) sum = num1 + num2 with tf.Session() as sess: print(sess.run(sum)) #O/P: 15
None
None
TENSORFLOW IN YOUR POCKET
Pick Your Weapon • Choose a pre-trained TF Model –
Inception V3 Model – MNIST – Smart Reply – Deep Speech • Build a TF Model
Sharpen your Sword • Retrain Model as required.
Neural Network and Transfer Learning
None
TENSORFLOW MOBILE VS TENSORFLOW LITE
TensorFlow Lite • Smaller binary size, better performance. • Ability
to leverage hardware acceleration. • Only supports a limited set of operators.
TensorFlow Mobile and TensorFlow Lite
TensorFlow Mobile and TensorFlow Lite
TensorFlow Mobile and TensorFlow Lite
Optimization • optimize_for_inference • Quantization
Quantization • Round it up • Transform: round_weights • Compression
rates: ~8% => ~70% • Shrink down node names • Transform: obfuscate_names • Eight bit calculations
Quantization – Eight Bit Calculations
Optimization – Before and After
TensorFlow Mobile and TensorFlow Lite
TensorFlow Mobile and TensorFlow Lite
TensorFlow Lite • TOCO – TensorFlow Lite Optimizing Converter –
Pruning unused nodes. – Performance Improvements. – Convert to tflite format. (Generate FlatBuffer file.)
ü Frozen ü Optimized, Quantized ü .tflite / FlatBuffer
How does it work?
Packaging App and Model
CODE AWAY J
Code Away – Gradle Files
Code Away :) Tflite = new Interpreter(<loadmodelfile>) tflite.run(giveInput, outputObject) •
Create Interpreter • Run model with input, fetch output.
POKÉDEMO!
PokéDemo
APPLICATIONS AND CASE STUDIES
Coca Cola
Google Assistant
Smart Reply
Q & A
Thank you