Deep Learning基本理論とTensorFlow
-
Upload
tadaichiro-nakano -
Category
Technology
-
view
4.683 -
download
0
Transcript of Deep Learning基本理論とTensorFlow
![Page 1: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/1.jpg)
Deep Learning Basic w/ TensorFlow
![Page 2: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/2.jpg)
2
目次 :
1. TensorFlow概要
2. DeepLearning基礎とTensorFlow
3. 改善に向けた試行錯誤4. まとめ
![Page 3: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/3.jpg)
3
目次 :
1. TensorFlow概要
2. DeepLearning基礎とTensorFlow
3. 改善に向けた試行錯誤4. まとめ
![Page 4: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/4.jpg)
4
Motivation
![Page 5: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/5.jpg)
5
TensorFlowの登場
![Page 6: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/6.jpg)
6
TensorFlowとは?Googleが発表した機械学習フレームワークDeep Learningだけでなくword2Vecなども実現可能分散実行やマルチ CPU/GPUでも動作可能実装言語は C++/PythonGoogle内部で実際にプロダクト環境に使われている
![Page 7: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/7.jpg)
7
TensorFlowとは?
TensorBoard: 学習内容の可視化ツール
![Page 8: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/8.jpg)
8
TensorFlowとは?
TensorFlow Serving: クライアントへの入出力をサポート
![Page 9: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/9.jpg)
9
TensorFlowとは?
Distributed TensorFlow : 分散処理用フレームワーク
![Page 10: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/10.jpg)
10
TensorFlowとは?
これも (恐らく )TensorFlowhttps://cloudplatform.googleblog.com/2016/02/Google-Cloud-Vision-API-enters-beta-open-to-all-to-try.html
![Page 11: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/11.jpg)
11
TensorFlowとは?
これも (恐らく ) TensorFlow
![Page 12: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/12.jpg)
12
実用的かつ、話題性も高い
この SWでゼロから作ってみよ
う!
![Page 13: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/13.jpg)
13
Demo
(類似商品検索機能 )
![Page 14: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/14.jpg)
14
実装機能 :1.ショッピングサイトの画像を Inputに学習2.学習結果を元に、 Inputの画像がどのカテゴリか判別する
3.同一カテゴリの写真を推薦する (rails内処理 )※対応カテゴリ : Tシャツ , ワンピース , トップス , パンツ , スカート , 帽子 , スカーフ , 靴 , ネイル , コスチューム
削除
![Page 15: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/15.jpg)
15
アプリケーション概要(データ準備)
page=1 page=2 page=3 page=4 page=5
学習用データ
検証用データ
画像 :ラベル : 0
10
※サブカテゴリを 0/1の配列に見立て該当カテゴリに bitを立てる
webサイトのあるカテゴリから画像取得サブカテ 5ページ分からスクレイピング
Tシャツ靴
ワンピース
![Page 16: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/16.jpg)
16
アプリケーション概要(学習)
web サイト
crawler
Tシャツ
学習用データ訓練用ロジック(DeepLearni
ng)スカート
評価用データ
学習済データ
![Page 17: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/17.jpg)
17
アプリケーション概要(認識)
学習済データ識別プログラム
upload カテゴリ名
該当カテゴリ画像取得
![Page 18: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/18.jpg)
18
アプリケーション概要
学習用画像 : 対象カテゴリを 4ページ分 (約 1000枚 )画像サイズは 28x28x3に変更
正確性評価 : 学習に使わない画像を用意し、正しくカテゴリを判別てきた割合で判断
ネットワークモデル : 畳込み層 x2 プーリング層 x2 全結合層 x2
繰り返し回数 : 画像を 50枚ずつ処理しながら全 8,000回学習
(200ステップ )
![Page 19: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/19.jpg)
19
目次 :
1. TensorFlow概要
2. DeepLearning基礎とTensorFlow
3. 改善に向けた試行錯誤4. まとめ
![Page 20: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/20.jpg)
20
TensorFlowのコーディングスタイルって?
# 画像分類 -学習imgtrain = ImageClassifier.train(file_path)
# 画像分類 -カテゴリ分類category = imgtrain.classify(picture_binary)
なんらかの便利クラスがあって、画像を読み込むだけが嬉しい。
![Page 21: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/21.jpg)
21
TensorFlowのコーディングスタイルって?
# 画像分類 -学習imgtrain = ImageClassifier.train(file_path)
# 画像分類 -カテゴリ分類category = imgtrain.classify(picture_binary)
なんらかの便利クラスがあって、画像を読み込むだけが嬉しい。
![Page 22: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/22.jpg)
22
実際のソースコード (抜粋 )
# 画像分類 -学習def inference(images_placeholder, keep_prob): # 畳込み層の作成 def conv2d(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
# 畳込み層の作成 with tf.name_scope('conv1') as scope: W_conv1 = weight_variable([5, 5, 3, 32]) b_conv1 = bias_variable([32]) h_conv1 = tf.nn.relu(conv2d(x_images, W_conv1) + b_conv1)…
畳込み層 ???
weight???
strides???
関連知識がないともはや意味不明
![Page 23: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/23.jpg)
23
そのため
Deep Learningの理論概要を踏まえTensorFlowのコードを説明します※ちょっと難しい話しますが、これが話題の人工知能の正体です
![Page 24: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/24.jpg)
24
Deep Learning(畳込みニューラルネットワーク )のフロー
input(画像+Label)
Tシャツ
スカート
コスチューム
スコア計算 (推論 )(inference)
誤差計算 (loss)
0 0 1 0
1 0 0 0
計算結果
正解
最適化 (training)※パラメータ調整
Training(学習 )
繰り返し処理
![Page 25: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/25.jpg)
25
TensorFlowのコード
スコア計算(推論) :inference関数
誤差計算 :loss関数最適化 (training):training関数
input(画像+ラベル )読み込み
繰り返し処理
さきほど基本的なフローを踏まえたプログラム構成となる
![Page 26: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/26.jpg)
26
TensorFlowのコード
スコア計算(推論) :inference関数
誤差計算 :loss関数最適化 (training):training関数
input(画像+ラベル )読み込み
繰り返し処理
さきほど基本的なフローを踏まえたプログラム構成となる
![Page 27: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/27.jpg)
27
スコア計算(推論) :inference
・畳込みニューラルネットワークでスコア計算「畳込み層」と「プーリング層」「全結合層」等で構成脳の視覚野を模倣し、画像の特徴を抽出する計算方法Deep Learinngと呼ばれているものの正体の一つ
畳込み層 畳込み層プーリング層
プーリング層
全結合層
![Page 28: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/28.jpg)
28
イメージ => 画像にフィルタなどをかけて特徴を抜き出す 「 xx層」というのはその種類だと想像して下さ
い
http://cs.stanford.edu/people/karpathy/convnetjs/demo/cifar10.html
![Page 29: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/29.jpg)
29
スコア計算(推論) :inference – 畳込み層
• フィルタ (weight)を使って特徴的な領域を抜き出す• training(最適化 )ではフィルタ (weight)の値を調整する
# 畳み込み層の作成def conv2d(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
# 畳込み層の作成with tf.name_scope('conv1') as scope: W_conv1 = weight_variable([5, 5, 3, 32]) b_conv1 = bias_variable([32]) h_conv1 = tf.nn.relu(conv2d(x_images, W_conv1) + b_conv1)
![Page 30: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/30.jpg)
30
0.40.1 0.30.20.4
0.1 0.30.2
スコア計算(推論) :inference – 畳込み層
32 431 501 3
0.1 0.30.2 0.4
2.5 2*0.1 + 3*0.3+1*0.2+3*0.4
・・・
4.12.53.81.2
計算イメージ
Input(画像等 )
フィルタ Output
画像イメージ
http://cs231n.github.io/convolutional-networks/
様々な画像フィルタ(weight)で特徴を抽
出
これをいい感じに修正するのが目的
![Page 31: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/31.jpg)
31
スコア計算(推論) :inference – プーリング層
• 畳込み層の次に位置して、画像をサンプリングする• 特徴の位置が変化しても対応できるようにするため• 学習によって変化するパラメータは存在しない
# プーリング層の作成def max_pool_2x2(x): return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],strides=[1, 2, 2, 1], padding='SAME')
# プーリング層の作成with tf.name_scope('pool1') as scope: h_pool1 = max_pool_2x2(h_conv1)
![Page 32: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/32.jpg)
32
スコア計算(推論) :inference – プーリング層
32 431 501 3
3 最大の数値を抽出
・・・
5331
計算イメージ
Input(画像等 )
Output
画像イメージ
http://cs231n.github.io/convolutional-networks/
2x2ずつ抽出
453
1 0 3 3
![Page 33: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/33.jpg)
33
スコア計算(推論) :inference – 全結合層
• 抽出した特徴量を元に、最終的な区分を出力する• softmaxという計算をすることによって割合を出力
# 全結合層の作成with tf.name_scope('fc2') as scope: W_fc2 = weight_variable([1024, NUM_CLASSES]) b_fc2 = bias_variable([NUM_CLASSES])
# ソフトマックス関数による正規化with tf.name_scope('softmax') as scope: y_conv=tf.nn.softmax(tf.matmul(h_fc1_drop, W_fc2) + b_fc2)
![Page 34: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/34.jpg)
34
スコア計算(推論) :inference – 全結合層
計算イメージ
画像イメージ
http://cs231n.github.io/convolutional-networks/
サラブレッド 50%ポニー 37%
・・・
3231
0.1 0.30.2 0.4
4.12.53.81.2
Input(画像等 )
フィルタ
60.312.1
44.73.3
exp norm
強いところはより強く!
50 %10 %
37%3%
3231
3231
3231
![Page 35: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/35.jpg)
35
TensorFlowのコード
スコア計算(推論) :inference
誤差計算 :loss関数最適化 (training):training関数
input(画像+ラベル )読み込み
繰り返し処理
さきほど基本的なフローを踏まえたプログラム構成となる
![Page 36: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/36.jpg)
36
イメージ => 正解データと計算結果を比較して、どれくらい正解しているかを計算
計算結果 正解
同じネコ科だから 60 点
![Page 37: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/37.jpg)
37
誤差計算 :loss – 交差エントロピー
• 交差エントロピーという手法を実装• 正解ラベルと算出した値を比較し誤差算出
def loss(logits, labels): cross_entropy = -tf.reduce_sum(labels * tf.log(tf.clip_by_value(logits,1e-10,1.0))) return cross_entropy
計算イメージ
馬ポニー猫・・・
☓
計算結果
0.650.120.01
正解ラベル
馬ポニー猫
010
馬ポニー猫
-0.18-0.92-2
計算結果 (LOG)
☓ -1 = 0.92
![Page 38: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/38.jpg)
38
TensorFlowのコード
スコア計算(推論) :inference
誤差計算 :loss関数最適化 (training) :training関数
input(画像+ラベル )読み込み
繰り返し処理
さきほど基本的なフローを踏まえたプログラム構成となる
![Page 39: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/39.jpg)
39
イメージ => lossの値を元にフィルタ (weight)の値を最適化
Loss
最適値
![Page 40: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/40.jpg)
40
最適化 :training
• lossの結果を最小化するようにweightを変更する• 代表的な最適化関数としては以下のものがある
1. GradientDescentOptimizer⇒ 確率的勾配降下法という手法。確実だが遅い
2 . AdamOptimizer⇒Adamという手法。比較的早く、収束にも問題ない⇒基本こちらを使い、問題がある場合のみ他のOptimizerを試す
def training(loss, learning_rate): train_step = tf.train.AdamOptimizer(learning_rate).minimize(loss) return train_step
![Page 41: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/41.jpg)
41
• TensorFlowコードとDeep Learning理論は繋がっている
• ただし内容は四則演算で充分理解できるものなので恐れずに
⇒とはいえ理論語るには全く時間が足りないので、もっと詳しく知りたい方は別途お声がけ下さい。講師とかやります
![Page 42: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/42.jpg)
42
ちなみに・・・
• 学習済みモデルをつかえば簡単に書くことはできます (cifar10モジュールを利用 )• チューニングは理論を知らないと厳しいですが
images, labels = cifar10.distorted_inputs() logits = cifar10.inference(tf.image.resize_images(images,28,28)) loss = cifar10.loss(logits, labels) train_op = cifar10.train(loss, global_step)
![Page 43: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/43.jpg)
43
目次 :
1. TensorFlow概要
2. TensorFlow コーディング概要
3. 改善に向けた試行錯誤4. まとめ
![Page 44: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/44.jpg)
44
実行ログ
NNNN:crawl usr0102044$ python cnn.py step 0, training accuracy 0.0981432step 1, training accuracy 0.0848806step 2, training accuracy 0.0928382step 3, training accuracy 0.116711step 4, training accuracy 0.108753step 5, training accuracy 0.145889・・・step 199, training accuracy 0.3138302step 200, training accuracy 0.30504
• 学習が進むたび正解率があがっていく• しかし 30 %前後から accuracyが上がらなくなる
![Page 45: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/45.jpg)
45
実行ログ(学習データと正解性評価データが同一の場合)
NNNN:crawl usr0102044$ python cnn.py step 0, training accuracy 0.130965・・・step 199, training accuracy 0.950159step 200, training accuracy 0.950159
• こちらは 95%の正解率⇒ 与えられたデータには適合できるが未知のデータには不適合
![Page 46: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/46.jpg)
46
チューニング案
1.データ数増加
2.画像サイズ+フィルタサイズ増
3.画像に揺らぎ ( 歪み )を与える
![Page 47: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/47.jpg)
47
1.データ数増加
• 多くの画像パターンに対応させるため Inputを多くする• 5ページ分から15ページ分(3倍)の画像に対応する
![Page 48: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/48.jpg)
48
2.画像サイズ+フィルタサイズ増
• そもそも 28x28の画像サイズは人間が見てもわからない• ただし画像サイズを2倍すると行列は 4 倍になる• 計算量を考え2倍の 56x56で学習させる
![Page 49: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/49.jpg)
49
3.画像に揺らぎ ( 歪み )を与える
• 一つの画像を加工し、いろいろな画像を生成する• 切り出し、反転、色調変化など• 加工するため同時にデータ数も増加する
やりすぎ!
![Page 50: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/50.jpg)
50
結果
(通常)
データ増加
画像サイズ
揺らぎ
accuracy 実行時間
30.3%
50.1%
30.5%
34.2%
約 1 時間
約 4 時間
約 2.5 時間
約 4 時間
データ増加については著しい成果ありある程度までは、学習のためには大きなデータセットが必要
⇒いろいろな手法があるが、まずは訓練データ!
![Page 51: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/51.jpg)
51
さらなる改善に向けて
1.ネットワークモデル変更
2.速度改善
![Page 52: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/52.jpg)
52
更なる改善案 (1) ネットワークモデル変更
• ネットワークモデルとは前述した各層の組み合わせのこと• 著名なネットワークモデルは公表されているため、これに
置き換えることによって成果を上げることが可能
![Page 53: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/53.jpg)
53
更なる改善案 (1) 著名なネットワークモデル
層数合計
8 ILSVRC 2012AlexNet
GoogLeNet 19
ResNet 152(!)
備考
内容は公開されており実装することは難しくはないただし、最近のものは非常に複雑なため実装難易度も上がる
エラー率
16.4 %
6.7 %
3.57 %
ILSVRC 2014
ILSVRC 2015
(今回使用) 4
![Page 54: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/54.jpg)
54
更なる改善案 (1) 層数とエラー率の関係
層数を単純に増やせばいいものではないなにが効果あるのかは試行錯誤するしかないのが現状
http://cs231n.stanford.edu/slides/winter1516_lecture7.pdf
![Page 55: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/55.jpg)
55
GPUの特徴 処理能力は遅いがコア数が多い (数千 ) 軽い処理を並列処理するのが得意 逆に CPUはシーケンシャルな処理が得意
今回のような小さなデータセットですら 4 時間程度かかるGPUを使えば高速学習可能
Deep Learningの正体は大量の行列演算行列は簡単で並列実施可能な計算の塊のためGPUが
得意
更なる改善案 (2) 速度改善
![Page 56: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/56.jpg)
56
更なる改善案 (2) 速度改善
(通常)
実行時間
59:52
GPU使用時 04:21※AWS g2.2xlarge使用
• 4GB GPUを使うことにより性能が 15 倍近く向上 (マシンスペックの差もあるので一概には言えないが )
• TensorFlow 上のコードには修正なし• 「試行錯誤」必須なためGPU利用も必須
マシンスペック GPU
CPU: i5 1.6GHzMEM: 8GB ー
CPU: Xeon E5 8vCPUMEM: 15GB
GRID K5204GB
![Page 57: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/57.jpg)
57
目次 :
1. TensorFlow概要
2. DeepLearning基礎とTensorFlow
3. 改善に向けた試行錯誤4. まとめ
![Page 58: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/58.jpg)
58
• TensorFlowは敷居が低いわけではない
• 実装、チューニングなどは理論知識がないと辛い
• チューニングも試行錯誤を繰り返すしかない
• そのため開発スタイルも多人数ではなく、少人数
で数多く回すスタイルになる
まとめ
![Page 59: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/59.jpg)
59http://cs231n.stanford.edu/slides/winter1516_lecture12.pdf
• Feature extraction / finetuning existing models: Use Caffe
• Complex uses of pretrained models: Use Lasagne or Torch
• Write your own layers: Use Torch• Crazy RNNs: Use Theano or Tensorflow• Huge model, need model parallelism: Use
TensorFlow
Þ単一で TensorFlowが圧倒的優位というわけではない
参考:スタンフォード大学講義より各種フレームワーク比較
![Page 60: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/60.jpg)
60https://cloud.google.com/ml/
TensorFlowが使えるクラウドサービス発表
Googleの取組み
![Page 61: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/61.jpg)
61
Google Cloud Machine LearningTensorFlowを実行できるクラウドサービス
透過的に実行環境の増強が可能
ノードの追加は自由に変更
10GB 4500 万行を 9 時間→30分強まで短縮
![Page 62: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/62.jpg)
62
Google 謹製ということで
複数サービスの組み合わせで
優位性を生み出してきそう
![Page 63: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/63.jpg)
63
デファクトスタンダードの可能性は
高いので引き続き追い続けましょう
![Page 64: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/64.jpg)
64
何より理論学習を続けましょう!
![Page 65: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/65.jpg)
65
一人だと寂しいので
勉強仲間も募集してます
![Page 66: Deep Learning基本理論とTensorFlow](https://reader031.fdocument.pub/reader031/viewer/2022021922/58776f891a28ab5b568b571d/html5/thumbnails/66.jpg)
66
ご清聴ありがとうございました