Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
CoreMLではじめる機械学習
Search
naru-jpn
June 21, 2017
Technology
1.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CoreMLではじめる機械学習
Neural Networks on Keras ( TensorFlow backends )
naru-jpn
June 21, 2017
Transcript
23 slides
CoreMLͰ͡ΊΔػցֶश Neural Networks on Keras ( TensorFlow backends ) Timers
inc. / Github: naru-jpn / Twitter: @naruchigi
CoreMLͰ͡ΊΔػցֶश Timers inc. / Github: naru-jpn / Twitter: @naruchigi Neural
Networks on Keras ( TensorFlow backends )
What is Neural Networks?
One of machine learning models. - Neural networks - Tree
ensembles - Support vector machines - Generalized linear models - … https://developer.apple.com/documentation/coreml/converting_trained_models_to_core_ml
What is Keras?
Theano TensorFlow Keras Keras is a high-level neural networks API,
written in Python and capable of running on top of either TensorFlow, CNTK or Theano. https://keras.io
What is CoreML?
Accelerate and BNNS Metal Performance Shaders CoreML BNNS : Basic
Neural Network Subroutines https://developer.apple.com/documentation/coreml With Core ML, you can integrate trained machine learning models into your app. Core ML requires the Core ML model format.
CoreML Trained Model Application Keras Train coremltools
What is coremltools?
Convert existing models to .mlmodel format from popular machine learning
tools including Keras, Caffe, scikit-learn, libsvm, and XGBoost. https://pypi.python.org/pypi/coremltools coremltools
CoreML Trained Model Application Keras Train coremltools
(Demo App)
Environment - Tensorflow 1.1.0 (virtualenv) - Keras 1.2.2 - coremltools
0.3.0 - Xcode 9.0 beta ※ Tensorflow, Keras coremltools ͷରԠόʔδϣϯͰ͋Δඞཁ͕͋ΔͷͰগ͠ݹ͍Ͱ͢ɻ
Programs to train neural networks - mnist_mlp.py - mnist_cnn.py ※
Keras ͷ࠷৽όʔδϣϯͷϦϯΫʹͳ͍ͬͯ·͕͢ɺ࣮ࡍόʔδϣϯ 1.2.2 Λࢀর͠·͢ɻ https://github.com/fchollet/keras/tree/master/examples
Convert model with coremltools 1. Import coremltools import coremltools model
= Sequential() … coreml_model = coremltools.converters.keras.convert(model) coreml_model.save("keras_mnist_mlp.mlmodel") 2. Convert model
Import model into Xcode project // 入力データ class keras_mnist_mlpInput :
MLFeatureProvider { var input1: MLMultiArray // … } // 出力データ class keras_mnist_mlpOutput : MLFeatureProvider { var output1: MLMultiArray // … } // モデル @objc class keras_mnist_mlp:NSObject { var model: MLModel init(contentsOf url: URL) throws { self.model = try MLModel(contentsOf: url) } // … func prediction(input: keras_mnist_mlpInput) throws -> keras_mnist_mlpOutput { // … keras_mnist_mlp.mlmodel Λѻ͏ҝͷίʔυ͕ࣗಈੜ͞ΕΔ
Prepare model and input in code // モデルの作成 let model
= keras_mnist_mlp() // 入力データの格納用変数 (入力は28*28の画像) let input = keras_mnist_mlpInput( input1: try! MLMultiArray(shape: [784], dataType: .double) )
Modify input value // 入力データの 0 番目の要素に 1.0 を代入 input.input1[0]
= NSNumber(value: 1.0)
Make a prediction // モデルに入力データを渡して計算 let output = try model.prediction(
input: self.input )
CoreML Trained Model Application Keras Train coremltools Recap
Demo App on Github https://github.com/naru-jpn/MLModelSample
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
More Decks by naru-jpn
See All by naru-jpn
配信アプリのためのリアルタイムプッシュ通知ぼかしの夢
narujpn
3
1.2k
PiPを応用した配信コメントバー機能の開発秘話と技術の詳解 / pip_streaming_comment_bar
narujpn
3
5.1k
Updating an App to Use Swift Concurrency 解説
narujpn
2
420
PiP で実現するミラティブの配信コメントバー / pip-streaming-comment-bar
narujpn
0
1.4k
App Extension のスタックトレース情報からクラッシュを解析/集計する / Analyzing app extension's stack trace
narujpn
3
1.9k
ミラティブとWebRTC - WebRTC framework の中身を覗いてみよう / WebRTC framework AudioUnit Processing
narujpn
1
2.3k
CoreML3のオンデバイストレーニングでつくる母音推定
narujpn
0
510
AltConfと周辺の歩き方
narujpn
0
2.1k
エンジニア経験を活かしたスクラムマスターとして 開発チームとプロダクトを成長させる
narujpn
1
460
Other Decks in Technology
See All in Technology
AWS基盤改善を支える 私たちの理念と行動指針
kentosuzuki
0
240
RAGの改善を速く回すための評価基盤
yosukeyoshida
6
2.9k
属人化したISMS運用をGitHubとAIで仕組み化した1年間の記録
sioncojp
4
2.7k
メール到達性を支える、リンク先URLのドメイン評価の扱い方
wind111
0
150
ラクスル会社紹介資料|エンジニア向け / RAKSUL Introduction for Engineers
raksulrecruiting
0
130
Linuxネットワークスタック進化の軌跡: 過去10年の歩みと最新トレンド
orimanabu
4
750
Frontier Teams — Amazon は AI で「開発のやり方」をどう変えたのか
kmotohas
0
290
Where Should Platform Complexity Live? Lessons from a Cross-Team PR Preview Platform
taiki45
0
140
SSFの現在地 ― CAEP/RISCからAI Identityへ
oidfj
0
470
エンタープライズ事業未経験のデータ屋、 AI時代にN回撃沈する.pdf
ryoskdara_
0
150
DevOps Agentにあらゆるセキュリティインシデントのトリアージを任せた件
jirtosterone
1
180
Go初心者のクラウドエンジニアが、デプロイを通して旨味を知っていく話
ryudai
1
230
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
The Pragmatic Product Professional
lauravandoore
37
7.5k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
620
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Thoughts on Productivity
jonyablonski
76
5.5k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
60k
Music & Morning Musume
bryan
48
7.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k