Top Banner
machine learning and mobile @swift-sig brettkoonce.com/talks december 20th, 2019
30

machine learning mobile recap - brett koonce

Apr 09, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: machine learning mobile recap - brett koonce

machine learning and mobile @swift-sig

brettkoonce.com/talks december 20th, 2019

Page 2: machine learning mobile recap - brett koonce

overview

• goal: explore image recognition on mobile/edge devices

• review current state of the art

• where things are going

• demo, recap

Page 3: machine learning mobile recap - brett koonce

assumptions• edge: phone, car, satellite, sensor

• compute: edge << cloud

• bandwidth: limited/unreliable

• power: have to be efficient

• decision time: bounded/interactive

Page 4: machine learning mobile recap - brett koonce

why

• resnet: 224x224 pixels

• gpipe: 480x480 pixels

• iphone xr: 4k @ 60 fps

Page 5: machine learning mobile recap - brett koonce

coreml• coremltools: xgboost, scikit-learn, keras

• turicreate: above + numpy + metal

• cons: iOS only :: pros: fast

• good starting point if new to field

• demo: mnist + keras + coreml (2017)

Page 6: machine learning mobile recap - brett koonce

tensorflow-lite

• ios/android/edge devices

• build tensorflow model, graphdef

• convert to tensorflow lite operations

• demo: ios + video feed + mobilenet v1

Page 7: machine learning mobile recap - brett koonce

pytorch

• 1.3 release: october 2019

• pytorch model —> jit trace —> .pt model

• .pt model + ios/android libraries

• demo: ios + video feed + mobilenet v2

Page 8: machine learning mobile recap - brett koonce

embedded linux

• bring own hardware + linux in some form

• opencv all the things

• dlib, matlab, c++ libraries + shims

• good prototyping platform

Page 9: machine learning mobile recap - brett koonce

custom hardware• arbitrary integer, floating point

depth

• asics/macs

• probabilistic processors

• build it and they will come

• new limit: software

Page 10: machine learning mobile recap - brett koonce

tensorflow today

Page 11: machine learning mobile recap - brett koonce

operator fusion

Page 12: machine learning mobile recap - brett koonce

pipelining

Page 13: machine learning mobile recap - brett koonce

polyhedral approach

Page 14: machine learning mobile recap - brett koonce

glow

Page 15: machine learning mobile recap - brett koonce

mesh-tf

Page 16: machine learning mobile recap - brett koonce

evolutionary approaches

Page 17: machine learning mobile recap - brett koonce

compiler exploration

Page 18: machine learning mobile recap - brett koonce
Page 19: machine learning mobile recap - brett koonce
Page 20: machine learning mobile recap - brett koonce

• swift —> cifar —> train —> model —>

• s4tf —> numpy —> keras —> h5 —>

• freeze —> .pb —> mlir —> tf-lite —> device

• demo: swift —> keras, h5 —> .pb, .pb —> mlir —> tf-lite, tf-lite —> ios

swift/🐍/mlir/tf-lite

Page 21: machine learning mobile recap - brett koonce
Page 22: machine learning mobile recap - brett koonce
Page 23: machine learning mobile recap - brett koonce
Page 24: machine learning mobile recap - brett koonce
Page 25: machine learning mobile recap - brett koonce
Page 26: machine learning mobile recap - brett koonce

recap

• goal: image recognition on edge devices

• current high level approaches

• software/hardware fusion

• swift —> mlir —> tf-lite on device

Page 27: machine learning mobile recap - brett koonce

kudos 🎉• mlir team

• s4tf team

• fast.ai team

• meir rosendorff blog

• koan-sin tan mlir/tf slides

Page 28: machine learning mobile recap - brett koonce

• mlir/llvm presentations

• albert cohen / “Polyhedral Compilation as a Design Pattern for Compiler Construction”

• tvm (1802.04799), glow (1805.00907), mesh-tf (1811.02084)

• Device Placement Optimization with Reinforcement Learning (1706.04972)

papers

Page 29: machine learning mobile recap - brett koonce

thanks for coming!

Page 30: machine learning mobile recap - brett koonce

wishlist 🎁

• model saving/loading (checkpoints)

• imagenet demo/model zoo (can help!)

• mlir: more tf-lite ops (e.g. mn v2/enet)