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