GPU 学習時間 精度(Map) 1 GPU (NC6) 7分22秒 0.9479 2 GPU (NC12) 3分43秒 0.9479 本番稼働に向けて Confusion Matrix for Karugamo

GPU 学習時間 精度(Map) 1 GPU (NC6) 7分22秒 0.9479 2 GPU (NC12) 3分43秒 0.9479 本番稼働に向けて Confusion Matrix for Karugamo

CNTK deep dive - DeepLearning関連 PJ の進め方から本番展開まで AI07 Agenda Profile 岩崎 喬一(Kyoichi Iwasaki) Today’s data データサイエンティスト、やっぱり要る? データサイエンティストのスキルセット 課題背景を理解 →ビジネス課題を整理 ビジネス力 解決 情報処理、人工知能、 統計学などの知恵を理 解し、適用 データサイエ データエンジ データサイエンスを意味 ある形に使えるようにし、 ンス力 ニアリング力 実装、運用 Ref. データサイエンティスト協会:http://www.datascientist.or.jp/news/2014/pdf/1210.pdf データ分析プロジェクトの進め方 ビジネス 要件定義 ビジネス力 データ収 展開 集・確認 データサイエ データエンジ ンス力 ニアリング力 データ分 評価 析 機械学習と深層学習 深層学習? 深層学習による主な画像解析(as of May2018) What are specified? Algorithms MSでの実装 単純 画像分類 What? CNN Custom Vision, CNTK Fast(er) Where? Custom Vision, CNTK 物体検知 What? R-CNN Mask Where? Shape? ..(In near future?) セグメンテーション What? 複雑 R-CNN 深層学習による主な画像解析 深層学習による主な画像解析(as of May2018) 2015 2015-16 2015-16 2015-16 2017 • Fast R-CNN • Faster R-CNN • YOLO • SSD • Mask R-CNN 物体検知 セグメンテーション 深層学習の「学習」? 深層学習(機械学習の観点から) CNTKとは? CNTKとは? ▪ GPU / マルチGPU(1-bit SGD) https://www.microsoft.com/en-us/cognitive-toolkit/ CNTKの実行速度 小さいほど高速 DL F/W FCN-S AlexNet ResNet-50 LSTM-64 CNTK 0.017 0.031 0.168 0.017 Caffe 0.017 0.027 0.254 -- TensorFlow 0.020 0.317 0.227 0.065 Torch 0.016 0.043 0.144 0.324 https://arxiv.org/pdf/1608.07249.pdf Codes in CNTK https://github.com/Microsoft/CNTK CNTKで2値分類をやってみる 赤 青 CNTKで2値分類をやってみる パラメータw、b w、b bias 푏 1 疾患 年齢 푤 11 z1 あり 푤21 푏2 푤12 疾患 腫瘍 푤 z2 22 なし CNTKの処理フロー 入力・出力変数の定義 ネットワークの定義 損失関数、最適化方法の定義 モデル学習 モデル評価 CNTKの処理フロー – 1/5 入力・出力変数の定義 import cntk as C ## 入力変数(年齢, 腫瘍の大きさ)の2種類あり input_dim = 2 ## 分類数(疾患の有無なので2値) num_output_classes = 2 ## 入力変数 feature = C.input_variable(input_dim, np.float32) ## 出力変数 label = C.input_variable(num_output_classes, np.float32) CNTKの処理フロー – 2/5 ネットワークの定義 def linear_layer(input_var, output_dim): input_dim = input_var.shape[0] ## Define weight W weight_param = C.parameter(shape=(input_dim, output_dim)) ## Define bias b bias_param = C.parameter(shape=(output_dim)) ## Wx + b. Pay attention to the order of variables!! return bias_param + C.times(input_var, weight_param) z = linear_layer(input, num_outputs) CNTKの処理フロー – 3/5 損失関数、最適化方法の定義 ## 損失関数 loss = C.cross_entropy_with_softmax(z, label) ## 分類エラー("分類として"当たっているか否か) eval_error = C.classification_error(z, label) ## 最適化 learner = C.sgd(z.parameters, lr_schedule) trainer = C.Trainer(z, (loss, eval_error), [learner]) CNTKの処理フロー – 4/5 モデル学習 for i in range(0, num_minibatches_to_train): ## Extract training data features, labels = generate_random_data_sample(minibatch_size, input_dim, num_output_classes) ## Train trainer.train_minibatch({feature : features, label : labels}) CNTKの処理フロー – 5/5 モデル評価 out = C.softmax(z) result = out.eval({feature : features}) Demo: CNTK basic process Tips :: Jupyter Notebookの起動 > activate py35 (py35) > jupyter notebook https://notebooks.azure.com/ Demo :: training - evaluate https://youtu.be.com/70FMOdVUNPI Tips 混同行列(Confusion Matrix) 疾患[実際] 非疾患[実際] 疾患[予測] 14 0 非疾患[予測] 2 9 非疾患と予測(緑線の下) 実際は疾患 (緑線の下の赤2つ) ▶モデルの見逃し 物体検知からの分散学習 物体検知って?(recap) What are specified? Algorithms MSでの実装 単純 画像分類 What? CNN Custom Vision, CNTK Fast(er) Where? Custom Vision, CNTK 物体検知 What? R-CNN Mask Where? Shape? ..(In near future?) セグメンテーション What? 複雑 R-CNN 深層学習による主な画像解析 VoTT https://github.com/Microsoft/VoTT 静止画 動画 物体検知における“座標” x., y.ともに、左上の●から計った両端点● xmin xmax ymin ymax Quick demo on VoTT(静止画) Quick demo for VoTT https://youtu.be/j7OjxFY2Go8 Quick demo on VoTT(動画) Quick demo for VoTT https://youtu.be/RCuGLRtggrI Karugamo detection! Movie inferred with Faster R-CNN https://youtu.be/ziuEXyJ9SNs CNTKでの分散学習 – 1/6 深層学習での分散学習とは? →主に学習時間短縮のためにマルチGPUを利用すること 分散学習実行準備 マルチGPU搭載 マルチホスト 1bit-SGD CNTKでの分散学習 – 2/6 入力・出力変数の定義 ネットワークの定義 損失関数、最適化方法の定義 モデル学習 モデル評価 CNTKでの分散学習 – 3/6 損失関数の定義 from cntk import distributed ... learner = cntk.learner.momentum_sgd(...) # create local learner distributed_after = epoch_size # number of samples to warm start with distributed_learner = distributed.data_parallel_distributed_learner( learner = learner, num_quantization_bits = 32, # non-quantized gradient accumulation distributed_after = 0) # no warm start CNTKでの分散学習 – 4/6 最適化方法の定義 minibatch_source = MinibatchSource(...) ... trainer = Trainer(z, ce, pe, distributed_learner) ... session = training_session(trainer=trainer, mb_source=minibatch_source, ...) session.train() ... distributed.Communicator.finalize() # must be called to finalize MPI in case of successful distributed training https://docs.microsoft.com/en-us/cognitive-toolkit/multiple-gpus-and- machines#2-configuring-parallel-training-in-cntk-in-python CNTKでの分散学習 – 5/6 分散学習の実行方法 # GPUを2つ利用し、学習用スクリプトがtraining.py > mpiexec –n 2 python training.py CNTKでの分散学習 – 6/6 CPU/GPU利用設定 import cntk ## CPU利用時 cntk.device.try_set_default_device(cntk.device.cpu()) ## GPU利用時 cntk.device.try_set_default_device(cntk.device.gpu()) Some preparation for Deep Learning! CNTKから2つのGPUが見えている GPU利用可能か確認 https://github.com/kyoro1/decode2018/blob/master/2.%20distributed%20learning%2 0with%20Faster%20R-CNN.ipynb Faster R-CNN with single GPU モデルパラメータ数は5700万超! Single GPU vs Multi GPU 2つのGPU利用 Single GPU vs Multi GPU GPU 学習時間 精度(mAP) 1 GPU (NC6) 7分22秒 0.9479 2 GPU (NC12) 3分43秒 0.9479 本番稼働に向けて Confusion Matrix for karugamo karugamoが写っているのに、 モデルは推定できなかった ▶モデルの見逃し あり[実際] なし[実際] あり[予測] XX XX なし[予測] XX XX Confusion Matrix for karugamo あり[実際] なし[実際] あり[予測] XX XX なし[予測] XX XX karugamoでないものに、 karugamoと推定 ▶モデルの過検知? Original movie vs inferred movie https://youtu.be/SYTw5OLBnzc データサイエンス活用推進体制(案) 【事業活動に結びつけるための 【分析結果を活用し、ビジネス企 戦略づくり・設計を行う人材】 画や改善を活かす人材】 ビジネス力 【実際に手を動かして #AI02 データサイエ データエンジ ンス力 ニアリング力 データ分析をする人材】 http://www.kantei.go.jp/jp/singi/keizaisaisei/miraitoshikaigi/jinzaiikusei_dai3/siryou4.pdf 本番展開あるある (技術寄り編) 本番展開あるある (システム運用編) Key takeaway • 機械学習 ほぼ同等 本来の意味 ビジネスサイドとの協業 • どんなKPI Key takeaway 平易にスクリプトが書け scrap & build • 出来ること 出来ないこと たち Appendix Reference https://github.com/Microsoft/CNTK https://docs.microsoft.com/en-us/cognitive-toolkit/setup-cntk-on-your- machine https://github.com/Microsoft/VoTT https://github.com/onnx/onnx https://www.edx.org/course/deep-learning-explained https://www.edx.org/course/computer-vision-and-image-analysis Reference https://github.com/kyoro1/decode2018 https://youtu.be/s5W4c9q_SAw https://youtu.be/ziuEXyJ9SNs https://youtu.be/SYTw5OLBnzc https://youtu.be.com/70FMOdVUNPI https://youtu.be/j7OjxFY2Go8 https://youtu.be/RCuGLRtggrI © 2018 Microsoft Corporation. All rights reserved. 本コンテンツの著作権、および本コンテンツ中に出てくる商標権、団体名、ロゴ、製品、サービスなどはそれぞれ、各権利保有者に帰属します。.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    62 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us