SlideShare a Scribd company logo
1 of 34
Download to read offline
©2021 Yahoo Japan Corporation All rights reserved.
import CoreML
そろそろ Core ML を使いませんか︖
ヤフー株式会社 CTO室アプリ統括部iOSアプリWG
⼤⻄智也
©2021 Yahoo Japan Corporation All rights reserved.
近年のWWDCでは
ARKit・Metal・Core ML の発表が多いですが、
業務に直接関係ないからといって、
スルーしがちではありませんか︖
2
©2021 Yahoo Japan Corporation All rights reserved.
今後の発表を少しでも有意義に⾒れるように、
Core ML の全体像をお伝えします
3
©2021 Yahoo Japan Corporation All rights reserved.
⼤⻄智也
iOSエンジニア
ヤフー株式会社 CTO室 アプリ統括部 iOSアプリWG
Yahoo!メール → ヤフオク! → PayPayフリマ → 現在
ObjC, Swift, Python, Typescript, React.js, Firebase, GCP
https://github.com/TomoyaOnishi
⾃⼰紹介
4
©2021 Yahoo Japan Corporation All rights reserved.
• CoreMLの⽴ち位置
• よく聞くワードとの関係性
• TensorFlow、scikit-learn、Create ML ...
• CoreMLを使う場合、どういう流れになるのか
話すこと
5
アプリエンジニアの⽬線で話すので厳密には不正確な部分も含まれます 💦
©2021 Yahoo Japan Corporation All rights reserved.
Appleデバイス上で機械学習モデルを動かすためのframework
• CoreML 単体で何かが動くわけではない
• import CoreML すればオブジェクト認識できるわけではない
• 機械学習モデルが必要
• HogeModel.mlmodel
CoreMLとは
6
©2021 Yahoo Japan Corporation All rights reserved.
.mlmodel
7
©2021 Yahoo Japan Corporation All rights reserved.
モデル︖
8
𝑖𝑛𝑝𝑢𝑡
𝑜𝑢𝑡𝑝𝑢𝑡
𝑓(𝑥)
(𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑜𝑛)
©2021 Yahoo Japan Corporation All rights reserved.
画像分類モデル
9
𝒅𝒐𝒈: 𝟎. 𝟗𝟕
𝑓(𝑥)
𝑜𝑡ℎ𝑒𝑟: 0.01
𝑐𝑎𝑡: 0.02
©2021 Yahoo Japan Corporation All rights reserved.
住宅の価格推定モデル
10
83,000𝑦𝑒𝑛
𝑓(𝑥)
住所 駅からの距離 築年数
TOKYO 1.2km 12
©2021 Yahoo Japan Corporation All rights reserved.
商品レコメンドモデル
11
𝑓(𝑥)
閲覧した商品ID
おすすめの商品
©2021 Yahoo Japan Corporation All rights reserved.
商品レコメンドモデル
12
𝑓(𝑥)
閲覧した商品ID
おすすめの商品
inputをモデルに渡すためのメソッド
©2021 Yahoo Japan Corporation All rights reserved.
商品レコメンドモデル
13
𝑓(𝑥)
閲覧した商品ID
おすすめの商品
モデルを動かし推論結果を取得するメソッド
©2021 Yahoo Japan Corporation All rights reserved.
商品レコメンドモデル
14
𝑓(𝑥)
閲覧した商品ID
おすすめの商品
Core ML は機械学習モデルを動かすためのインターフェース
©2021 Yahoo Japan Corporation All rights reserved.
コードのサンプルです
let itemID = "item_id_1"
let input = MyModelInput(input: try! MLMultiArray([itemID]))
let model = try! MyModel(contentsOf: modelURL)
let prediction = try! model.prediction(input: input)
print(prediction) // item_id_5 item_id_7,
©2021 Yahoo Japan Corporation All rights reserved.
イメージで掴む Core ML
16
UIImage Core ML
dog.jpg
※イメージです
©2021 Yahoo Japan Corporation All rights reserved.
じゃあモデルはどうするの︖
17
2. テンプレートから作る
1. 公開されているモデルを使う
3. イチから⾃分で作る
簡単
難しい
©2021 Yahoo Japan Corporation All rights reserved.
公開されているモデルを使う
18
https://developer.apple.com/jp/machine-learning/models/
• 学習データ不要
• 機械学習の知識不要
• 応⽤⼒は低い
©2021 Yahoo Japan Corporation All rights reserved.
• Xcodeに同梱
• GUI
• 学習データ必要
• 機械学習の知識はほぼ不要
• テンプレートにあるものだけ
テンプレートから作る
19
Create ML
©2021 Yahoo Japan Corporation All rights reserved.
Create ML
©2021 Yahoo Japan Corporation All rights reserved.
Create ML
©2021 Yahoo Japan Corporation All rights reserved.
• 学習データ
• 機械学習の知識
• モデルを作成するためのライブラリ(Python)
• Turi Create
• TensorFlow, scikit-learn, Keras...
• モデルのオンデバイス学習(パーソナライズ)
• ニューラルネットワークレイヤーの最後の⼆層⽬を更新する
⾃分で作る
22
©2021 Yahoo Japan Corporation All rights reserved.
⾃分で作る
23
• 回帰(regression) or 分類(classification)or ??
• 学習データ
• 前処理
• 特徴ベクトル
• Neural Network, Tree, KNN ...
• 協調フィルタリング、tf-idf、形態素解析、 ...
• 類似度(Jaccard、Cosine, ... )
• 精度
• ...
©2021 Yahoo Japan Corporation All rights reserved.
Keras で ニューラルネットワーク を作ると...
24
©2021 Yahoo Japan Corporation All rights reserved.
むずかしい
25
Create ML がすごい
©2021 Yahoo Japan Corporation All rights reserved.
Core ML Tools
26
TensorFlowなどで作ったモデルをmlmodelに変換するツール
https://coremltools.readme.io/docs/what-are-coreml-tools
©2021 Yahoo Japan Corporation All rights reserved.
ワードの整理
27
モデルを作る
Turi Create
TensorFlow
Keras
scikit-learn
PyTorch
Create ML
©2021 Yahoo Japan Corporation All rights reserved.
ワードの整理
28
モデルを作る
Turi Create
TensorFlow
Keras
scikit-learn
PyTorch
Create ML
Core ML
モデルを使う
©2021 Yahoo Japan Corporation All rights reserved.
ワードの整理
29
モデルを作る
Turi Create
TensorFlow
Keras
scikit-learn
PyTorch
Create ML
Core ML
モデルを使う
©2021 Yahoo Japan Corporation All rights reserved.
ワードの整理
30
モデルを作る
Core ML Tools
Turi Create
TensorFlow
Keras
scikit-learn
PyTorch
Create ML
Core ML
モデルを変換する
モデルを使う
©2021 Yahoo Japan Corporation All rights reserved.
ワードの整理
31
モデルを作る
Core ML Tools
Turi Create
TensorFlow
Keras
scikit-learn
PyTorch
Create ML
Core ML
モデルを変換する
モデルを使う
制約はあるが再学習も可能
©2021 Yahoo Japan Corporation All rights reserved.
サーバ vs Core ML
• サーバレス
• よりリアルタイム
• オフライン
• 個⼈情報
Core ML を使⽤するメリット
32
©2021 Yahoo Japan Corporation All rights reserved.
• Create ML で⾃分専⽤のモデルを作ってみると親近感が湧く
Image Classification, Recommendation がおすすめ
• Natural Language framework, Vision framework
• Create ML の進化に注⽬
オンデバイス学習への対応に期待
終わりに
33
©2021 Yahoo Japan Corporation All rights reserved.
Enjoy WWDC21.
34

More Related Content

Similar to Wwdc extended21 tomonish

Programr overview2
Programr overview2Programr overview2
Programr overview2_programr
 
Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience National Cheng Kung University
 
OSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web Simulator
OSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web SimulatorOSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web Simulator
OSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web SimulatorGail Frederick
 
The Role of Standards in IoT Security
The Role of Standards in IoT SecurityThe Role of Standards in IoT Security
The Role of Standards in IoT SecurityHannes Tschofenig
 
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFlex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFrançois Le Droff
 
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...jward5519
 
Inteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for CodeInteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for CodeLuciano Resende
 
Bone.io for HTML5 Apps
Bone.io for HTML5 AppsBone.io for HTML5 Apps
Bone.io for HTML5 AppsBrad Carleton
 
Introduction to Java
Introduction to Java Introduction to Java
Introduction to Java Hitesh-Java
 
What Web Framework To Use?
What Web Framework To Use?What Web Framework To Use?
What Web Framework To Use?Kasra Khosravi
 
Ugly truths about html5 moosecon - robert virkus - 2013-03-07
Ugly truths about html5   moosecon - robert virkus - 2013-03-07Ugly truths about html5   moosecon - robert virkus - 2013-03-07
Ugly truths about html5 moosecon - robert virkus - 2013-03-07Enough Software
 
iOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS AppsiOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS AppsShashikant Jagtap
 
[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework Project
[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework Project[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework Project
[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework ProjectRakuten Group, Inc.
 
“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...
“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...
“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...Edge AI and Vision Alliance
 
Hardware Prototyping for Software Developers
Hardware Prototyping for Software DevelopersHardware Prototyping for Software Developers
Hardware Prototyping for Software DevelopersKinoma
 
Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouchJonas Follesø
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to TitaniumGraham Weldon
 

Similar to Wwdc extended21 tomonish (20)

Programr overview2
Programr overview2Programr overview2
Programr overview2
 
Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience
 
Node-RED Installer, Standalone Installer using Electron
Node-RED Installer, Standalone Installer using ElectronNode-RED Installer, Standalone Installer using Electron
Node-RED Installer, Standalone Installer using Electron
 
OSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web Simulator
OSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web SimulatorOSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web Simulator
OSCON 2012: Design and Debug HTML5 Apps for Devices with RIB and Web Simulator
 
The Role of Standards in IoT Security
The Role of Standards in IoT SecurityThe Role of Standards in IoT Security
The Role of Standards in IoT Security
 
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFlex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
 
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...Do Try This At Home  Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
Do Try This At Home Ajax Bookmarking, Cross Site Scripting, And Other Web 2 ...
 
Inteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for CodeInteligencia artificial, open source e IBM Call for Code
Inteligencia artificial, open source e IBM Call for Code
 
Bone.io for HTML5 Apps
Bone.io for HTML5 AppsBone.io for HTML5 Apps
Bone.io for HTML5 Apps
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 
Introduction to Java
Introduction to Java Introduction to Java
Introduction to Java
 
What Web Framework To Use?
What Web Framework To Use?What Web Framework To Use?
What Web Framework To Use?
 
Ugly truths about html5 moosecon - robert virkus - 2013-03-07
Ugly truths about html5   moosecon - robert virkus - 2013-03-07Ugly truths about html5   moosecon - robert virkus - 2013-03-07
Ugly truths about html5 moosecon - robert virkus - 2013-03-07
 
iOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS AppsiOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS Apps
 
[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework Project
[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework Project[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework Project
[Rakuten TechConf2014] [E-4] Rakuten Front-end Framework Project
 
“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...
“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...
“High-Efficiency Edge Vision Processing Based on Dynamically Reconfigurable T...
 
A Tale of Two Toolkits
A Tale of Two ToolkitsA Tale of Two Toolkits
A Tale of Two Toolkits
 
Hardware Prototyping for Software Developers
Hardware Prototyping for Software DevelopersHardware Prototyping for Software Developers
Hardware Prototyping for Software Developers
 
Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouch
 
An introduction to Titanium
An introduction to TitaniumAn introduction to Titanium
An introduction to Titanium
 

Recently uploaded

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 

Recently uploaded (20)

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 

Wwdc extended21 tomonish

  • 1. ©2021 Yahoo Japan Corporation All rights reserved. import CoreML そろそろ Core ML を使いませんか︖ ヤフー株式会社 CTO室アプリ統括部iOSアプリWG ⼤⻄智也
  • 2. ©2021 Yahoo Japan Corporation All rights reserved. 近年のWWDCでは ARKit・Metal・Core ML の発表が多いですが、 業務に直接関係ないからといって、 スルーしがちではありませんか︖ 2
  • 3. ©2021 Yahoo Japan Corporation All rights reserved. 今後の発表を少しでも有意義に⾒れるように、 Core ML の全体像をお伝えします 3
  • 4. ©2021 Yahoo Japan Corporation All rights reserved. ⼤⻄智也 iOSエンジニア ヤフー株式会社 CTO室 アプリ統括部 iOSアプリWG Yahoo!メール → ヤフオク! → PayPayフリマ → 現在 ObjC, Swift, Python, Typescript, React.js, Firebase, GCP https://github.com/TomoyaOnishi ⾃⼰紹介 4
  • 5. ©2021 Yahoo Japan Corporation All rights reserved. • CoreMLの⽴ち位置 • よく聞くワードとの関係性 • TensorFlow、scikit-learn、Create ML ... • CoreMLを使う場合、どういう流れになるのか 話すこと 5 アプリエンジニアの⽬線で話すので厳密には不正確な部分も含まれます 💦
  • 6. ©2021 Yahoo Japan Corporation All rights reserved. Appleデバイス上で機械学習モデルを動かすためのframework • CoreML 単体で何かが動くわけではない • import CoreML すればオブジェクト認識できるわけではない • 機械学習モデルが必要 • HogeModel.mlmodel CoreMLとは 6
  • 7. ©2021 Yahoo Japan Corporation All rights reserved. .mlmodel 7
  • 8. ©2021 Yahoo Japan Corporation All rights reserved. モデル︖ 8 𝑖𝑛𝑝𝑢𝑡 𝑜𝑢𝑡𝑝𝑢𝑡 𝑓(𝑥) (𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑖𝑜𝑛)
  • 9. ©2021 Yahoo Japan Corporation All rights reserved. 画像分類モデル 9 𝒅𝒐𝒈: 𝟎. 𝟗𝟕 𝑓(𝑥) 𝑜𝑡ℎ𝑒𝑟: 0.01 𝑐𝑎𝑡: 0.02
  • 10. ©2021 Yahoo Japan Corporation All rights reserved. 住宅の価格推定モデル 10 83,000𝑦𝑒𝑛 𝑓(𝑥) 住所 駅からの距離 築年数 TOKYO 1.2km 12
  • 11. ©2021 Yahoo Japan Corporation All rights reserved. 商品レコメンドモデル 11 𝑓(𝑥) 閲覧した商品ID おすすめの商品
  • 12. ©2021 Yahoo Japan Corporation All rights reserved. 商品レコメンドモデル 12 𝑓(𝑥) 閲覧した商品ID おすすめの商品 inputをモデルに渡すためのメソッド
  • 13. ©2021 Yahoo Japan Corporation All rights reserved. 商品レコメンドモデル 13 𝑓(𝑥) 閲覧した商品ID おすすめの商品 モデルを動かし推論結果を取得するメソッド
  • 14. ©2021 Yahoo Japan Corporation All rights reserved. 商品レコメンドモデル 14 𝑓(𝑥) 閲覧した商品ID おすすめの商品 Core ML は機械学習モデルを動かすためのインターフェース
  • 15. ©2021 Yahoo Japan Corporation All rights reserved. コードのサンプルです let itemID = "item_id_1" let input = MyModelInput(input: try! MLMultiArray([itemID])) let model = try! MyModel(contentsOf: modelURL) let prediction = try! model.prediction(input: input) print(prediction) // item_id_5 item_id_7,
  • 16. ©2021 Yahoo Japan Corporation All rights reserved. イメージで掴む Core ML 16 UIImage Core ML dog.jpg ※イメージです
  • 17. ©2021 Yahoo Japan Corporation All rights reserved. じゃあモデルはどうするの︖ 17 2. テンプレートから作る 1. 公開されているモデルを使う 3. イチから⾃分で作る 簡単 難しい
  • 18. ©2021 Yahoo Japan Corporation All rights reserved. 公開されているモデルを使う 18 https://developer.apple.com/jp/machine-learning/models/ • 学習データ不要 • 機械学習の知識不要 • 応⽤⼒は低い
  • 19. ©2021 Yahoo Japan Corporation All rights reserved. • Xcodeに同梱 • GUI • 学習データ必要 • 機械学習の知識はほぼ不要 • テンプレートにあるものだけ テンプレートから作る 19 Create ML
  • 20. ©2021 Yahoo Japan Corporation All rights reserved. Create ML
  • 21. ©2021 Yahoo Japan Corporation All rights reserved. Create ML
  • 22. ©2021 Yahoo Japan Corporation All rights reserved. • 学習データ • 機械学習の知識 • モデルを作成するためのライブラリ(Python) • Turi Create • TensorFlow, scikit-learn, Keras... • モデルのオンデバイス学習(パーソナライズ) • ニューラルネットワークレイヤーの最後の⼆層⽬を更新する ⾃分で作る 22
  • 23. ©2021 Yahoo Japan Corporation All rights reserved. ⾃分で作る 23 • 回帰(regression) or 分類(classification)or ?? • 学習データ • 前処理 • 特徴ベクトル • Neural Network, Tree, KNN ... • 協調フィルタリング、tf-idf、形態素解析、 ... • 類似度(Jaccard、Cosine, ... ) • 精度 • ...
  • 24. ©2021 Yahoo Japan Corporation All rights reserved. Keras で ニューラルネットワーク を作ると... 24
  • 25. ©2021 Yahoo Japan Corporation All rights reserved. むずかしい 25 Create ML がすごい
  • 26. ©2021 Yahoo Japan Corporation All rights reserved. Core ML Tools 26 TensorFlowなどで作ったモデルをmlmodelに変換するツール https://coremltools.readme.io/docs/what-are-coreml-tools
  • 27. ©2021 Yahoo Japan Corporation All rights reserved. ワードの整理 27 モデルを作る Turi Create TensorFlow Keras scikit-learn PyTorch Create ML
  • 28. ©2021 Yahoo Japan Corporation All rights reserved. ワードの整理 28 モデルを作る Turi Create TensorFlow Keras scikit-learn PyTorch Create ML Core ML モデルを使う
  • 29. ©2021 Yahoo Japan Corporation All rights reserved. ワードの整理 29 モデルを作る Turi Create TensorFlow Keras scikit-learn PyTorch Create ML Core ML モデルを使う
  • 30. ©2021 Yahoo Japan Corporation All rights reserved. ワードの整理 30 モデルを作る Core ML Tools Turi Create TensorFlow Keras scikit-learn PyTorch Create ML Core ML モデルを変換する モデルを使う
  • 31. ©2021 Yahoo Japan Corporation All rights reserved. ワードの整理 31 モデルを作る Core ML Tools Turi Create TensorFlow Keras scikit-learn PyTorch Create ML Core ML モデルを変換する モデルを使う 制約はあるが再学習も可能
  • 32. ©2021 Yahoo Japan Corporation All rights reserved. サーバ vs Core ML • サーバレス • よりリアルタイム • オフライン • 個⼈情報 Core ML を使⽤するメリット 32
  • 33. ©2021 Yahoo Japan Corporation All rights reserved. • Create ML で⾃分専⽤のモデルを作ってみると親近感が湧く Image Classification, Recommendation がおすすめ • Natural Language framework, Vision framework • Create ML の進化に注⽬ オンデバイス学習への対応に期待 終わりに 33
  • 34. ©2021 Yahoo Japan Corporation All rights reserved. Enjoy WWDC21. 34