Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
TFv1.0の概要+HighLevelAPI/Keras
Search
Norihiro Shimoda
March 20, 2017
Technology
4
2.1k
TFv1.0の概要+HighLevelAPI/Keras
Recap of TF Dev Summit(
https://tfug-tokyo.connpass.com/event/52643/
) での発表資料
Norihiro Shimoda
March 20, 2017
Tweet
Share
More Decks by Norihiro Shimoda
See All by Norihiro Shimoda
ぼくのかんがえたさいきょうの機械学習プロジェクト進行法(PoC/デモ編)
rindai87
10
19k
FindYourCandyでの転移学習の話
rindai87
4
15k
Google I/O 報告会(ML)担当
rindai87
3
9.6k
最近のTensorFlowの話
rindai87
1
1.5k
TensorFlowとGCPの簡単な紹介
rindai87
3
4.6k
TensorFlowの基礎
rindai87
2
4.4k
How should engineers survive during AI era
rindai87
5
27k
Let's stand up against "Do Artificial Intelligence" with proper knowledge
rindai87
6
1.9k
Talk about ML and DL for happy engineer's life
rindai87
40
15k
Other Decks in Technology
See All in Technology
『OCI で学ぶクラウドネイティブ 実践 × 理論ガイド』 書籍概要
oracle4engineer
PRO
2
140
生成AI_その前_に_マルチクラウド時代の信頼できるデータを支えるSnowflakeメタデータ活用術.pdf
cm_mikami
0
120
10年の共創が示す、これからの開発者と企業の関係 ~ Crossroad
soracom
PRO
1
600
Goに育てられ開発者向けセキュリティ事業を立ち上げた僕が今向き合う、AI × セキュリティの最前線 / Go Conference 2025
flatt_security
0
360
"プロポーザルってなんか怖そう"という境界を超えてみた@TSUDOI by giftee Tech #1
shilo113
0
130
職種別ミートアップで社内から盛り上げる アウトプット文化の醸成と関係強化/ #DevRelKaigi
nishiuma
2
140
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
3
20k
Adapty_東京AI祭ハッカソン2025ピッチスライド
shinoyamada
0
100
いまさら聞けない ABテスト入門
skmr2348
1
210
生成AIを活用したZennの取り組み事例
ryosukeigarashi
0
210
SOC2取得の全体像
shonansurvivors
1
510
「Verify with Wallet API」を アプリに導入するために
hinakko
1
250
Featured
See All Featured
Site-Speed That Sticks
csswizardry
11
890
The Straight Up "How To Draw Better" Workshop
denniskardys
237
140k
Done Done
chrislema
185
16k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.5k
Embracing the Ebb and Flow
colly
88
4.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
20k
Producing Creativity
orderedlist
PRO
347
40k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Transcript
Overview of TF v1.0 + High Level API / Keras
Norihiro Shimoda
⾃自⼰己紹介 • Norihiro Shimoda(@rindai87) • TensorFlow User Group(TFUG)主催者 • 最近GDE(Google
Developer Expert)の ML Expertになりました
Agenda • TensorFlowの概要 • TensorFlow v1.0の概要 • High Level API
/ Keras
TensorFlowの概要
TensorFlowとは? • Googleがオープンソース化した機械学習 のライブラリ • 2015年年11⽉月に公開 • Google社内でも実際に使われている(と ⾔言われている)
TensorFlowのモデル 1. 学習モデルをグラフとし て定義する 2. 学習を実際にどう⾏行行うか も定義する – 学習の評価⽅方法 –
最適化の⽅方法 – CPU or GPU – スタンドアロン or 分散 3. 定義に従って計算処理理を デバイス上で実⾏行行させる
TensorFlowの歴史
TensorBoardなどのツール
その他のTensorFlow情報 1. Google内でのTensorFlow 2. TensorFlowの事例例 3. TensorFlowコミュニティ 4. 企業でのTensorFlow
TensorFlow v1.0の概要
V1.0を三⾏行行でまとめると… Fast Flexible Production-‐‑‒ready
三⾏行行まとめをもう少し詳しく • Fast – めっちゃパフォーマンス良良くなりました • Flexible – ⾼高レベルAPIが本格的に導⼊入されました •
Production-‐‑‒ready – APIは安定させます • その他もいろいろあります – デバッガ(tfdbg)、多⾔言語対応など
Fast • パフォーマンスの⼤大幅な向上 – 64GPU上でのInception v3の処理理が58倍⾼高 速になった! • XLAの導⼊入 –
Accelerated Linear Algebraの略略 – コンパイラ – この後のセッションで詳細を話します https://developers-‐‑‒jp.googleblog.com/2017/03/xla-‐‑‒tensorflow-‐‑‒compiled.html
Flexible • High Level APIの本格的な導⼊入 – この後詳細をお話します • Kerasとの統合 –
割と個⼈人的にはビッグニュース
Production Ready • APIの安定化 – V0.11, v0.12辺りの混乱が収束するはずJ – が、後⽅方互換性崩れてますL –
が、移⾏行行ツールが提供されていますJ https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/compatibility
その他 • デバッガ(tfdbg) – 待望のデバッグツール – まだちゃんと触れていませんが期待⼤大 • 多⾔言語対応 –
JavaとGoがExperimentalながら対応
High Level API / Keras
TensorFlowの超基本 1. ⼊入⼒力力⽤用にplaceholderを⽤用意 2. 重みやバイアス⽤用にVariableを⽤用意 3. 活性化関数を使って層を定義 4. ロス値を定義 5.
最適化の⽅方法を定義 6. セッションを定義して学習を実⾏行行
この後のサンプルコード • わかりやすくDNN – 隠れ層3層で全て全結合層 – ユニット数は10,20,10 • サンプルデータとしてはirisデータ –
クラス数は3 – 特徴量量の次元数は4 • サンプルコード⾃自体はQiitaで解説付きで 公開しています http://qiita.com/rindai87/items/72651c702e9265595047
None
None
⽣生TensorFlow⾟辛い問題 • APIがけっこう低レベルなため、アルゴリ ズム構築に集中したい⼈人には⾮非常に敷居 が⾼高い – TensorFlowのパラダイムへの理理解が必須 – そのため、学習コストが⾼高い •
PlaceholderとかVariableとかSessionとか
従来の⽣生TF⾟辛い問題の解決法 • tf.contrib.learn – ⾼高レベルなAPI • Keras – TensorFlowのラッパー –
作者がGoogleの中の⼈人 • その他いろいろ – SlimとかTFLearnとか
tf.contrib.learn • V1.0以前から導⼊入されていた⾼高レベルAPI – 今も残っていて現役で使える • もともとはSkFlowという外部ライブラリ – scikit-‐‑‒learnライクにTF使いましょう、という コンセプト
• V0.8からTF本体に取り込まれて TFLearn(tf.contrib.learn)となる
None
Keras • TensorFlowとTheanoのラッパーライブ ラリ • ネットワークを直感的に記述できる – ⽣生TFのようにTensorFlowの流流儀を覚える必 要がない •
アルゴリズム側に集中したい⼈人にとって は良良い選択肢 • 全機能がラップされているわけではない
None
V1.0で⾊色々整理理されはじめます • V1.0で混沌としていた⾼高レベルAPI周りの 整理理とロードマップの提⽰示が⾏行行われまし た – Layers – Estimator •
Kerasを正式にサポート – そもそもKerasの中の⼈人はGoogler
None
Layers • モデル(ネットワーク)を定義するため のAPI群 • Kerasのように直感的にモデルを記述して いくことができる • Variableの概念念は登場しない –
Layersのオブジェクトを直接触ることも可能 なので、その場合はPlaceholderは登場する
Layersのイメージ Input (4dim) hidden1 hidden2 hidden3 Output (3classes) IrisデータをDNNでモデルを 作る簡単な例例で⾒見見てみる
・4次元データ ・クラスは3 ・隠れ層は3層
Layersのイメージ input hidden1 hidden2 hidden3 output input_̲layer=tf.reshape(features, [-‐‑‒1, 4])
Layersのイメージ input hidden1 hidden2 hidden3 output hidden1=tf.layers.dense( inputs=input_̲layers, units=10,
activation=tf.nn.relu) input_̲layer=tf.reshape(features, [-‐‑‒1, 4])
Layersのイメージ input hidden1 hidden2 hidden3 output hidden1=tf.layers.dense( inputs=input_̲layers, units=10,
activation=tf.nn.relu) input_̲layer=tf.reshape(features, [-‐‑‒1, 4]) hidden2=tf.layers.dense(…) hidden3=tf.layers.dense(…)
Layersのイメージ input hidden1 hidden2 hidden3 output hidden1=tf.layers.dense( inputs=input_̲layers, units=10,
activation=tf.nn.relu) input_̲layer=tf.reshape(features, [-‐‑‒1, 4]) output_̲layer=tf.layers.dense( inputs=hidden3, units=3) hidden2=tf.layers.dense(…) hidden3=tf.layers.dense(…)
Estimator • モデルを使った学習、評価、推論論のタス クを記述するための標準的なインター フェイスを提供するAPI群 • Scikit-‐‑‒learn経験者にはおなじみにイン ターフェース+α – fit():学習
– evaluate():評価 – predict():推論論 – etc…
Estimatorのイメージ input Model output 実際はこれだけではなくて
Estimatorのイメージ input Model Training 記述したモデルを使って 学習、(学習モデルの)評価、推定を⾏行行う Evaluation Prediction
Estimatorのイメージ input Model Training 学習、評価、推定に関わるタスクは全てEstimator内に 隠蔽して標準的なインターフェースを提供 TensorFlowの種々の概念念もEstimator内に内包 Evaluation Prediction fit()
evaluate() predict() session graph etc… Estimator
Canned Estimator • Layers, Estimatorのお陰で、モデルに対 して標準的なインターフェースが提供さ れている状態になる • これを利利⽤用して、様々なEstimator(つま りアルゴリズム)を提供していく
– インターフェースが共通化されているので、 同⼀一データに対して様々なアルゴリズムを簡 単に試せるようになる • おっとこれはscikit-‐‑‒learnな感じですね、 と思ったあなた、正解です
Kerasの正式サポート • LayersをKerasの層を定義するレイヤー (Denseなど)と互換性のあるものとする • EstimatorとKerasでの互換性を担保する 設計 • これまで通りTFをラップしたKeras •
tf.kerasの導⼊入により、TF内部でkerasのコードが 動くようになる?
Keras正式サポートの恩恵 • 今までKerasから使えていなかった各種TFの 機能が使えるようになる – 分散処理理による学習 – CloudMLでの実⾏行行 • これまではCloudMLのプロビジョニングの段階でKeras
をpip installするというハックで解決していた • なお、この解決⽅方法を使ってもKerasからはGCSに置い ているデータを読みにいけないという問題が残っている – TensorFlow Serving – etc…
None
Thank you!!