Edge and AI
By : Vishwas Narayan
https://arxiv.org/pdf/1801.04381.pdf
Edge ml is a explosion
● Lower latency & close knit interactions
● Network connectivity
● Privacy preserving
ML on Edge
● Latency
● Bandwidth
● Accuracy
● Complexity
Challenges
● Uses little compute power
● Works on limited memory platforms
● consume less battery
Simple Architecture(Simple to see)
Code is simple
# Build and save Keras model.
model = build_your_model()
tf.keras.experimental.export_saved_model(model, saved_model_dir)
# Convert Keras model to TensorFlow Lite model.
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
Purpose
● APIs for simplifying pre- and post-processing (launched)
● Autogenerates pre- and post-processing (in progress)
With tflite support
Langage Bind
● New language bindings (Swift, Obj-C, C# and C) for iOS, Android and Unity
● Community language bindings (Rust, Go, Flutter/Dart)
How to improve model performance?
● Use quantization
● Use pruning
● Leverage hardware accelerator
● Use mobile optimized model architecture
● Per-op profiling
Utilizing quantization for CPU, DSP & NPU
optimizations
Reduce precision of static parameters (e.g. weights) and dynamic values (e.g.
activations)
Accelerators
GPU for the purpose
● 2–7x faster than the floating point CPU implementation
● Uses OpenGL & OpenCL on Android and Metal on iOS
● Accepts float models (float16 or float32)
DSP Delegation
● Use Hexagon delegate on Android O & below
● Use NN API on Android P & beyond
● Accepts integer models (uint8)
● Launching soon!
Android Deployment
● Enables graph acceleration on DSP, GPU and NPU
● Supports 30+ ops in Android P, 90+ ops in Android Q
● Accepts float (float16, float32) and integer models (uint8)
Benchmarks and expand operator and reduce size
● Utilize TensorFlow ops if op is not natively supported
● Only include required ops to reduce the runtime’s size
CPU and tf operator
● Enables hundreds more ops from TensorFlow on CPU
● Caveat: Binary size increase (~6MB compressed)
Reduce overall runtime size
● Selectively include only the ops required by the model
● Pares down the size of the binary
tflite
tflite converter
tflite model maker
Coral Tensorflow
Kernels
https://www.kaggle.com/gaur128/creating-tflite-model
https://www.kaggle.com/bhrt97/lr-tflite
https://www.kaggle.com/general/62267
https://www.tensorflow.org/lite/tutorials/model_maker_image_classification
links
https://www.tensorflow.org/lite/tutorials/model_maker_image_classification
https://www.tensorflow.org/lite/convert/
https://pub.dev/packages/tflite
Video Hyperlinks
https://www.youtube.com/watch?v=BInZBpX7bEo
https://www.youtube.com/watch?v=27Zx-4GOQA8
https://www.youtube.com/watch?v=4xuxOKveu9U
https://www.youtube.com/watch?v=iyUkOAI69ts
https://www.youtube.com/watch?v=2tnWHCxP8Bk
Tiny ml
Communities
https://aihub.cloud.google.com/u/0/p/products%2F6ca92c9c-6932-45f8-8f08-
15a1a6dfafc7
https://tfhub.dev/s?deployment-format=lite
TFUG bangalore:https://t.me/tfblr
tinyML:https://www.meetup.com/tinyML-Enabling-low-Power-ML-at-the-edge-
Bangalore-India/
Parallela
If not edge have a browser then you can do this
TensorFlow Federated
https://www.youtube.com/watch?v=JBNas6Yd30A
Federated Learning Paper
https://arxiv.org/abs/1912.04977
https://arxiv.org/pdf/1902.01046.pdf
Thank You
Any question queries please please free to ask or connect.
If you want to further learn Please do contact me
from any social media platform that I have listed
here
Email : vishwasnarayan2345@gmail.com
Linkedin Vishwas N : shorturl.at/aquyC
Twitter : shorturl.at/gios7

Edge and ai