Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TensorFlow for Mobile Developers

TensorFlow for Mobile Developers

7d67eb78fab223823acad6714cd2d3ca?s=128

Enrique López Mañas

October 25, 2017
Tweet

Transcript

  1. TensorFlow for Mobile Developers

  2. Machine Learning / AI

  3. Buzzwords classification Artificial intelligence Machine Learning The science of making

    machines smarts Building machines that can learn Neural Networks One of the many different algorithms in Machine Learning
  4. Buzzwords classification

  5. Neural Network

  6. Machine Learning

  7. Machine Learning

  8. Machine Learning 12% of all responses on mobile

  9. Machine Learning

  10. Machine Learning

  11. Machine Learning

  12. Cloud vs. Mobile Less Traffic & Faster Response Motion Sensors

  13. TensorFlow OpenSource library for Machine Learning tensorflow.org Today most popular

    ML framework
  14. TensorFlow You can train: - Mac / Windows - GPU

    Server - GPU/TPU on Cloud Prediction: - Android - iOS - Raspberry
  15. TensorFlow CIFAR10

  16. TensorFlow ecosystem

  17. From Training to App (@yufengg)

  18. Data Gathering?

  19. From Training to App (@yufengg)

  20. From Training to App (@yufengg)

  21. Convolutional Neural Networks (@yufengg)

  22. Convolutional Neural Networks (@yufengg)

  23. Convolutional Neural Networks (@yufengg)

  24. Convolutional Neural Networks (@yufengg)

  25. Convolutional Neural Networks (@yufengg)

  26. Convolutional Neural Networks (@yufengg)

  27. Convolutional Neural Networks (@yufengg)

  28. Convolutional Neural Networks (@yufengg)

  29. From Training to App (@yufengg)

  30. Optimizing model for Mobile (@yufengg)

  31. From Training to App (@yufengg) Other inception versions (inception v1

    quantised is 7 MB)
  32. From Training to App (@yufengg) TensorFlow increases APK in 12

    MB
  33. From Training to App (@yufengg)

  34. From Training to App (@yufengg)

  35. TensorFlow community 1000+ contributors 22.000+ commits 18.000+ repositories with name

    “TensorFlow”
  36. TensorFlow community

  37. Building with Android Studio Uses Bazel to build Set Bazel

    binary location in /tensorflow/examples/ android/build.gradle Add project in tensorflor/examples/android folder to Android Studio
  38. Building with Android Studio Installing Bazel first: Download from https://github.com/bazelbuild/bazel/releases

    Install instructions in https://docs.bazel.build/versions/master/install.html
  39. Building with Android Studio Download Android SDK (23) Download Android

    NDK (12b)
 
 (recommend it with Android SDK Manager)
  40. Building with Android Studio WORKSPACE FILE

  41. Building with Android Studio Run Bazel bazel build -c opt

    //tensorflow/examples/ android:tensorflow_demo
  42. Building with Android Studio Install APK adb install -r bazel-bin/tensorflow/examples/android/

    tensorflow_demo.apk
  43. Building with Android Studio OR… TensorFlow AAR from JCenter YUV

    -> RGB less efficient Object tracking not available
  44. Android Samples TF Classify 
 TF Detect
 
 TF Stylize

  45. TF Classify Uses Google Inception (v3) to label images Model

    easy to swap No “person label” Volume button up for statistics
  46. TF Classify

  47. TF Classify

  48. TF Detect

  49. TF Detect - Draw bounding boxes around people - Useful

    to count objects - No training yet
  50. TF Style

  51. TF Style - Real time style transfer algorithm - Pick/mix

    different styles - Can train Magenta models
  52. TF Style

  53. TensorFlow Written in C++ Android uses Kotlin/Java?
 
 HowTo? Android

    inference Library https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/android
  54. Building for iOS Install requirements: - Xcode 8 - Command

    line tools (xcode-select install) - brew install automake - brew install lib tool - tensorflow/contrib/makefile_build_all_ios.sh (takes 20 minutes)
  55. iOS Examples: simple

  56. iOS Examples: camera

  57. iOS Examples: camera - Run inception each frame - Models

    can be replaced
  58. iOS Examples: benchmark

  59. Raspberry Pi

  60. Resources TensorFlow: https://www.tensorflow.org/ Magenta: https://magenta.tensorflow.org/welcome-to-magenta TensorFlow for Poets: https://codelabs.developers.google.com/codelabs/ tensorflow-for-poets/index.html#0