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
CoreMLではじめる機械学習
Search
naru-jpn
June 21, 2017
Technology
0
1.3k
CoreMLではじめる機械学習
Neural Networks on Keras ( TensorFlow backends )
naru-jpn
June 21, 2017
Tweet
Share
More Decks by naru-jpn
See All by naru-jpn
配信アプリのためのリアルタイムプッシュ通知ぼかしの夢
narujpn
3
1k
PiPを応用した配信コメントバー機能の開発秘話と技術の詳解 / pip_streaming_comment_bar
narujpn
3
4.6k
Updating an App to Use Swift Concurrency 解説
narujpn
2
370
PiP で実現するミラティブの配信コメントバー / pip-streaming-comment-bar
narujpn
0
1.3k
App Extension のスタックトレース情報からクラッシュを解析/集計する / Analyzing app extension's stack trace
narujpn
3
1.7k
ミラティブとWebRTC - WebRTC framework の中身を覗いてみよう / WebRTC framework AudioUnit Processing
narujpn
1
2.2k
CoreML3のオンデバイストレーニングでつくる母音推定
narujpn
0
470
AltConfと周辺の歩き方
narujpn
0
2k
エンジニア経験を活かしたスクラムマスターとして 開発チームとプロダクトを成長させる
narujpn
1
430
Other Decks in Technology
See All in Technology
AIで 浮いた時間で 何をする? 2026春 #devsumi
konifar
16
3.2k
vol11_ねこIoTLT_お遊びVibeCoding
1027kg
0
180
I tried making an AI manzai comedy act with "boke" and "tsukkomi" using Strands Agents
zzzzico
1
180
Agent Skills 入門
puku0x
0
930
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
57
47k
AIに視覚を与えモバイルアプリケーション開発をより円滑に行う
lycorptech_jp
PRO
1
530
20260222ねこIoTLT ねこIoTLTをふりかえる
poropinai1966
0
210
Interop Tokyo 2025 ShowNet Team Memberで学んだSRv6を基礎から丁寧に
miyukichi_ospf
0
190
AWS Bedrock Guardrails / 機密情報の入力・出力をブロックする — Blocking Sensitive Information Input/Output
kazuhitonakayama
2
170
バニラVisaギフトカードを棄てるのは結構大変
meow_noisy
0
130
なぜAIは組織を速くしないのか 令和の腑分け
sugino
40
21k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
94k
Featured
See All Featured
My Coaching Mixtape
mlcsv
0
61
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Evolving SEO for Evolving Search Engines
ryanjones
0
140
What's in a price? How to price your products and services
michaelherold
247
13k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
620
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
310
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
850
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
470
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Ruling the World: When Life Gets Gamed
codingconduct
0
160
Transcript
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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠