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
490
GIDS18_SupriyaSrivatsa.pdf
Supriya Srivatsa
April 24, 2018
Tweet
Share
More Decks by Supriya Srivatsa
See All by Supriya Srivatsa
Forgotten Histories
supriyasrivatsa
0
540
The Story of Villagers, Marbles and Oh, A Blockchain!
supriyasrivatsa
0
520
Going Multiplatform With Kotlin
supriyasrivatsa
0
620
Mobile, AI and TensorFlow
supriyasrivatsa
0
500
Other Decks in Technology
See All in Technology
Creative Pair
kawaguti
PRO
1
150
まだ間に合う! エンジニアのための生成AIアプリ開発入門 on AWS
minorun365
PRO
4
450
サーバーレスアーキテクチャと生成AIの融合 / Serverless Meets Generative AI
_kensh
4
300
君はPostScriptなウィンドウシステム 「NeWS」をご存知か?/sunnews
koyhoge
0
600
NOSTR, réseau social et espace de liberté décentralisé
rlifchitz
0
150
CNAPPから考えるAWSガバナンスの実践と最適化
nrinetcom
PRO
1
390
アーキテクチャわからん、の話
shirayanagiryuji
0
230
アンチパターンのアーキテクチャと組織 / Anti-Pattern Software Architecture and Organization
oztick139
0
140
Women in Agile
kawaguti
PRO
3
180
AIプロダクト開発から得られた知見 - 2025年1月版
takaakikakei
0
120
Amazon Location Serviceを使ってラーメンマップを作る
ryder472
2
170
例外処理を理解して、設計段階からエラーを「見つけやすく」「起こりにくく」する
kajitack
13
4.3k
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Code Review Best Practice
trishagee
66
17k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Typedesign – Prime Four
hannesfritz
40
2.5k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
11
910
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