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

Play Rock-Paper-Scissors-Spock-Lizard with your Android Things

jinqian
November 20, 2018

Play Rock-Paper-Scissors-Spock-Lizard with your Android Things

jinqian

November 20, 2018
Tweet

More Decks by jinqian

Other Decks in Technology

Transcript

  1. @Xebiconfr #Xebicon18 @bonbonking • Data collection tool (raw data to

    train the ML model) • Hardware components (robot arms + game control) • Application running on Android Things ◦ Applicative: game rules, play logic and interactions ◦ Artificial Intelligence: recognize opponent's gesture 10
  2. @Xebiconfr #Xebicon18 @bonbonking • Web mobile application: Node.js + Express

    • Hosting/Deployment: Firebase Hosting / Function / Storage 12
  3. @Xebiconfr #Xebicon18 @bonbonking • Raw images data close to reality

    are hard to obtain • GDPR? Not compliant… • Reusable for future projects • Feed the model training pipeline 16
  4. @Xebiconfr #Xebicon18 @bonbonking Pulse Width Modulation (PWM) is a common

    method used to apply a proportional control signal to an external device using a digital output pin. (e.g. servo motors, LCD display). It is a technique for getting analog results with digital means. • Frequency (expressed in Hz): describes how often the output pulse repeats. • Period is the time each cycle takes and is the inverse of frequency. • Duty cycle (expressed as a percentage) describes the width of the pulse within that frequency window. 24
  5. @Xebiconfr #Xebicon18 @bonbonking • Android Things Starter Kit (NXP i.MX7D):

    ~200€ • Or Raspberry Pi (~40€) + Camera Module (~25€) + Display • 16 Channel Servo Driver (~12€) • Power Supply or battery (~5€) • 5 servo motors (~12€) • Cardboard + woodsticks (~0€) • Glue Gun (~10€) • Electronique jumper + Resistors + LED + Button + Breadboard (~10€) 30
  6. @Xebiconfr #Xebicon18 @bonbonking 52 python -m scripts.retrain \ --bottleneck_dir=tf_files/bottlenecks \

    --how_many_training_steps=4000 \ --model_dir=tf_files/models/ \ --summaries_dir=tf_files/training_summaries/mobilenet_0.50_224 \ --output_graph=tf_files/handgame_graph.pb \ --output_labels=tf_files/handgame_labels.txt \ --architecture=mobilenet_0.50_224 \ --image_dir=tf_files/gesture_photos
  7. @Xebiconfr #Xebicon18 @bonbonking 53 tflite_convert \ --graph_def_file=tf_files/handgame_graph.pb \ --output_file=tf_files/handgame_graph.lite \

    --input_format=TENSORFLOW_GRAPHDEF \ --output_format=TFLITE \ --input_shape=1,224,224,3 \ --input_array=input \ --output_array=final_result \ --inference_type=FLOAT \ --input_type=FLOAT
  8. @Xebiconfr #Xebicon18 @bonbonking The Inter-Integrated Circuit (IIC or I2C) bus

    connects simple peripheral devices with small data payloads. Sensors and actuators are common use cases for I2C. Examples include accelerometers, thermometers, LCD displays, and motor drivers. I2C is a synchronous serial interface, relies on a shared clock signal to synchronize data transfer between devices. I2C devices connect using a 3-Wire interface consisting of: • SCL: Shared clock signal • SDA: Shared data line • GND: Common ground reference 63
  9. @Xebiconfr #Xebicon18 @bonbonking An entire weekend (of burning finger and

    slapped face)! My robot doesn't respect (yet) Asimov's Three Laws of Robotics 68
  10. @Xebiconfr #Xebicon18 @bonbonking • Model training pipeline with user feedback

    & photo upload • Dynamic model downloading (via API or Firebase ML kit) • Better game control • Better UX • Leaderboard 70
  11. @Xebiconfr #Xebicon18 @bonbonking • Artificial neural network: https://en.wikipedia.org/wiki/Artificial_neural_network • Deep

    Learning: https://en.wikipedia.org/wiki/Deep_learning • Convolutional Neural Network: https://en.wikipedia.org/wiki/Convolutional_neural_network • TensorFlow for Poets: https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/ • TensorFlow for Poets 2: Optimize for Mobile: https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2/ • TensorFlow Glossary: https://www.tensorflow.org/versions/r0.12/resources/glossary • Medium article: Android meets Machine Learning: https://medium.com/xebia-france/android-meets-machine-learning-part-1-from-tensorflow-mobile-li te-to-ml-kit-4c7e6bc8eee3 72
  12. @Xebiconfr #Xebicon18 @bonbonking Merci ! Come play against chifumi robot

    at the stand :) Github Repo: https://github.com/jinqian/at-rock-paper-scissors-lizard-spock