Google Developers ML Summit Tokyo ================================= 2019.07.11 # Opening - Grow with Google: 2022年までに1,000万人を対象に # Keynote - ICML2019基調講演と同じような内容 - Waymo: 8,000,000+ MILES AND COUNTINGS - 白内障の診断: - モデル: Inception V4 - 説明可能性: Saluency Map using Integrated Gradient - TF Community in Japan - TFUG - <> Experts - ML Study Jams - AutoML - Current: Solution = ML expertise + data + comutation - Google turn this into: Soluton = data + computation - EfficientNet でドヤ顔 - Object DetectionでもAutoMLはつよい(NAS-FPN - 自然言語でも強い(Evolved Transformer - What do we want? - Large model, but sparsely activated - Single model to solve many tasks - Dynamically learn and grow pathways - Model architecture adaptation - Thoughtful use of AI in society - https://ai.google/principle - https://blog.google/technology/ai/responsible-a-principles - ML Fairness # Machine Learning Overview - MLKit(Out of the Box) - Vision, NLP, Custom Models - Latest features: - On-device translation API (including Japanese) - Androidのみ? - Object detection and tracking API - Lifull: 物件のリアルタイム認識で使っている - g.co/mlkit - GCP - Sight, Language, Conversation - AutoML (Vision, Video, NLP, Translation, Tables) - Recursion phormoceuticols reduce training time from 24 hours to 15 minute on TPU pods - TPU Pods is now available beta. - g.co/cloud/ai - TensorFlow - Tensorflowのダウンロード地域、ロシアがほとんどなかったの面白い - 公式ドキュメントはOSSで翻訳 - ML Study Jams trained 1,800 developers in Japan, community driven event. - Tensorflow 2.0 - More Intuitive APIs - Less code - Kerasを使うのが今や当たり前 - Portability - TensorFlow Extended, Lite, JS - Airflow Runtime https://airflow.apache.org/ - TF Lite: モバイル端末向け(音声認識、ビデオセグメンテーション、エッジ検出など、めっちゃ早い - TF Rankingなんてのがあるのか - Colab & tensorflow, TensorFlow Hub(学習済みモデルが大量にある) # Machine Learning overview with TensorFlow, Laurence Moroney, Developer Advocate - スライドは後日アップロード予定 - Kerasのソースコードサンプル - https://github.com/lmoroney/io19/blob/master/Zero%20to%20Hero/Rock-Paper-Scissors.ipynb - TensorFlow.js - 推論コードをPythonから変換可能 - 再学習 with 転移学習ができる - 学習もできる - いろんな環境で動く(Browser, Mobile, Server, Desktop, ...) - Kerasライクにモデルを記述できる - Web Server for Chrome - https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb - JSでWebカメラ使って教師データをあつめるデモ、すごい - 学習一瞬で終わる - https://github.com/lmoroney/dlaicourse/tree/master/JavaScript%20Course/Week%204/webcam-transfer-learning # What's new in TensorFlow 2.0 / Best Practice - https://colab.research.google.com/github/random-forests/applied-dl/blob/master/examples/9-deep-dream-minimal.ipynb - https://colab.research.google.com/github/random-forests/applied-dl/blob/master/examples/8-seq2seq.ipynb - https://www.tensorflow.org/beta/tutorials/text/nmt_with_attention - 翻訳における中間表現(意味空間)を理解するデモ - https://www.tensorflow.org/beta/tutorials/text/image_captioning - Image -> CNN -> Vector -> RNN -> Sentense - TensorFlow 2.0 - tf.keras as the recommended high-level API - Eager execution by default - low-level API へアクセスする口もちゃんとある - TF loves Keras - scikit-learnライクなAPIになったんだな(Keras) - Low-levelでもPytorchライクにコード書ける - https://medium.com/tensorflow/what-are-symbolic-and-imperative-apis-in-tensorflow-2-0-dfccecb01021 - Kerasとtf.kerasは微妙に違う(KerasはTF実装、Kerasは参考実装) - CuPyみたいなことをTFでもできるようになった - Distributed learning - `strategy = tf.distribute.MirroredStrategy()` で、`strategy` のスコープ内で分散できる - Learning - tensorflow.org/beta - tensorflow.org/beta/tutorials/genrerative/pix2pix - Compativility - Colab: GPU,TPUのプロファイリング見れる機能あるのか - Migrating - tf.compat.v1 or tf_upgrade_v command - http://tf2up.ml - Hands-on Machine Learning with Scikit-Learn, Keras and Tensorflow2.0 - https://www.oreilly.com/library/view/hands-on-machine-learning/9781492032632/ - https://github.com/ageron/handson-ml2 # Tensorflow Lite - Library to drive machine learning model on devices - Low latency, close knit interactions, network connectivity, pricacy sensitive, ... - Challenges - Little compute power, limited memory, cosumes less battery - Pretrained models - https://www.tensorflow.org/lite/models - MLKit - wrapper of TensorFlow Lite - Conversion - `tf.lite.TFLiteConverter.from_keras_model(model or saved_model_dir).convert() - Methods - Levarage hardware accelarator - MobileNet V1 - CPU -> GPU(x5.5) -> DSP(x13.8) -> EdgeTPU(x42) - User mobile optimized architecture - モバイルにはモバイル向きのを使う。 - 必要に応じてNASを使ってもよい - quantization - pruning - Cut weight with zero # Tensorflow Extended - https://www.slideshare.net/FlinkForward/flink-forward-san-francisco-2019-tensorflow-extended-an-endtoend-machine-learning-platform-for-tensorflow-robert-crowe # TensorFlow Input Pipeline and Distribution Strategy - ココらへんの話 https://www.tensorflow.org/guide/performance/datasets - Why input pipeline? - ハードウェア依存で動かなかったり、前処理が必要だったりするかもしれない(分散することもある) - Pipeline - Extract: - read data from memory/storage - parse file format - Transform - text vectorization - image transformations - video temporal sampling - shuffling, batching... - Load - transfer data to the accelarator - 前処理とかしっかり考えないと分散するときにIdle状態のワーカができてしまう - データセットを細切れに取得して複数のワーカに撒けばあっという間に終わる - dataset.prefetch(batch_size=X) - dataset.interleave(TFRecordDataset, num_parallel_cells) - tf.data.experimental.AUTOTUNE - 分散学習の話 - データ分散https://www.tensorflow.org/api_docs/python/tf/distribute/MirroredStrategy - TPUとGPUで使うStrategyが違う - モデル分散 https://www.tensorflow.org/api_docs/python/tf/distribute/experimental/ParameterServerStrategy - Custom models - モデルの生成はスコープの中で行う必要がある # Google AutoML Tables - Neural Architecture Search もしているらしい - Googleのモデルカタログから自動選択 - メタ学習機能が入っている - 数千万レコードのデータを突っ込むとデータ投入に30分くらいかかるらしい - Train:Valid:Holdout=8:1:1がデフォルト - 1000万行以下のデータな4~8時間くらいでOK - EarlyStopping=ONなら、時間より前に終わることはある - SUSYデータ: 4時間くらいで学習終わった - Feature Importanceの仕様は謎 - テストデータはシャッフルされる - GNU Seguros事例 - AutoML NLP - 青空文庫でデモ - AutoML Tablesでもテキスト分類できる - AutoML Tables 10クラス分類までしかできない - 分かち書きはしてくれないので自分でやること