matlab® & simulink® as development, simulation and ... · 3 deploy matlab algorithms and...

45
1 © 2018 The MathWorks, Inc. MATLAB® & Simulink® Development, Simulation and Integration Platform for Your ADAS Functions Gaurav Tomar Automotive Industry Manager EMEA Alexander Schreiber Principle Application Engineer and Technical Account Manager Control Planning Perception

Upload: buithien

Post on 21-Jun-2019

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

1© 2018 The MathWorks, Inc.

MATLAB® & Simulink®

Development, Simulation and Integration Platform

for Your ADAS Functions

Gaurav Tomar Automotive Industry Manager EMEA

Alexander Schreiber Principle Application Engineer and Technical Account Manager

Percepti

onControl

Planning

Control

Planning

Perception

Page 2: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

3

Deploy MATLAB Algorithms and Applications

Analyze Data

Data

exploration

Preprocessing

Domain-specific

algorithms

Access Data

Sensors

Files

Databases

Deploy

Embedded

devices

Desktop apps

Enterprise

systems

Develop

AI model

Algorithm

development

Modeling &

simulation

Page 3: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

4

Model-Based Design and Code Generation

for AEB Sensor Fusion

1.5M km of recorded data

3+ years of driving time

12 hours re-simulation

Page 5: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

7

Designing Autonomous Systems

Sense

PerceiveDecide

& Plan

Act

Page 6: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

8

Computer Vision System ToolboxRobotics System Toolbox

▪ Segment and register lidar point clouds

▪ Lidar-Based SLAM: Localize robots and

build map environments using lidar sensors

Mapping of environments using sensor data

Designing Autonomous Systems

Sense

PerceiveDecide

& Plan

Act

Page 7: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

9

Designing Autonomous Systems

▪ Object detection and tracking

▪ Semantic segmentation using deep learning

Understanding the environment using computer

vision and deep learning techniques

Neural Network ToolboxComputer Vision System ToolboxAutomated Driving System Toolbox

CamVid Database: Brostow, Gabriel J., Julien Fauqueur, and Roberto Cipolla. "Semantic object classes in video: A high-definition ground truth database." Pattern Recognition LettersVol 30, Issue 2, 2009, pp 88-97.

Sense

PerceiveDecide

& Plan

Act

Page 8: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

10

Designing Autonomous Systems

▪ Interactively design synthetic driving scenarios

composed of roads and actors

(vehicles, pedestrians, etc.)

▪ Generate visual and radar detections of actors

Design synthetic driving scenarios to test

controllers and sensor fusion algorithms

Automated Driving System Toolbox

Driving Scenario Designer App

Sense

PerceiveDecide

& Plan

Act

Page 9: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

11

Designing Autonomous Systems

▪ Use prebuilt blocks instead of starting from

scratch

▪ Simplified application-specific interfaces for

configuring model predictive controllers

▪ Flexibility to customize for your application

Model predictive control for adaptive cruise

control and lane-keeping algorithms

Model Predictive Control Toolbox

Sense

PerceiveDecide

& Plan

Act

Page 10: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

12

Full Vehicle Simulation

Vehicle Dynamics Blockset

Ride & handling Chassis controls Automated Driving

Sense

PerceiveDecide

& Plan

Act

Page 11: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

13

Customize MATLAB and Simulink for your automated driving

application

Web based ground

truth labeling▪ Consulting project with

Caterpillar

▪ 2017 MathWorks Automotive

Conference

Lidar ground truth

labeling▪ Joint presentation with Autoliv

▪ SAE Paper 2018-01-0043

▪ 2018 MathWorks Automotive

Conference

Lidar sensor model

for Unreal Engine▪ Joint paper with Ford

▪ SAE Paper 2017-01-0107

Page 12: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

14

CaterpillarWeb-based ground truth labeling and deep learning with big data

Caterpillar presentation slides from MathWorks Automotive Conference 2017, Plymouth, Michigan

Caterpillar presentation recording from MathWorks Automotive Conference 2017, Plymouth, Michigan

Page 13: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

16

Working with Customers: Interfaces to Virtual EnvironmentsCollaborative work together with FORD on synthesis of lidar point cloud data to test active safety

systems

SAE Paper 2017-01-0107

SAE web article: A Safer Scenario for Autonomous Driving and Active Safety Testing, July 2017

Page 14: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

17

Working with Customers: Interfaces to Virtual EnvironmentsCollaborative work together with FORD on synthesis of lidar point cloud data to test active safety

systems

SAE Paper 2017-01-0107

SAE web article: A Safer Scenario for Autonomous Driving and Active Safety Testing, July 2017

Page 15: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

18

Working with Customers: LiDAR Based Sensor Verification3D Bounding Box Labeling for Point Cloud Data

SAE Technical Paper 2018-01-0043, 2018

SAE web article: LiDAR Based Sensor Verification

Page 16: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

19

Open Platform

Interoperability with open source frameworks

PlatformProductivity

Best in class tools for design of deep networks

Multi-platform Deployment

Design in MATLAB deploy to any processor

MATLAB as Deep Learning Framework

Page 17: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

20

Open Platform

Interoperability with open source frameworks

PlatformProductivity

Best in class tools for design of deep networks

Multi-platform Deployment

Design in MATLAB deploy to any processor

MATLAB as Deep Learning Framework

Page 18: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

21

Ground Truth Labeling

▪ Adding Ground Truth Information

▪ Solutions

– Ground Truth Labeler App

– Image Labeler App

▪ Semi-automated Labeling

– ROI Labels (rectangle, line)

– Scene Labels

– Pixel Labels

Page 19: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

22

Example: Ground Truth Labeling of LiDAR Data

Page 20: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

23

Example: Ground Truth Labeling of LiDAR Data

Page 21: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

24

Example: Ground Truth Labeling of LiDAR Data

Page 22: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

25

Two Approaches for Deep Learning

▪ Reusing existing feature

extraction

▪ Adapting to specific needs

▪ Requires

– Smaller training data set

– Lower training time

▪ Tailored and optimized to

specific needs

▪ Requires

– Larger training data set

– Longer training time

2. Fine-tune a pre-trained model (transfer learning)

1. Train a Deep Neural Network from Scratch

Page 23: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

26

Neural Network Toolbox: Deep Learning Network Support

Page 24: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

27

Transfer Learning

Page 25: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

28

Transfer Learning

Page 26: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

29

Transfer Learning

Page 27: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

30

Accelerating Training (CPU, GPU, multi-GPU, Clusters)

More GPUs

Mo

re C

PU

s

Page 28: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

31

Accelerating Training (CPU, GPU, multi-GPU, Clusters)

Multiple GPU support

More GPUs

Single GPU performance

Page 29: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

32

Open Platform

Interoperability with open source frameworks

PlatformProductivity

Best in class tools for design of deep networks

Multi-platform Deployment

Design in MATLAB deploy to any processor

MATLAB as Deep Learning Framework

Open Platform

Interoperability with open source frameworks

Page 30: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

33

Easy Access to Pretrained Modelswith a single line of code…

Complete list of models:

www.mathworks.com/solutions/deep-learning/models.html

Caffe*MODELS

TensorFlow*MODELS

*) Importers available through the Add-Ons Manager

Page 31: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

34

Open Platform

Interoperability with open source frameworks

PlatformProductivity

Best in class tools for design of deep networks

Multi-platform Deployment

Design in MATLAB deploy to any processor

MATLAB as Deep Learning Framework

Multi-platform Deployment

Design in MATLAB deploy to any processor

Page 32: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

35

Algorithm Design to Embedded Deployment Workflow

MATLAB algorithm

(functional reference)

Functional test1 Deployment

unit-test

2

Desktop

GPU

C++

Deployment

integration-test

3

Desktop

GPU

C++

Real-time test4

Embedded GPU

.mex .lib/.dll Cross-compiled

.lib

Build type

Call CUDA

from MATLAB

directly

Call CUDA from

(C++) hand-

coded main()

Call CUDA from (C++)

hand-coded main().

(Test in MATLAB on host) (Test generated code in

MATLAB on host + GPU)

(Test generated code within

C/C++ app on host + GPU)

(Test generated code within

C/C++ app on Tegra target)

Page 33: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

36

GPU Coder Compilation Flow

Benefits

▪ MATLAB as single golden

reference

▪ Much faster conversion

from MATLAB to CUDA

▪ Elimination of manual

coding errors

▪ No expert-level expertise

in parallel computing

needed

GPU Coder

CUDA Kernel creation

Memory allocation

Data transfer minimization

• Library function mapping

• Loop optimizations

• Dependence analysis

• Data locality analysis

• GPU memory allocation

• Data-dependence analysis

• Dynamic memcpy reduction

Page 34: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

37

GPU Coder Output

GPU memory

allocation

memcpy CPU -> GPU

Image

preprocessing

memcpy GPU -> GPU

Network inference

memcpy GPU -> GPU

Postprocessing

memcpy GPU -> CPU

GPU memory

deallocation

Page 35: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

38

Algorithm Design to Embedded Deployment

MATLAB algorithm

(functional reference)

Functional test1 Deployment

unit-test

2

Tesla

GPU

C++

Deployment

integration-test

3

Tesla

GPU

C++

Real-time test4

Tegra GPU

.mex Cross-compiled

.lib

Build type

Call CUDA

from MATLAB

directly

Call CUDA from

(C++) hand-

coded main()

Call CUDA from (C++)

hand-coded main().

Cross-compiled on host

with Linaro toolchain

.lib/.dll

Page 36: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

39

Deployment Unit Test within MATLAB

Benefits

▪ Leveraging the MATLAB infrastructure

▪ Re-using exiting MATLAB testbench

▪ Minimal changes needed

Page 37: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

40

AlexNet Inference on NVIDIA Titan Xp

GPU Coder +

TensorRT (3.0.1)

GPU Coder +

cuDNN

Fra

me

s p

er

se

co

nd

Batch Size

CPU Intel(R) Xeon(R) CPU E5-1650 v4 @ 3.60GHz

GPU Pascal Titan Xp

cuDNN v7

Testing platform

MXNet (1.1.0)

GPU Coder +

TensorRT (3.0.1, int8)

TensorFlow (1.6.0)

Page 38: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

41

Algorithm Design to Embedded Deployment

MATLAB algorithm

(functional reference)

Functional test1 Deployment

unit-test

2

Tesla

GPU

C++

Deployment

integration-test

3

Tesla

GPU

C++

Real-time test4

Tegra GPU

.mex Cross-compiled

.lib

Build type

Call CUDA

from MATLAB

directly

Call CUDA from

(C++) hand-

coded main()

Call CUDA from (C++)

hand-coded main().

Cross-compiled on host

with Linaro toolchain

.lib/.dll

Page 39: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

42

Deployment to Tegra: Cross-Compiled with ‘lib’

Two small changes

1. Change build-type to ‘lib’

2. Select cross-compile toolchain

Page 40: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

43

0

50

100

150

200

250

300

350

400

1 16 32 64 128 256

AlexNet Inference on Jetson TX2: Performance

GPU Coder +

cuDNN

Fra

me

s p

er

se

co

nd

Batch Size

C++ Caffe (1.0.0-rc5)

GPU Coder +

TensorRT (3.0.1)

Page 41: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

44

GPU Coder: Deep Learning Network Support (with Neural Network TB)

SeriesNetwork DAGNetwork

GPU Coder: R2017b

Networks: MNist

Alexnet

YOLO

VGG

Lane detection

Pedestrian detection

GPU Coder: R2018a

Networks: GoogLeNet

ResNet

SegNet

DeconvNet

Object

detection

Semantic

segmentation

Page 42: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

45

Semantic Segmentation

Running in MATLAB Generated Code from GPU Coder

Page 43: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

46

Deploying to GPUs and CPUs

GPU

Coder

Deep Learning

Networks

NVIDIA

cuDNN

& TensorRT

Libraries

ARM

Compute

Library

Intel

MKL-DNN

Library

Page 44: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

47

Deploying to GPUs and CPUs

GPU

Coder

Deep Learning

Networks

NVIDIA

cuDNN

& TensorRT

Libraries

ARM

Compute

Library

Intel

MKL-DNN

Library

Desktop CPU

Raspberry Pi board

Page 45: MATLAB® & Simulink® as Development, Simulation and ... · 3 Deploy MATLAB Algorithms and Applications Analyze Data Data exploration Preprocessing Domain-specific algorithms Access

48

Summary

▪ Manage large image sets

▪ Automate image labeling

▪ Design, Training,

Inference within MATLAB

▪ Acceleration with GPU’s

▪ Scale to clusters

▪ Easy access to models ▪ Automate compilation to

GPUs and CPUs using

GPU Coder:▪ 5x faster than TensorFlow

▪ 2x faster than MXNet