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
从 Swift 到机器学习
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Wei Wang
September 15, 2018
Programming
1.1k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
从 Swift 到机器学习
Wei Wang
September 15, 2018
More Decks by Wei Wang
See All by Wei Wang
網路之難,難於上青天 - iPlayground 2019
onevcat
11
5.5k
GMTC 2019 - 在分歧中发展,2019 我们能用 Swift 做什么
onevcat
0
1.3k
iOS Dev - The Dark Side
onevcat
0
180
面向协议编程与 Cocoa 的邂逅
onevcat
14
5k
Swift 3 - From Expert to Beginner
onevcat
2
290
如何打造一个让人愉快的框架
onevcat
4
23k
JSPatch Introduction
onevcat
0
240
Objective-C Runtime Swizzle
onevcat
0
250
Unity Memory
onevcat
0
200
Other Decks in Programming
See All in Programming
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
130
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
3
600
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
0
170
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
12
10k
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
350
sbt 2.0: takeoff
eed3si9n
0
170
ChromeでローカルLLM
ryu1013
0
170
Next.js: The final boss of Web Performance
guaca
0
350
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
220
JIS keyboard support in Omarchy
lef237
0
160
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
130
AmebaブログはKMPから卒業します
kmars0605
0
280
Featured
See All Featured
We Are The Robots
honzajavorek
0
410
Mind Mapping
helmedeiros
1
410
Evolving SEO for Evolving Search Engines
ryanjones
0
330
Tell your own story through comics
letsgokoyo
1
1.1k
Producing Creativity
orderedlist
PRO
348
41k
Code Review Best Practice
trishagee
74
20k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
500
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
330
Accessibility Awareness
sabderemane
1
260
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
540
Transcript
从 Swift 到 机器器学习 CreateML - Swifter 通向 ML 的⾦金金钥匙
王 巍 (onevcat) 2018.09.15, @Swift Conf.
后移动开发时代 Google Trends: “iOS Develop”
WWDC 2013
转变⼀一般都会带来痛苦
如何评价 2017 年年初华为开始「清理理」34 岁以上的职员? 程序员能纯靠技术渡过中年年危机吗? 程序员30岁之前年年薪不不到40W,再不不转⾏行行都晚了了? iOS 末路路了了吗,我找⼯工作两个⽉月,没⼈人要 35 岁做不不到管理理就等于失业
我(们)的出路路在哪⾥里里
我(们)的出路路在哪⾥里里 ⼤大前端 React Native Weex ⼩小程序 Flutter 机器器学习 深度学习 计算机视觉
⾃自然语⾔言处理理 ⻛风格化图像处理理
其余的出路路 区块链 P2P信贷 做个快乐的肥宅
做个快乐的肥宅
I have an idea!
App: 普尔亚后援会 • 使⽤用相机或者照⽚片库 • 识别照⽚片中的普尔亚⼿手势 • 收集到三张照⽚片获得奖励
HOW?
我(们)的出路路在哪⾥里里 ⼤大前端 React Native Weex ⼩小程序 Flutter 机器器学习 深度学习 计算机视觉
⾃自然语⾔言处理理 ⻛风格化图像处理理
CreateML WWDC 2018 Session 703 https://developer.apple.com/videos/play/wwdc2018/703/
⼀一般流程 准备数据 训练模型 评估模型
⼀一般流程 准备数据 训练模型 评估模型 图⽚片 + 分类标签 准备训练数据 (train set)
和验证数据 (validation set) 调整参数 寻找使训练数据具有最⼩小误差值的⼀一组参数 使⽤用验证数据对模型准确率评估
None
⼀一般流程 准备数据 训练模型 评估模型
CreateML 到底做了了什什么
mlmodel https://apple.github.io/coremltools/coremlspecification/index.html Protocol Buffers 序列列化的模型描述 layer 类型,权重等
~KB 迁移学习 VisionFeaturePrint_Scene mlmodel VisionFeaturePrint_Scene 只存在于 iOS 12, macOS 10.14
Vision 框架背后的特征提取 17KB in Demo Transfer Learning
None
✅ VisionFeaturePrint_Scene VisionFeaturePrint_Screen
Core ML Community Tools
None
visionFeaturePrint glmClassifier
开始定义 pipeline 输⼊入 299x299 保留留特性的同时限制处理理时间 内置模型 (特征提取) 2048 个特征的数组 (1,
2048) ⼴广义线性模型 (GLM) (2048, 1),与特征点乘得到结果
发⽣生了了什什么
Turi
Turi • 2013, 成⽴立 • 2016, Apple 以 2 亿美元收购
• 2017, 开源, ⽀支持 Metal 和 macOS GPU 加速 • 2018, 部分集成⼊入 Apple Developer Toolkit (Xcode) • 未来, 更更多的学习任务… 基于学习任务的 “傻⽠瓜式” 机器器学习框架
⼏几个问题
VisionFeaturePrint 集成在 iOS 12 和 macOS 10.14 中 问题 No.1
Core ML - iOS 11 • CoreML 从 iOS 11
开始⽀支持 • ⽆无法读取 CreateML 创建的带有 VisionFeaturePrint 的模型
Core ML - iOS 11 使⽤用 TuriCreate 的其他模型进⾏行行特征提取 可以得到与 CreateML
相近的结果
https://github.com/apple/turicreate
Demo
None
~ 90+ MB
过拟合,准确率 问题 No.2
⼀一个⾼高度 的模型 Overfitting 过拟合
过拟合
过拟合 训练数据严重不不⾜足 只来源于单⼀一⼈人员和单⼀一场景 对于⾮非该⼈人员的识别相当低效 默认的训练⽅方式只对最后⼀一层进⾏行行训练 特征提取模型中不不包含对应特征
0 22.5 45 67.5 90 0 5 10 15 20
准确率
默认特征提取模型下 增加训练数据,可以达到 85% 左右
卷积神经⽹网络和特征提取
抽象特征 (边缘,线条,⻆角度) 具体特征 (眼睛,⿐鼻⼦子,⽿耳朵)
CreateML (Turi) 的迁移学习 只对最后⼀一层进⾏行行训练 抽象特征 泛⽤用性 具体特征 专⽤用性
调整若⼲干层卷积层参数 进⾏行行迁移学习
CreateML / Turi
更更加“可操控”的学习⽅方式
更更加“可操控”的学习⽅方式
92% 左右的正确率
⼀一些客户端 ML 的 实际应⽤用
Super-Resolution SRCNN
https://speakerdeck.com/kenmaz/super-resolution-with-coreml-at-try-swift-tokyo-2018 SRCNNKit from DeNA
https://github.com/DeNA/SRCNNKit
在漫画之外使⽤用 1. 专⻔门的训练数据 2. 通过预处理理提取场景特征 (⼈人物,⻛风景,UI) 3.更更多的层数
⾳音乐情绪识别
从⾳音乐的曲调和节奏识别⾳音乐情绪 Music Keyword 梁梁祝 温柔婉转 命运交响曲 激情雄壮 ⼩小苹果 轻松欢快
其他场景 • 本地垃圾短信识别 • 游戏 AI (GameplayKit) • 专⽤用的图像分类/识别 •
etc…
总结 • ⼩小模型,Client Side ML 的关键 • 对于既有特征表现⾮非常出⾊色 (ImageNet Category)
• 简单,⽆无脑,拖拽式得到可⽤用模型 • 对⼯工程师友好,可以在 client 本机编译 (下载更更新模型)
总结 • 只适⽤用于特定任务 (图⽚片分类/⾃自然语⾔言处理理/回归分析) • TuriCreate 只能有限扩展 (使⽤用第三⽅方模型, ⻛风格化图 ⽚片滤镜等)
• ⽆无法处理理⾃自定义模型,或者更更⼀一般化的任务
⼀一些资源 Awesome Core ML Models https://github.com/likedan/Awesome-CoreML-Models Machine Learning for iOS
https://github.com/alexsosn/iOS_ML Apple Machine Learning Journal https://machinelearning.apple.com Kraggle https://www.kaggle.com Machine Learning (Turi) - Coursera https://coursera.org/specializations/machine-learning Deep Learning with Python https://www.manning.com/books/deep-learning-with-python
谢谢!: ] @onevcat,
[email protected]