matlab 및simulink를이용한운전자 지원시스템개발 · code generation. 14 ... access...

60
1 © 2015 The MathWorks, Inc. MATLAB Simulink를 이용한 운전자 지원 시스템 개발 김종헌 차장 Senior Application Engineer MathWorks Korea

Upload: others

Post on 23-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

1© 2015 The MathWorks, Inc.

MATLAB 및 Simulink를이용한운전자지원시스템개발

김종헌차장

Senior Application Engineer

MathWorks Korea

Page 2: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

2

Example : Sensor Fusion with Monocular Vision & Radar

Configuration

– Monocular Vision installed on Wind Shield

– Radar installed in Front Grill

High Level Sensor Fusion

2 Different Scenario

– Closest In-Path Vehicle Selection

– Stationary Vehicle Detection

Page 3: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

3

Why Sensor Fusion?

– To complement weakness of individual sensor

– More Coverage

Radar Camera

Accurate Range Poor

Measureable Directly Range Rate Estimated

Poor Angle Resolution Relatively Good

Not Available Classification Available

Sensor Fusion

Page 4: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

4

Issues?

Max Doppler

RCS

InterferenceNoise figure

Power@50

SGM

KLT Tracking

HOG

TTCLQR/LQG

AUTOSAR

Communication Risk of Vehicle Test

Huh!!

Page 5: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

5

How do we bridge the gap between engineers

who speak different languages and reduce risk?

Max Doppler

RCS

InterferenceNoise figure

Power@50

SGM

KLT Tracking

HOG

TTCLQR/LQG

AUTOSAR

Communication Risk of Vehicle Test

Page 6: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

6

Solution: Model based Multi-domain Modeling and System Level

Simulation

“Here’s the

verification

model”

“Here are

the specs”

• Model serves as the executable specification and test environment

• Multiple engineering teams can collaborate more effectively

Page 7: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

7

Example : Sensor Fusion with Monocular Vision & Radar

Vision

– Lane Detection

– Vehicle Detection

– Extended Kalman Filter based Tracking

Radar

– FMCW Radar Modeling

– Extended Kalman Filter based Tracking

Sensor Fusion

– Data Association

– Data Fusion

Page 8: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

8

Abstract

Vision

– Lane Detection

– Vehicle Detection

– Etc.

Radar

– FMCW Radar Modeling

Tracking

– Extend Kalman Filter based Tracking

Sensor Fusion

– Integration

Page 9: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

9

Captured Image

ROI (Region Of Interest)

Cropped Image

ROI (Region Of Interest)

Curve FittingSelecting Candidate PtsEdge Mapping to World

Lane Detection

Page 10: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

10

Captured Image

ROI (Region Of Interest)

Cropped Image

ROI (Region Of Interest)

Curve FittingSelecting Candidate PtsEdge Mapping to World

Lane Detection

Image Processing Function

MATLAB Built-In Function

CVST Function

Easy Matrix Calculation

Easy to Debug Scripting

Language

Pixel level, 2D, 3D Visualization

Code Generation

Page 11: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

14

Lane Detection

Page 12: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

15

Abstract

Vision

– Lane Detection

– Vehicle Detection

– Etc.

Radar

– FMCW Radar Modeling

Tracking

– Extend Kalman Filter based Tracking

Sensor Fusion

– Integration

Page 13: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

16

Cascade Detector

Applications in Automotive of Cascade Detector

Vehicle detection

Pedestrian detection

Traffic Sign Recognition

Difference between applications is “Feature”.

Page 14: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

17

4 Easy Steps to Create a Car Detector

Collect Car Image Data

(Training Images)

Label Objects of Interest

Train Object Detector

Test Detector Performance

Page 15: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

18

Step 1: Collect Training Image Data

Collect many images that represent object you want to

detect

Ensure that images represent different conditions

– Lighting

– Different variations of object – size, color , model etc.

Page 16: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

19

Step 2: Label Training Images

Select and assign regions of interest

Images from: www.emt.tugraz.at/~pinz/data/GRAZ_02/

Page 17: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

20

Step 3: Train Object Detector

Single line of ML

code

Page 18: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

21

Step 4: Test Detector Performance

Page 19: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

22

Comparison Data from Vehicle Dynamics S/W

and Result of Cascade Detector

Page 20: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

23

Further Information about Cascade Object

Detector

See documentation for detail explanation http://www.mathworks.com/help/vision/ug/train-a-

cascade-object-detector.html .

Page 21: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

24

Abstract

Vision

– Lane Detection

– Vehicle Detection

– Etc.

Radar

– FMCW Radar Modeling

Tracking

– Extend Kalman Filter based Tracking

Sensor Fusion

– Integration

Page 22: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

26

Camera Calibration App.

Original image Undistorted image

Camera Calibration App.

MATLAB commands for camera calibration are also available.

Page 23: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

27

Camera Calibration App.

𝐾 =

𝑓𝑥 0 0𝑠 𝑓𝑦 0

𝑐𝑥 𝑐𝑦 1

𝑐𝑥, 𝑐𝑦 - camera center in pixels

(𝑓𝑥, 𝑓𝑦) - focal length in pixels per world unit

– 𝑓𝑥 =𝑓

𝑝𝑥, 𝑓𝑦 =

𝑓

𝑝𝑦

𝑠 – sensor axes skew coefficient

– 𝑠 = 𝑓𝑦 tan𝛼

Intrinsic Matrix

Radial Distortion

• 𝑥𝑡𝑎𝑛𝑔𝑒𝑛𝑡𝑖𝑎𝑙 = 𝑥𝑟𝑎𝑑𝑖𝑎𝑙 + 2𝑝1𝑥𝑦 + 𝑝2 𝑟2 + 2𝑥2

• 𝑦𝑡𝑎𝑛𝑔𝑒𝑛𝑡𝑖𝑎𝑙 = 𝑦𝑟𝑎𝑑𝑖𝑎𝑙 + 𝑝1 𝑟2 + 2𝑦2 + 2𝑝2𝑥𝑦

𝑥𝑟𝑎𝑑𝑖𝑎𝑙 = 1 + 𝑘1𝑟2 + 𝑘2𝑟

4 + 𝑘3𝑟6 𝑥

𝑦𝑟𝑎𝑑𝑖𝑎𝑙 = 1 + 𝑘1𝑟2 + 𝑘2𝑟

4 + 𝑘3𝑟6 𝑦

𝑥 and 𝑦 are in normalized image coordinates

– in world units relative to the optical center

Tangential Distortion

Page 24: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

28

Image Processing

Image Enhancement

– Deblurring

– Noise Removal

Image Segmentation

– Active Contours

– Watershed

Page 25: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

29

Feature Detection, Extraction and Matching

Corner Template SURF MSEREdge

Image MatchingFeature Point Tracking

Video Stabilization

Page 26: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

30

Stereo Vision (2014a)

Stereo calibration

Semi-global disparity matching

– Better results than block matching

3D scene reconstruction from

disparity

New demos available

– Estimate real distance to objects in

video

– 3D scene reconstruction

– Pedestrian detection (2014b)

Page 27: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

31

Stixel based Object Detection

Available to detect objects which are not easy using

other sensors

– Stationary object, overlapped object, kid….

* Stereo and City, Franke Uwe, Daimler Research Center

Page 28: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

32

Disparity Image

Stixel Representation

3D Reconstruction

Bird View

KLT Point Tracking

Stereo Vision Demo

Computer Vision System Toolbox

– Stereo camera calibration

– SGM based Stereo matching

– 3D reconstruction using camera

calibration data

– Kanade-Lucas-Tomasi point tracking

– 2D/3D plotting

Page 29: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

33

Point Cloud Processing (2015a)

pointCloud object

– Fast search using kdtree

– Tree is constructed implicitly when a

search is called first time

Downsampling

– Two method : ‘gridAverage’, ’random’

Visualization

Rigid registration

– ‘Iterative Closest Point’ Algorithm

Page 30: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

34

OCR – Optical Character Recognition (2014a)

Highly requested in Frontlines

Support for English, Japanese

Users can download additional

language support

Shipping demo with text detection

and OCR workflow

Page 31: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

35

Abstract

Vision

– Lane Detection

– Vehicle Detection

– Etc.

Radar

– FMCW Radar Modeling

Tracking

– Extend Kalman Filter based Tracking

Sensor Fusion

– Integration

Page 32: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

36

Modeling FMCW Radar for Automotive

The received signal is a delayed copy of the

transmitted signal

Ultra-large signal bandwidth (>100MHz)

Ultra high frequencies (>77GHz)

Car+Radar Target

Page 33: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

37

FMCW Radar: How Does it Work?

PA

LNA

Target =

Delay

DSP

RF

time

delay

beat

frequency

fre

qu

en

cy

Page 34: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

38

What Behavior Can Be Modeled?

PA

LNA

DSP

Determination of waveforms

(range, resolution)Algorithms for data analysis

Channel modeling

(interference, noise)

Modeling of antenna arrays

(no of elements, position)

Modeling of RF Impairments

(noise, non-linearity, frequency dependency)

Page 35: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

39

Which MathWorks Tools Can Help?

PA

LNA

DSP

Phased Array System Toolbox

Signal Processing Toolbox

Instrument Control Toolbox

Phased Array System Toolbox

DSP System Toolbox

Communications System Toolbox Phased Array System Toolbox

SimRF

Page 36: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

40

Waveform

GeneratorTransmitter

Transmit

Array

Signal

ProcessingReceiver

Receive

Array

Environment,

Targets, and

Interference

Phased Array System Toolbox

Waveforms

Pulse, LFM, FMCW, etc.

Tx Antenna Arrays

ULA, URA, etc.

Rx Antenna Arrays

ULA, URA, etc.

Beamforming, Matched

Filtering, Detection, CFAR,

STAP, etc.

Transmitter

Monostatic and Bistatic

Receiver

Monostatic and Bistatic

Environment effects,

impairments, interference

Algorithms

Simulation Tools

Page 37: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

41

Waveform

GeneratorTransmitter

Transmit

Array

Signal

ProcessingReceiver

Receive

Array

Environment,

Targets, and

Interference

Phased Array System Toolbox

Waveforms

Pulse, LFM, FMCW, etc.

Tx Antenna Arrays

ULA, URA, etc.

Rx Antenna Arrays

ULA, URA, etc.

Beamforming, Matched

Filtering, Detection, CFAR,

STAP, etc.

Transmitter

Monostatic and Bistatic

Receiver

Monostatic and Bistatic

Environment effects,

impairments, interference

Algorithms

Simulation Tools

Design & Analyze

Tools

Page 38: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

43

Radar Simulation

Page 39: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

44

Abstract

Vision

– Lane Detection

– Vehicle Detection

– Etc.

Radar

– FMCW Radar Modeling

Tracking

– Extend Kalman Filter based Tracking

Sensor Fusion

– Integration

Page 40: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

45

Moving From Detections to Tracking

Detect moving objects

Estimate motion of each object

Assign detections to tracks using data association

Innovate track data from detected objects

Page 41: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

46

Kalman Filter

Kalman Filter (Linear)

Predict

a priori state estimate

a priori estimate covariance

Update

Innovation residual

Innovation covariance

Kalman gain

a posteriori state estimate

a posteriori estimate covariance

From Wikipedia,

Page 42: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

47

Kalman Filter

Kalman Filter (Linear)

Predict

a priori state estimate

a priori estimate covariance

Update

Innovation residual

Innovation covariance

Kalman gain

a posteriori state estimate

a posteriori estimate covariance

Function in MATLAB (Computer Vision System Toolbox)

– Define :

kalmanFilter = configureKalmanFilter(MotionModel, InitialLocation,

InitialEstimateError, MotionNoise, MeasurementNoise)

– Prediction :

pred_location = kalmanFilter.predict()

– Correction :

corrected_location = kalmanFilter.correct(observed_location)

Page 43: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

48

Kalman Filter

Kalman Filter (Linear)

Predict

a priori state estimate

a priori estimate covariance

Update

Innovation residual

Innovation covariance

Kalman gain

a posteriori state estimate

a posteriori estimate covariance

Blocks in MATLAB (DSP System Toolbox)

Page 44: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

49

Extended Kalman Filter

Extended Kalman Filter

Prediction

Innovation

Prediction

Innovation

Jacobian Matrix !!!

Page 45: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

50

How to Make Jacobian Matrix

From Wikipedia,

Page 46: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

51

Solution

MuPAD in Symbolic Math Toolbox

Define X vector

Calculate 𝜕𝒇

𝜕𝒙

Define f vector

Page 47: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

52

Solution

MuPAD in Symbolic Math Toolbox

Page 48: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

53

Data Association for Tracking Multiple Objects

James Munkres's variant of the Hungarian assignment

algorithm

– [assignments,unassignedTracks,unassignedDetections] =

assignDetectionsToTracks( costMatrix,costOfNonAssignment)

– Example of costMatrix

costMatrix = zeros(nTracks,nDetect);

for i = 1:nTracks

costMatrix(i, :) = distance(predictedTracks(i), Detections);

endPredicted

location

Detection

Page 49: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

54

Abstract

Vision

– Lane Detection

– Vehicle Detection

– Etc.

Radar

– FMCW Radar Modeling

Tracking

– Extend Kalman Filter based Tracking

Sensor Fusion

– Integration

Page 50: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

56

Integration in Simulink

Input : Image &

Target Info.

Radar Module

. Radar

Modeling

. Detection

. Tracking

Fusion Module

. Data Association

. Data Fusion, TTC

. In-Path Vehicle

Visualization

Camera Module

. Lane Detection

. Vehicle

Detection

. Tracking

Page 51: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

57

• Use a single file for multiple

engineers

• Chaotic

• Keeping track of file dependencies

How Can I Reduce Inefficiency

when Integrating Models?

What’s the problem which this

model has in terms of

“Integration”?

Page 52: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

58

Partitioning a Model using Model Blocks

Model Reference used to

partition top-level model into

components

Signal Buses & Bus Objects

used to define the interfaces

between components

One file-per-component fits well

with Revision Control packages

Enabler for parallel development

of components

Parent Model

OLD MODEL

Child Model

Page 53: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

59

One model Variation Management

Variant Subsystems

Page 54: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

61

• Use a single file for multiple

engineers

• Chaotic

• Keeping track of file dependencies

How Can I Reduce Inefficiency

when Integrating Models?

What’s the problem which this

model has in terms of

“Integration”?

Page 55: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

62

Simulink Projects

Search, manage, and share

project-related files

Conduct peer review of

changes using Simulink XML

comparison tool

Access source control

functionality for team

collaboration

Manage project-related files

efficiently within Simulink

Page 56: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

63

Simulation Result

* : Vision Target

o : Radar Target

x : Fusion Target

Yaw Rate Based

Lane Based

Page 57: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

64

Simulation Result

Stationary Vehicle

No Radar Target

Page 58: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

65

Simulation Result

Page 59: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

66

Conclusion

MATLAB/Simulink and etc. provide an environment to

develop algorithm, modeling environment and integrate

algorithms and various types of sensor models.

– For Vision or Lidar Sensor :

Image Acquisition Toolbox

Image Processing Toolbox

Computer Vision System Toolbox

– For Radar Sensor

Phased Array System Toolbox

SimRF

Signal Processing Toolbox

Simulink is a good platform for team collaboration

– Simulink Project

Page 60: MATLAB 및Simulink를이용한운전자 지원시스템개발 · Code Generation. 14 ... Access source control functionality for team collaboration Manage project-related files

67

More Information

Computer Vision

– Computer Vision Workflow in MATLAB/Simulink

http://www.matlabexpo.com/kr/2015/sessions/t1-s2.html

– Object Detection and Tracking

http://in.mathworks.com/videos/computer-vision-with-matlab-for-object-detection-and-

tracking-81866.html?s_tid=srchtitle

– Face Recognition with MATLAB

http://in.mathworks.com/videos/face-recognition-with-matlab-98076.html?s_tid=srchtitle

Radar Design

– Modeling and Simulating Radar Systems Using MATLAB and Simulink

http://in.mathworks.com/videos/modeling-and-simulating-radar-systems-using-matlab-and-

simulink-81966.html?s_tid=srchtitle

– Design and Verify RF Transceivers for Radar Systems

http://in.mathworks.com/videos/design-and-verify-rf-transceivers-for-radar-systems-

81990.html?s_tid=srchtitle

Users Stories

– Traffic Recognition System from Continental

– Radar Sensor Alignment Algorithm from Delphi