APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed +...

25
Maung Han Alpine Electronics Research May 2016 APPLICATION OF MATLAB & CODER FOR AN AUTOMOTIVE VISION PROOF OF CONCEPT Alpine Electronics Research of America 1

Transcript of APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed +...

Page 1: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Maung Han

Alpine Electronics Research

May 2016

APPLICATION OF

MATLAB & CODER FOR

AN AUTOMOTIVE VISION PROOF OF CONCEPT

Alpine Electronics Research of America 1

Page 2: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Outline• Why Detect Ground?

• Our Project Goals

• Why MATLAB &Coder

• Development Process

• Results

• Conclusion

• Acknowledgements

Alpine Electronics Research of America 2

Page 3: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 3

Why Detect Ground?• Traditional automotive camera systems can detect pedestrians, cars

and some other objects.

• Trade off between distance sensitivity and object sensitivity.

Dis

tan

ce s

en

siti

vity

Object sensitivity

• Current approaches will take too much computational resources to attain both.

Page 4: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 4

Why Detect Ground?Detection Technology

Method Target (Results)

Sonar sensor Sound waves Accurate distance.Does not know what the object is.

Object recognition

Computer vision Pedestrians, cars, other “trained” objects. Poor distanceaccuracy.

Movement detection

Moving object against background

Anything that moves. Does not detect otherwise. Poorer distance accuracy.

If we know the ground, we can detect both objects and their distances!

Page 5: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Our Project Goals• Detect ground areas in backup camera images

• Recognize various types of ground patterns

• “Un-recognize” various non-ground objects and patterns

• Performance targeted to be near real-time

• At or above 10fps will be considered acceptable

• Less than 500 ms delay

Alpine Electronics Research of America 5

Page 6: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 6

What Does Ground Look Like?

Page 7: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 7

Are These Ground?

Page 8: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 8

Our Definition of Ground• Fairly Smooth (Drivable)

• Even textured

• Discernable from the surrounding

• May have irregular but common imperfections

Page 9: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Why MATLAB & Coder• Alternative choices

• Native C/C++ development

• OpenCV, OpenVX, PCL

• Other open platform alternatives

Alpine Electronics Research of America 9

Page 10: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Why MATLAB & Coder• Pros

+ Fast development speed

+ Familiarity of engineers with the toolboxes

+ Quick turn around time for iterative development

+ Great support from the professional team

+ Direct conversion from MATLAB code to C/C++ code

+ Seamless integration with C/C++ code (SIL)

+ A rich collection of libraries and published material

• Cons- Language not available in embedded environment

- Lack of automated build process for building target code

- Slower performance compared to native development

Alpine Electronics Research of America 10

Page 11: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 11

Sample Images – Imperfections

Page 12: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 12

Sample Images – Light interference

Page 13: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 13

Sample Images - Pedestrian

Page 14: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Selection of test cases

Train system with sample sets

Perform segmentation

Classification of ground segments

Stabilization and marking

Evaluation

Development Process

Improve

Evaluate

Alpine Electronics Research of America 14

Page 15: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 15

Development Process – Test Cases• Ten different test cases covering:

• Parking lots

• Parking roads

• Ramps

• Gates

• Bushes

• Shadows

• Cars

• Pedestrians

Page 16: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Results - Accuracy• Achieved high recognition rates in our test cases.

• Median recognition rate on ten test cases: 99%

• Outliers at the low end due to “no ground” in view

• Slightly high false positive with a 23% median.

• Non-ground being recognized as ground

Alpine Electronics Research of America 16

0

200

400

600

800

1000

1200

1400

Nu

mb

er

of

imag

es

Recognition rate (recognized ground area/total ground area)

Page 17: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Results - Performance• Near real-time performance with ~10fps in SIL mode for “pure” algorithm

in Coder generated C.

• Achieved the delay target of ~500ms.

• Performance significantly dropped to ~5fps after removing all MATLAB dependency (e.g. data type dependency).

• Slowdown in converted C is attributed to:• Extra data type conversions or castings between functions

• Less efficient memory management (compared to MATLAB)

• Loss of multi-threading model from MATLAB

• Loss of highly optimized MATLAB library code

• Some Coder generated C-functions appear less efficient (than their MATLAB implementations)

Alpine Electronics Research of America 17

Page 18: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Sample Images• Sample videos and images will be shown here..

Alpine Electronics Research of America 18

Page 19: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 19

Results – Imperfections of ground

Page 20: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 20

Results – Light interference

Page 21: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 21

Results – Pedestrian

Page 22: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 22

Sample Video

Page 23: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Conclusion• MATLAB & Coder allowed us to focus on algorithm design

• Quick turn around time was ideal for experimentation

• Challenges in finding replacement or equivalent code in C for functions that cannot be converted by Coder

• Overall, MATLAB & Coder is a powerful tool for quick prototyping

• For future improvements:

• Our existing MATLAB code could be refactored into modules for more flexible C-code generation

Alpine Electronics Research of America 23

Page 24: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Acknowledgements

MathWorks Team

•Arvind Jayaraman

•Amit Deshpande

•Siva Nadarajah

•Pete Tsinzo

Alpine Team

•Priyen Shah

•Jun Cheng

•Dhruv Monga

•Kathy Li

•Joseph Chen

Alpine Electronics Research of America 24

Page 25: APPLICATION OF MATLAB & CODER - MathWorks · Why MATLAB & Coder •Pros + Fast development speed + Familiarity of engineers with the toolboxes + Quick turn around time for iterative

Alpine Electronics Research of America 25

Thank you!