Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets

75 views

Published on

There is a lot of Hype with ML and AI lately, and TensorFlow is the framework of choice from Google. But as a Mobile Developer you might have asked yourself, how can I benefit from it? In this talk, you will learn your first steps into the fascinating ML world for mobile.During this talk I will show how to set up TensorFlow for Android, and how to perform some initial operations with it:
- Classifying example
- Detection example
- Analyzing example
I will also show a model to develop a Mobile App with a Model and integration TensorFlow (from Zero to App), showcase demos in Android, iOS and Raspberry and showing as well some Real Use Cases.

Published in: Education
  • Be the first to comment

  • Be the first to like this

Mobile Fest 2018. Enrique López Mañas. TensorFlow for Mobile Poets

  1. 1. TensorFlow for Mobile Developers Enrique López Mañas Google Developer Expert
  2. 2. Ego Slide • Freelance Dev • Google Developer Expert • @eenriquelopez
  3. 3. Machine Learning / AI
  4. 4. Machine Learning / AI
  5. 5. Machine Learning / AI
  6. 6. 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
  7. 7. Buzzwords classification
  8. 8. Neural Network
  9. 9. Machine Learning
  10. 10. Machine Learning
  11. 11. Machine Learning 12% of all responses on mobile
  12. 12. Machine Learning
  13. 13. Machine Learning
  14. 14. Machine Learning
  15. 15. Practical Use Cases heymaggie.com
  16. 16. Practical Use Cases “Recognising Beer TensorFlow”
  17. 17. Cloud vs. Mobile Less Traffic & Faster Response Motion Sensors
  18. 18. TensorFlow OpenSource library for Machine Learning tensorflow.org Today most popular ML framework
  19. 19. TensorFlow Lite vs. TensorFlow Mobile - TensorFlow Lite: smaller binary size, fewer dependencies, better performance - TensorFlow Lite: developer preview, not for production! - TensorFlow Lite: supports limited set of operators, not all models will work.
  20. 20. TensorFlow You can train: - Mac / Windows - GPU Server - GPU/TPU on Cloud Prediction: - Android - iOS - Raspberry
  21. 21. TensorFlow CIFAR10
  22. 22. TensorFlow ecosystem
  23. 23. From Training to App (@yufengg)
  24. 24. Data Gathering?
  25. 25. From Training to App (@yufengg)
  26. 26. From Training to App (@yufengg)
  27. 27. Convolutional Neural Networks (@yufengg)
  28. 28. Convolutional Neural Networks (@yufengg)
  29. 29. Convolutional Neural Networks (@yufengg)
  30. 30. Convolutional Neural Networks (@yufengg)
  31. 31. Convolutional Neural Networks (@yufengg)
  32. 32. Convolutional Neural Networks (@yufengg)
  33. 33. Convolutional Neural Networks (@yufengg)
  34. 34. Convolutional Neural Networks (@yufengg)
  35. 35. From Training to App (@yufengg)
  36. 36. Optimizing model for Mobile (@yufengg)
  37. 37. From Training to App (@yufengg) Other inception versions (inception v1 quantised is 7 MB)
  38. 38. From Training to App (@yufengg) TensorFlow increases APK in 12 MB
  39. 39. From Training to App (@yufengg)
  40. 40. From Training to App (@yufengg)
  41. 41. TensorFlow community 1000+ contributors 22.000+ commits 18.000+ repositories with name “TensorFlow”
  42. 42. TensorFlow community
  43. 43. 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
  44. 44. 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
  45. 45. Building with Android Studio Download Android SDK (23) Download Android NDK (12b) (recommend it with Android SDK Manager)
  46. 46. Building with Android Studio WORKSPACE FILE
  47. 47. Building with Android Studio Run Bazel bazel build -c opt //tensorflow/examples/android:tensorflow_de
  48. 48. Building with Android Studio Install APK adb install -r bazel-bin/tensorflow/examples/android/tensorflow
  49. 49. Building with Android Studio OR… TensorFlow AAR from JCenter YUV -> RGB less efficient Object tracking not available
  50. 50. Android Samples TF Classify TF Detect TF Stylize
  51. 51. TF Classify Uses Google Inception (v3) to label images Model easy to swap No “person label” Volume button up for statistics
  52. 52. TF Classify
  53. 53. TF Classify
  54. 54. TF Detect
  55. 55. TF Detect - Draw bounding boxes around people - Useful to count objects - No training yet
  56. 56. TF Style
  57. 57. TF Style - Real time style transfer algorithm - Pick/mix different styles - Can train Magenta models
  58. 58. TF Style
  59. 59. TensorFlow Written in C++ Android uses Kotlin/Java? HowTo? Android inference Library https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/android
  60. 60. 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)
  61. 61. iOS Examples: simple
  62. 62. iOS Examples: camera
  63. 63. iOS Examples: camera - Run inception each frame - Models can be replaced
  64. 64. iOS Examples: benchmark
  65. 65. Raspberry Pi
  66. 66. TensorFlow vs. CoreML?
  67. 67. 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
  68. 68. Feedback! http://bit.ly/mobilefestUA
  69. 69. Shameless self-promotion www.kotlinweekly.net

×