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
JavaScriptでもディープラーニングってやつでなんとかして / Kyoto.js 15
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
spring_raining
January 12, 2019
Technology
2.3k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScriptでもディープラーニングってやつでなんとかして / Kyoto.js 15
spring_raining
January 12, 2019
More Decks by spring_raining
See All by spring_raining
Webフレームワークとともに利用するWeb components / JSConf.jp おかわり
spring_raining
2
430
CSS Variable をもっと活用する / Kyoto.js 18
spring_raining
4
1.9k
Vivliostyle CLIで広がるCSS組版のエコシステム / Vivliostyle user & developer meetup 2020 autumn
spring_raining
0
2.8k
Markdownの複雑化と締め切りのはざまで / Vivliostyle meetup
spring_raining
0
1.1k
CSS組版の救世主 Vivliostyle / HTML5 Conference 2018
spring_raining
6
8.7k
印刷・出版のためのオンラインエディタ Viola / Viola - Online editor for printing and publishing
spring_raining
3
770
Printable Web
spring_raining
3
1k
今こそCSS組版
spring_raining
5
2.7k
シン・サーバの形は。
spring_raining
0
400
Other Decks in Technology
See All in Technology
[RSJ26] NarrativeFlow: Flow-Based Vision-Language-Action Model Using Robot Velocity Fields
keio_smilab
PRO
0
150
20260903 Tokyo Jazug Night #62 | Azure エンジニアよ、 その環境は本当にセキュアか?
olivia_0707
1
610
スクラムで身についていた動き方を、XPで捉え直してみた
codmoninc
PRO
1
190
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
390
PdMをやめて、 "プロダクトビルダー"という 働き方に変えました / PdM to Product Builder
shikichee
2
700
DINO-EdgeQuery:Edge-First Polygon Decoding for Building Footprint Extraction from Satellite Imagery
lehupa
0
140
Level Up Your CDK DX: 5 Tools I’ve Been Building
gotok365
2
190
全員がプロダクトへ向き合う組織を持続成長させるために——組織づくりのフライホイールと4象限 / The Flywheel Model and Four Quadrants for Organizational Design
hiro_torii
3
790
Genie Code ワークショップ 基礎編 / Genie-Code-Workshop-fundamental
databricksjapan
PRO
0
340
DMMブックスのNext.js化を加速させるAI活用 / Migrating DMM Books to Next.js with AI
kentarom
1
330
[RSJ26] Building a VLA Model Based on Self-Distilled Classification
keio_smilab
PRO
0
190
AIとペアプロを始める。人とのペアプロをやめる。ペアプロの良さを改めて知る。もっと好きになった。 / Rediscovering Pair Programming
honyanya
1
200
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
290
A Tale of Four Properties
chriscoyier
163
24k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
430
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
What's in a price? How to price your products and services
michaelherold
247
13k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
370
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
510
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
510
Transcript
ディープラーニングってやつで なんとかして!!!! 2019/1/12 Kyoto.js 15 @spring_raining +BWB4DSJQUͰ
自己紹介 • Twitter: @spring_raining / GitHub: spring-raining • 「はるさめ」とお呼びください •
大阪の大学院生 • フォントの研究をしている
https://qiita.com/taizan/items/cf77fd37ec3a0bef5d9d
https://www.youtube.com/watch?v=AXAouosx95Y
なんかすごそう
https://twitter.com/mizuasato/status/771316117746823170
ディープラーニングの 計算
https://www.blog.google/products/google-cloud/google-cloud-offer-tpus-machine-learning/
https://www.blog.google/products/google-cloud/google-cloud-offer-tpus-machine-learning/ 普通のPCでは 無理?
学習と推論 • 機械学習の実利用は大まかに分けると2フェーズ 学習 推論 とはいえ推論でも計算速度は必要 データセットから目的に あった推論モデルを学習 大量のデータと潤沢な 計算機環境で殴り合う
修羅の世界 推論モデルを使って 未知の入力に対して推論 Webブラウザでも 実現可能な計算量
GPUはいいぞ • ディープラーニングは並列可能で簡単な計算を大量 にこなす必要がある CG処理と似ているのでは? GPU使おう! • JavaScriptでGPUを使うことができるものといえば・・・
WebGL
WebGLを使った計算 • 推論結果はいくつもの計算を経て 出力される • 各ステップの計算を1つのWebGL シェーダとして実行 テンソル
WebDNN • WebDNN[1] を使うと、用意した 推論モデルから各バックエンド (WebGL/WebGPU/WASM) 向けの実行コードを生成してく れる • 生成される実行コードはどのよ
うなものか? [1] https://github.com/mil-tokyo/webdnn パラメータデータ モデル定義 実行コード
例: Convolutional Neural Networks • Convolutional = 畳み込み • 画像を扱うディープラーニングでよく出る
0 1 0 0 0 2 2 0 3 1 0 2 2 0 1 2 3 0 1 1 0 2*1+3*0+0*0+1*1
例: Convolutional Neural Networks • Convolutional = 畳み込み • 画像を扱うディープラーニングでよく出る
0 1 0 0 0 2 2 0 3 1 0 2 2 0 1 2 5 3 0 1 1 0
例: Convolutional Neural Networks • Convolutional = 畳み込み • 画像を扱うディープラーニングでよく出る
0 1 0 0 0 2 2 0 3 1 0 2 2 0 1 2 1 5 3 0 1 1 0
例: Convolutional Neural Networks • Convolutional = 畳み込み • 画像を扱うディープラーニングでよく出る
0 1 0 0 0 2 2 0 3 1 0 2 2 0 1 2 1 2 2 5 3 0 3 0 3 0 1 1 0
• 畳み込み層の計算は2つの計算からなる uniform sampler2D v3; void main() { ivec4 col
= pos(gl_FragCoord.yx, ...); int n = col.x; int h2 = col.y; int w2 = col.z; int khkwc1 = col.w; int kh = khkwc1 / 64 / 4; int kw = khkwc1 / 64 - kh * 4; int c1 = khkwc1 - (kh * 4 + kw) * 64; gl_FragColor.r = (texture2D(v3, pos(c1 + 0, ...))).r; gl_FragColor.g = (texture2D(v3, pos(c1 + 1, ...))).r; gl_FragColor.b = (texture2D(v3, pos(c1 + 2, ...))).r; gl_FragColor.a = (texture2D(v3, pos(c1 + 3, ...))).r; } WebGLを使った並列計算 0 2 2 3 1 0 2 0 1 0 1 0 0 2 2 3 1 0 2 2 0 1 0 2 0 1 2 1 0 0 2 2 0 1 0 2 0 1 0 0 0 2 2 0 3 1 0 2 2 0 1 2 Im2Col
• 畳み込み層の計算は2つの計算からなる uniform sampler2D v3; uniform sampler2D v5; void main()
{ ivec2 pos_c = pos(gl_FragCoord.yx, ...); int m = pos_c.x; int n = pos_c.y; float v = 0.0; for (int k = 0; k < 256; k++) { vec4 v_a = texture2D(v3, vec2(k, m)); vec4 v_b = texture2D(v5, vec2(k, n)); v += dot(v_a, v_b); } gl_FragCoord.r = v; } WebGLを使った並列計算 0 2 2 3 1 0 2 0 1 0 1 0 0 2 2 3 1 0 2 2 0 1 0 2 0 1 2 1 0 0 2 2 0 1 0 2 Tensordot 画像の1ピクセル = 行列の1要素 とみなしてWebGLを活用
Python library for deep learning
JS library for inference engine 他にもあるかも (no longer active) brain.js
None
https://onnx.ai
JS library for inference engine ? .js
結局どれ使えばいいの 学習機能 読込対応モデル バックエンド コメント TensorFlow.js (★10,145) ◦ TensorFlow/ Keras
WebGL 情報豊富 brain.js (★8,703) ◦ ×[1] WebGL (gpu.js使用) サイズ小さい (19KB) WebDNN (★1,523) × いろいろ[2] WebGL/WebGPU/ WASM 推論専用/多彩 なバックエンド TensorFire ? ? ? 情報がなさす ぎる… Keras.js (★4,417) × Keras WebGL TensorFlow.js 使いましょう ONNX.js (★571) ×? いろいろ WebGL/WASM? まだはやい [2] Chainer, TensorFlow, Keras, PyTorch, Caffe以外はONNX経由 [1] JSONで書き出し・読み込み可能