Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
1© 2017 The MathWorks, Inc.
MATLAB 与人工智能:深度学习有多远?
2
术语: 人工智能,机器学习,深度学习
Artificial Intelligence (A.I.) for
“knowledge based reasoning” in
academia
Rule-based & brute force
reasoning
Spam filters learn
models from data
Deep learning drive “AI BOOM”
4
MATLAB 是什么?
5
6
7
10
机器学习
11
机器学习无处不在
▪ 图像识别
▪ 语音识别
▪ 股票预测
▪ 医疗诊断
▪ 数据分析
▪ 机器人
▪ 更多……
[TBD]
12
示例:Classfication
Machine
Learning
Supervised
Learning
Classification
Regression
Unsupervised
LearningClustering
仅对输入数据进行分组或解释
基于输入输出数据开发预测模型
学习类型
算法类型目标:
训练一个分类器,通过传感器手机的数据来区分人的动作
数据:
方法:– 数据输入
– 交互式训练、并比较分类器结果
– 利用新的传感器数据测试结果
输入 三轴加速度计三轴陀螺仪
输出
13
示例:Regression
Machine
Learning
Supervised
Learning
Classification
Regression
Unsupervised
LearningClustering
仅对输入数据进行分组或解释
基于输入输出数据开发预测模型
学习类型
算法类型 目标:
简单、精确预测系统负载
14
示例:Clustering
Machine
Learning
Supervised
Learning
Classification
Regression
Unsupervised
LearningClustering
仅对输入数据进行分组或解释
基于输入输出数据开发预测模型
学习类型
算法类型 目标:
基于发动机转速和车速数据,识别分类
15
深度学习
16
为什么深度学习如此炙手可热?
Source: ILSVRC Top-5 Error on ImageNet
Human
Accuracy
17
示例1:使用深度学习实现物体识别
Training (GPU)
Millions of images from 1000
different categories
PredictionReal-time object recognition using
a webcam connected to a laptop
18
示例2:使用深度学习进行检测和定位
Regions with Convolutional Neural
Network Features (R-CNN)Semantic Segmentation using SegNet
19
什么是深度学习?
猫
训练数据 测试数据
特征提取
机器学习模型:分类
20
什么是深度学习?
猫
训练数据测试数据
Convolutional Neural Network
(CNN)
Feature Learning &
Classification
Convolutional Neural Network
(CN)
Feature Learning and
Classification
卷积神经网络 (CNN)
特征学习与分类
21
深度学习是机器学习的一部分
Machine Learning
Deep Learning
深度学习直接从数据中提取特征和任务,执行端到端的学习
机器学习从数据中手工提取的特征,学习任务
End-to-End Learning
26
结构: 卷积神经网络 (CNN)
▪ CNN 是理想的图像和视频处理网络
▪ CNN 采用固定大小的输入并生成固定大小的输出
▪ 卷积将输入图像通过一组卷积滤波器,每一个都从图像中激活某些特征
27
神经网络如何工作?
目标形状
边缘
32
深度学习工作流程
Probability
Boat
Plane
Car
Train
Deploy results
100s images
10s classes
Training images
Training options
Train network
Test images
Trained Network
Predict and assess
network accuracy
33
示例: 利用 CNN 实现数字识别
What?A set of handwritten
digits from 0-9
Why?An easy task for deep
learning beginners
How many?7500 training images
2500 test images
Best results? 99.72% accuracy = 7
34
创建 CNN
Image Input Layer
Convolutional Layer
ReLU Layer
Max Pooling Layer
Fully Connected Layer
35
Set Training options
36
训练网络
Bayesian Optimization
43
训练网络
Bayesian Optimization
44
深度学习推动者
海量已标记的公共数据集
GPUs 加速性能
可获得专家训练出的顶级深度模型AlexNet
PRETRAINED MODEL
CaffeM O D E L S
ResNet PRETRAINED MODEL
TensorFlow/Keras M O D E L S
VGG-16PRETRAINED MODEL
GoogLeNet PRETRAINED MODEL
46
10行 MATLAB 代码实现深度学习
camera = webcam; % Connect to the camera
nnet = alexnet; % Load the neural net
while true
picture = camera.snapshot; % Take a picture
picture = imresize(picture,[227,227]); % Resize the picture
label = classify(nnet, picture); % Classify the picture
image(picture); % Show the picture
title(char(label)); % Show the label
drawnow;
end
47
神经网络工具箱深度学习
48
迁移学习
49
深度学习的两种方法
2. 微调一个预先训练好的模型(迁移学习)
1. 从头开始训练一个深度神经网络
50
迁移学习工作流程
Probability
Boat
Plane
Car
Train
Deploy results
Early layers that learned
low-level features
(edges, blobs, colors)
Last layers that
learned task
specific features
1 million images
1000s classes
Load pretrained network
Fewer classes
Learn faster
New layers to learn
features specific
to your data
Replace final layers
100s images
10s classes
Training images
Training options
Train network
Test images
Trained Network
Predict and assess
network accuracy
51
为什么进行迁移学习?
▪ 所需数据集大幅减少,训练时间也随之减少
▪ 参考模型(如AlexNet, VGG-16,
VGG-19 )是强有力的特征提取器
▪ 以顶级研究者的最佳网络模型为基础
AlexNetPRETRAINED MODEL
CaffeM O D E L S
ResNet PRETRAINED MODEL
TensorFlow/Keras M O D E L S
VGG-16PRETRAINED MODEL
GoogLeNet PRETRAINED MODEL
53
转移学习演示:在餐厅里识别食物
Transfer Learning
Training Time: Days to weeks
AlexNet: Pre-trained
Object Recognition Model
Training Time: 10 to 12 minutes
Custom Food
Recognition Model
55
MATLAB 迁移学习
Easily modify and re-train networks:
layers = net.Layers(1:end-3);
layers(end+1) = fullyConnectedLayer (2,'Name','fc8_2')
layers(end+1) = softmaxLayer
layers(end+1) = classificationLayer()
net = trainNetwork(trainingDS, layers, opts);
Remove last 3 layers:
Perform transfer learning:
56
训练效率与规模
57
在 MATLAB 中训练很快
MATLAB is more than 4x faster than TensorFlow
AlexNet CNN architecture trained on the ImageNet dataset, using batch size of 32, on a
Windows 10 desktop with single NVIDIA GPU
58
在 CPU,GPU,多 GPU 和群集训练深度学习网络
More GPUs
Mo
re C
PU
s
HOW TO TARGET?
59
推断效率与部署
60
GPU Coder 填补我们深入学习解决方案的空白
数据获取 预处理 选择网络 训练
Image Acq.Image
Processing
Computer
Vision
Neural
Network
Parallel
ComputingGPU
Coder
部署
推断训练
Text
Analytics
Automation
Driving
61
GPU 运算更快速
10 fps
30 fps
62
什么是 GPU Coder
▪ 代码生成工具
▪ 生成CUDA代码,用于NVIDIA GPU
▪ CUDA 扩展了 C++ 代码的并行计算结构
63
为什么使用 GPU Coder?
解决方案: GPU Coder
▪ 自动转换MATLAB代码到 CUDA代码
▪ 加速CUDA
▪ 评估人工编码的错误
痛点: 手写代码
▪ 不会编写CUDA代码
▪ 推断耗时
▪ 容易引入错误
64
在 MATLAB 中访问深度学习参考模型
1. 参考模型
2. Caffe模型导入
3. 教程
67
为什么是 MATLAB?
MATLAB
是工程师和科研人员最易用、并且最高效的开发平台
68
更多资源
机器学习资源
深度学习资源
70
谢谢