Confidential © 2017 Arm Limited
Neil Tan
Arm ISG Developer Evangelist
Why Machine Learning
on MCUs
The Things Conference
uTensor.ai
Jan 2019
Confidential © 2017 Arm Limited2
Topics for Today
A quick preview
• Motivation
• What is uTensor
• Application: Sensor Fusion and LPWAN
• Application: Anomaly Detection
• Performance and Optimization
• The People
• How to Participate
Confidential © 2017 Arm Limited
How it Started
Confidential © 2017 Arm Limited4
I needed uTensor
What I learned while building an Exoskeleton
• Sensors are too primitive
• Actuators are dumb
• Need a better controller
• No Machine Learning on MCUs
• An enabling technology for IoT
Confidential © 2017 Arm Limited5
Why ML on Microcontrollers?
Inference on the Edge
Power Bandwidth Privacy
Confidential © 2017 Arm Limited6
Battery Life
• 1 Coin cell
• 1 Image every 5 minutes
• 1 second per inference
> 1 Years
Confidential © 2017 Arm Limited
What is uTensor
Confidential © 2017 Arm Limited8
uTensor
uTensor
Graph
C++
Tensorflow Mbed
Confidential © 2017 Arm Limited9
This is a Neural Network
© 2017 Arm Limited11
This is a Neural Network
https://mxnet.incubator.apache.org/tutorials/python/mnist.html
Confidential © 2017 Arm Limited10
Confidential © 2017 Arm Limited
Application
Sensor Fusion – LPWAN
Confidential © 2017 Arm Limited12
Synthetic Sensors
http://www.gierad.com/projects/supersensor/
Confidential © 2017 Arm Limited13
Sensor Fusion
Gierad Laput
Confidential © 2017 Arm Limited14
Sensor Fusion
http://curiousily.com/data-science/2017/02/02/what-to-do-when-data-is-missing-part-2.html
Grove - Accelerometer
Grove - Sound
Σ
Device Cloud
Confidential © 2017 Arm Limited
In Practice
Anomaly Detection
Confidential © 2017 Arm Limited16
Use-Case: Anomaly Detection
Devices Cloud
Confidential © 2017 Arm Limited17
Neural Network Update via FOTA
Devices Cloud
Confidential © 2017 Arm Limited18
Anomaly Detection
• Device Temperature Data
• TensorFlow trained ML model
• Mbed deployment via uTensor
• Secure cloud communication
• Model updates via FOTA
• Confidence Intervals
Credit: Y. Zhao et al.
Confidential © 2017 Arm Limited
Performance &
Optimizations
Confidential © 2017 Arm Limited20
Code Generator - uTensor
20
uGraph
pass
pass
pass
Output
C++
Dropout
Batch Norm
CMSIS-NN
Python
Intermediate
Representation
Confidential © 2017 Arm Limited21
Graph Rewriting - uTensor
21
CMSIS-NN Fully
Connected ()
Confidential © 2017 Arm Limited22
Key Word Spotting (CMSIS-NN)
• Real-time keyword detection
• ”Yes”, “No”, “Left”, “Right”…
• 10 Inferences per second @ 216 MHz
• 70 KB application memory
Confidential © 2017 Arm Limited23
CIFAR10 (CMSIS-NN)
• 32x32 color input, 10 classes
• 3 Convolutional-Pooling Layers
• 1 Fully Connect Layer
• 10 images per second max
• 133 KB RAM
• 79.9% accuracy
Confidential © 2017 Arm Limited
What Else
Confidential © 2017 Arm Limited25
I needed uTensor
We utilize bullet level one as plain text because
it’s meant to be written in paragraph form.
• Mbed Fest Japan
– Austin introduces Michael Bartling
– Talk next day
• Two Friends in Taiwan
• Received help across the organization
• Slack Group
Confidential © 2017 Arm Limited26
How to Participate
• utensor.ai
• Slack Channel
– Invitation via google-group
• @neil_the_1
Confidential © 2017 Arm Limited27
Thank You!

Machine Learning on Microcontroller for Lora using uTensor

  • 1.
    Confidential © 2017Arm Limited Neil Tan Arm ISG Developer Evangelist Why Machine Learning on MCUs The Things Conference uTensor.ai Jan 2019
  • 2.
    Confidential © 2017Arm Limited2 Topics for Today A quick preview • Motivation • What is uTensor • Application: Sensor Fusion and LPWAN • Application: Anomaly Detection • Performance and Optimization • The People • How to Participate
  • 3.
    Confidential © 2017Arm Limited How it Started
  • 4.
    Confidential © 2017Arm Limited4 I needed uTensor What I learned while building an Exoskeleton • Sensors are too primitive • Actuators are dumb • Need a better controller • No Machine Learning on MCUs • An enabling technology for IoT
  • 5.
    Confidential © 2017Arm Limited5 Why ML on Microcontrollers? Inference on the Edge Power Bandwidth Privacy
  • 6.
    Confidential © 2017Arm Limited6 Battery Life • 1 Coin cell • 1 Image every 5 minutes • 1 second per inference > 1 Years
  • 7.
    Confidential © 2017Arm Limited What is uTensor
  • 8.
    Confidential © 2017Arm Limited8 uTensor uTensor Graph C++ Tensorflow Mbed
  • 9.
    Confidential © 2017Arm Limited9 This is a Neural Network © 2017 Arm Limited11 This is a Neural Network https://mxnet.incubator.apache.org/tutorials/python/mnist.html
  • 10.
    Confidential © 2017Arm Limited10
  • 11.
    Confidential © 2017Arm Limited Application Sensor Fusion – LPWAN
  • 12.
    Confidential © 2017Arm Limited12 Synthetic Sensors http://www.gierad.com/projects/supersensor/
  • 13.
    Confidential © 2017Arm Limited13 Sensor Fusion Gierad Laput
  • 14.
    Confidential © 2017Arm Limited14 Sensor Fusion http://curiousily.com/data-science/2017/02/02/what-to-do-when-data-is-missing-part-2.html Grove - Accelerometer Grove - Sound Σ Device Cloud
  • 15.
    Confidential © 2017Arm Limited In Practice Anomaly Detection
  • 16.
    Confidential © 2017Arm Limited16 Use-Case: Anomaly Detection Devices Cloud
  • 17.
    Confidential © 2017Arm Limited17 Neural Network Update via FOTA Devices Cloud
  • 18.
    Confidential © 2017Arm Limited18 Anomaly Detection • Device Temperature Data • TensorFlow trained ML model • Mbed deployment via uTensor • Secure cloud communication • Model updates via FOTA • Confidence Intervals Credit: Y. Zhao et al.
  • 19.
    Confidential © 2017Arm Limited Performance & Optimizations
  • 20.
    Confidential © 2017Arm Limited20 Code Generator - uTensor 20 uGraph pass pass pass Output C++ Dropout Batch Norm CMSIS-NN Python Intermediate Representation
  • 21.
    Confidential © 2017Arm Limited21 Graph Rewriting - uTensor 21 CMSIS-NN Fully Connected ()
  • 22.
    Confidential © 2017Arm Limited22 Key Word Spotting (CMSIS-NN) • Real-time keyword detection • ”Yes”, “No”, “Left”, “Right”… • 10 Inferences per second @ 216 MHz • 70 KB application memory
  • 23.
    Confidential © 2017Arm Limited23 CIFAR10 (CMSIS-NN) • 32x32 color input, 10 classes • 3 Convolutional-Pooling Layers • 1 Fully Connect Layer • 10 images per second max • 133 KB RAM • 79.9% accuracy
  • 24.
    Confidential © 2017Arm Limited What Else
  • 25.
    Confidential © 2017Arm Limited25 I needed uTensor We utilize bullet level one as plain text because it’s meant to be written in paragraph form. • Mbed Fest Japan – Austin introduces Michael Bartling – Talk next day • Two Friends in Taiwan • Received help across the organization • Slack Group
  • 26.
    Confidential © 2017Arm Limited26 How to Participate • utensor.ai • Slack Channel – Invitation via google-group • @neil_the_1
  • 27.
    Confidential © 2017Arm Limited27 Thank You!

Editor's Notes

  • #6 From applications’ point of view -intelligence devices on batteries or no batteries -as more IoT systems demand more real-world data Wifi - Photo by rawpixel on Unsplash Rays - Photo by Christopher Burns on Unsplash Key - https://www.easykeys.com/63_Chicago_Lock_CompX_1250-1499_Lock_Keys.aspx
  • #7 0.250 / (100e-6 * 32) * 60 * 5 / 24 Capacity / (uA per MHz * 32 Mhz) / 1 s * (60 * 5) / 24 https://www.sparkfun.com/products/338 https://www.st.com/en/microcontrollers/stm32-ultra-low-power-mcus.html?querycriteria=productId=SC2157
  • #9 Take models trained in TF Look into the Math operations Convert to C++ Copy and Past Other than handwriting?
  • #11 After 2 to 3 month Tensorflow on MCU 100x cheaper Handwritten
  • #13 Gierad’s Super-sensor Everything but a Camera
  • #14 Reading from multiple Sensors Vibration and Sound Simple device detect complex event
  • #15 https://freerangestock.com/photos/39199/lightbulb-with-idea-concept-icon.html https://48projectsblog.wordpress.com/2015/12/22/3arduinogrove-sensors/ http://wiki.seeedstudio.com/Grove-3-Axis_Digital_Accelerometer-1.5g/ http://wiki.seeedstudio.com/Grove-Sound_Sensor/ https://www.thehouseshop.com/property-blog/will-home-ownership-remain-a-dream-for-most/2656/ https://uk.rs-online.com/web/p/processor-microcontroller-development-kits/1113738/ http://www.hortica.com/insurance-solutions/horticultural-solutions/greenhouse-growers/ https://demo.raratheme.com/the-minimal-pro/2016/03/01/eyes-on-the-street/
  • #21 Assume Keep Probability = 1 during inference Batch Normalization -> assemble with smaller Ops to save space and easier to maintain CMSIS-NN for acceleration And, more!
  • #22 Topological Order is not unique Compiler Technique Traverse the Graph – Associativity Node fusion quantization
  • #28 Just do it Don’t do it alone