49
Classification and learning for advanced driving-style assessment Mara Tanelli Politecnico di Milano [email protected] Modena, 28/05/2018

Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. [email protected]. Modena, 28/05/2018

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Classification and learning for advanced driving-style assessment

Mara TanelliPolitecnico di [email protected] Modena, 28/05/2018

Page 2: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Outline

• Many diverse «driving assistance» systems need accurate drivingstyle estimation

• Energy-managers in EVs• Attention monitors in ADAS systems• Insurance telematic applications & services

• The talk focuses on a novel 4-D drive-style assessment from smartphone-based data

• Joint work with: Simone Gelmini, Silvia Strada and Sergio Savaresi.• Industrial partners: Kirey & AlfaEvolution Technology (Unipol group)

2

Page 3: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Goal 1: design a set of safety-oriented cost functions for profiling the driving behavior

IntroductionGoals

Goal 2: extend the assessment adding the “phone-use” dimension

3

Page 4: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Goal: design a set of safety-oriented cost functions for profiling the driving behavior

• Data are collected with a smartphone app:

• GPS measurements• Vehicle speed 𝑣𝑣 𝑘𝑘𝑘𝑘

ℎ• Vehicle position (latitude, longitude 𝑑𝑑𝑑𝑑𝑑𝑑 , altitude 𝑚𝑚 )

• IMU measurements• Three axial accelerometers (𝑎𝑎𝑥𝑥, 𝑎𝑎𝑦𝑦 , 𝑎𝑎𝑧𝑧) 𝑘𝑘

𝑠𝑠2

• Three axial gyros (𝜔𝜔𝑥𝑥, 𝜔𝜔𝑦𝑦 , 𝜔𝜔𝑧𝑧) 𝑟𝑟𝑟𝑟𝑟𝑟𝑠𝑠

• Additional information• Types of street (urban, main, highway)• Speed limit• GPS quality

IntroductionGoal & available signals

Measurements are initially sampled at 𝟏𝟏 𝑯𝑯𝑯𝑯

4

Page 5: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Two drivers have used the APPS for four months during all their trips

Driver 1Device: AndroidAge: 24Profession: student

Driver 2Device: iPhoneAge: 52Profession: IT manager

IntroductionPreliminary tests 5

Page 6: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Since July, two drivers have used SMAPPI during all their trips

IntroductionPreliminary tests

20 40 60 80 100 1200

2000

4000

6000

8000

Driv

en d

ista

nce

[km

]

Driver 1

Driver 2

Cumulative

20 40 60 80 100 120

Test day

0

50

100

# tri

ps [-

]

6

Page 7: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Different orientations imply that inertial data are not descriptive of the vehicle dynamics

• may not be comparable𝒙𝒙

𝒚𝒚

𝑯𝑯

𝒙𝒙𝒚𝒚𝑯𝑯

𝒙𝒙

𝒚𝒚

𝑯𝑯

7Phase 1Self-calibration

Page 8: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

An example: sudden variations are due to different smartphone orientations

0 100 200 300 400 500 600 700 800 900 1000

-20

0

20

ax

[m/s

2]

0 100 200 300 400 500 600 700 800 900 1000

-20

0

20

ay

[m/s

2]

0 100 200 300 400 500 600 700 800 900 1000

Time [s]

-20

0

20

az

[m/s

2]

8Phase 1Self-calibration

Page 9: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Smartphone’s axes can be virtually aligned with respect to the vehicle axis

C.O.G.

𝒂𝒂𝒚𝒚𝒂𝒂𝒙𝒙

𝒂𝒂𝑯𝑯

𝝓𝝓

𝝍𝝍

𝝑𝝑

𝒙𝒙

𝒚𝒚

𝑯𝑯

𝒙𝒙𝒓𝒓𝒓𝒓𝒓𝒓

𝒚𝒚𝒓𝒓𝒓𝒓𝒓𝒓

𝑯𝑯𝒓𝒓𝒓𝒓𝒓𝒓

9Phase 1Self-calibration

Page 10: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

How?

𝒂𝒂𝒙𝒙𝒂𝒂𝒚𝒚𝒂𝒂𝑯𝑯

Data selection Attitude estimation

Axes rotation𝒂𝒂𝒙𝒙

𝒂𝒂𝒚𝒚

𝒂𝒂𝑯𝑯

�̂�𝜗 �𝜙𝜙 �𝜓𝜓

𝑥𝑥𝑥𝑥𝑥

𝜓𝜓

𝑥𝑥𝑥𝑥 𝑦𝑦𝑥𝑥

𝑧𝑧𝑥𝑥𝑦𝑦𝑥𝑥𝑥

Self-calibrationAlgorithm sketch 10

Page 11: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Three situations have been analyzed:

• Longitudinal forces: how intense and how frequent a driver accelerates or stops

• Lateral forces: turning at high speed is hazardous

• Speeding: it is unsafe driving too fast or too slow with respect to the street type

11Phase 2Driving-style assessment (3D)

Page 12: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

When aerodynamic downforce is irrelevant (like in the vast majority of vehicles), the maximum vehicle deceleration/acceleration (with no slip) is gravity

𝑣𝑣

𝑚𝑚 ⋅ 𝑑𝑑 ⋅ 𝜇𝜇 𝑚𝑚 ⋅ 𝑎𝑎

𝒎𝒎 ⋅ 𝒈𝒈

A strong brake/acceleration can be measured as how close the acceleration isto gravity

12Phase 2Driving-style assessment: longitudinal

Page 13: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Remark: the cost functionis still meaningful evenwhen aerodynamics holds• A stronger manouver gives a

higher cost function value

A signature of the longitudinal forces intensity can be derived

𝐽𝐽𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙 = �0 −𝑎𝑎𝑙𝑙ℎ < 𝑎𝑎 < 𝑎𝑎𝑙𝑙ℎ

�0

𝑇𝑇1 +

𝑎𝑎(𝑡𝑡)𝑑𝑑

2

𝑑𝑑𝑡𝑡 𝑜𝑜𝑡𝑡𝑜𝑑𝑑𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑑𝑑

0 2 4 6 8 10

a [m/s2

]

1

1.2

1.4

1.6

1.8

2

Jlo

ngitu

dina

l

where• 𝑇𝑇 is the dataset length• 𝑎𝑎𝑙𝑙ℎ is the acceleration threshold• 𝑑𝑑 gravity

13Phase 2Driving-style assessment: longitudinal

Page 14: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

0 100 200 300 400 500 600 700 800 900 1000 11000

50

100

150

Spee

d [k

m/h

]

Speed

Brakes

Accelerations

0 100 200 300 400 500 600 700 800 900 1000 1100-10

0

10

a [m

/s2

]

0 100 200 300 400 500 600 700 800 900 1000 1100

Time [s]

0

100

200

Jlo

ngitu

dina

l [-

]

14Phase 2Driving-style assessment: longitudinal

Page 15: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Turning at high speed is a signature of a sporty (and unsafe) driving style

15Phase 2Driving-style assessment: lateral

Page 16: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Lateral acceleration is

𝑎𝑎𝑙𝑙𝑟𝑟𝑙𝑙 𝑡𝑡 = �̇�𝜓 ⋅ 𝑣𝑣

where:• �̇�𝜓 is the yaw rate• 𝑣𝑣 is the vehicle speed

Thanks to full logs, we now have �̇�𝝍• when gyros are not available, lateral force cannot be evaluated

C.O.G.𝒂𝒂𝒍𝒍𝒂𝒂𝒓𝒓𝒂𝒂𝒍𝒍𝒓𝒓𝒍𝒍

𝒂𝒂𝒗𝒗𝒗𝒗𝒓𝒓𝒓𝒓

𝝓𝝓

𝝍𝝍

𝝑𝝑

16Phase 2Driving-style assessment: lateral

Page 17: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

-0.02 -0.02 -0.02 -0.01 -0.01 -0.01 -0.01 -0 0 0

Longitude [km]

-0.32

-0.21

-0.1

0.01

0.12

0.23

0.34

Latit

ude

[km

]

17Phase 2Driving-style assessment: lateral

Page 18: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

A signature of the lateral force intensity can be expressed as

𝐽𝐽𝑙𝑙𝑟𝑟𝑙𝑙𝑒𝑒𝑟𝑟𝑟𝑟𝑙𝑙 =0 −𝑎𝑎𝑙𝑙𝑟𝑟𝑙𝑙𝑙𝑙ℎ< 𝑎𝑎𝑙𝑙𝑟𝑟𝑙𝑙 𝑡𝑡 < 𝑎𝑎𝑙𝑙𝑟𝑟𝑙𝑙𝑙𝑙ℎ 𝑜𝑜𝑜𝑜 𝑣𝑣 𝑡𝑡 < 𝑣𝑣𝑙𝑙𝑙𝑙−𝑘𝑘𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙

�0

𝑇𝑇1 +

𝑎𝑎𝑙𝑙𝑟𝑟𝑙𝑙 𝑡𝑡𝑑𝑑

2

𝑑𝑑𝑡𝑡 𝑜𝑜𝑡𝑡𝑜𝑑𝑑𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑑𝑑

where:

• 𝑎𝑎𝑙𝑙𝑟𝑟𝑙𝑙𝑙𝑙ℎ = 1 ms2

• 𝑣𝑣𝑙𝑙𝑙𝑙−𝑘𝑘𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙 = 10 𝑘𝑘𝑘𝑘ℎ

• 𝑑𝑑 is gravity and it is used as a normalization factor to compare this cost function with the longitudinal one

18Phase 2Driving-style assessment: lateral

Page 19: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

100 200 300 400 500 600 700 800 900 1000 11000

50

100

Spee

d [k

m/h

]

100 200 300 400 500 600 700 800 900 1000 1100-10

0

10

ala

t [m

/s2

]

100 200 300 400 500 600 700 800 900 1000 1100

Time [s]

0

100

200

300

Jla

tera

l [-

]

19Phase 2Driving-style assessment: lateral

Page 20: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Driving too fast (or excessively slow) is hazardous

20Phase 2Driving-style assessment: speed limits

Page 21: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Knowing the speed limit, we can derive a speeding cost function as

𝐽𝐽𝑠𝑠𝑠𝑠𝑒𝑒𝑒𝑒𝑟𝑟𝑙𝑙𝑙𝑙𝑙𝑙 =

0 𝑣𝑣 𝑡𝑡 < 𝑣𝑣𝑟𝑟𝑒𝑒𝑟𝑟𝑟𝑟 𝑧𝑧𝑙𝑙𝑙𝑙𝑒𝑒1𝑞𝑞2�0

𝑇𝑇𝑣𝑣 𝑡𝑡 − 𝑣𝑣𝑙𝑙𝑙𝑙𝑘𝑘𝑙𝑙𝑙𝑙 𝑡𝑡

2𝑑𝑑𝑡𝑡 𝑣𝑣 𝑡𝑡 ≥ 𝑣𝑣𝑙𝑙𝑙𝑙𝑘𝑘𝑙𝑙𝑙𝑙

𝜶𝜶𝑞𝑞2�0

𝑇𝑇𝑣𝑣 𝑡𝑡 − 𝑣𝑣𝑙𝑙𝑙𝑙𝑘𝑘𝑙𝑙𝑙𝑙 𝑡𝑡

2𝑑𝑑𝑡𝑡 𝑣𝑣 𝑡𝑡 < 𝑣𝑣𝑙𝑙𝑙𝑙𝑘𝑘𝑙𝑙𝑙𝑙

where• 𝑣𝑣 𝑡𝑡 is the vehicle speed• 𝑣𝑣𝑟𝑟𝑒𝑒𝑟𝑟𝑟𝑟 𝑧𝑧𝑙𝑙𝑙𝑙𝑒𝑒 is a the minimum speed analysed (e.g. for avoid big

mismatches with the speed limit during traffic) - 𝑣𝑣𝑟𝑟𝑒𝑒𝑟𝑟𝑟𝑟 𝑧𝑧𝑙𝑙𝑙𝑙𝑒𝑒 = 10 𝑘𝑘𝑘𝑘ℎ

• 𝑣𝑣𝑙𝑙𝑙𝑙𝑘𝑘𝑙𝑙𝑙𝑙(𝑡𝑡) is the speed limit at instant 𝑡𝑡

• 𝑞𝑞 is the maximum speed “amissible” above the speed limit - 𝑞𝑞 = 40 𝑘𝑘𝑘𝑘ℎ

• 𝛼𝛼 is a weighting function for driving slower than limit - 𝛼𝛼 = 0.01

Remark: with 𝛼𝛼 = 0, slowerdrivers are not penalized

21Phase 2Driving-style assessment: speed limits

Page 22: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Cost functions are normalized wrt the traveled distance

𝐽𝐽𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙/𝑘𝑘𝑘𝑘 =𝐽𝐽𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙𝑑𝑑𝑜𝑜𝑜𝑜𝑡𝑡𝑎𝑎𝑑𝑑𝑑𝑑𝑑𝑑

𝐽𝐽𝑙𝑙𝑟𝑟𝑙𝑙𝑒𝑒𝑟𝑟𝑟𝑟𝑙𝑙/𝑘𝑘𝑘𝑘 =𝐽𝐽𝑙𝑙𝑟𝑟𝑙𝑙𝑒𝑒𝑟𝑟𝑟𝑟𝑙𝑙𝑑𝑑𝑜𝑜𝑜𝑜𝑡𝑡𝑎𝑎𝑑𝑑𝑑𝑑𝑑𝑑

𝐽𝐽𝑠𝑠𝑠𝑠𝑒𝑒𝑒𝑒𝑟𝑟𝑙𝑙𝑙𝑙𝑙𝑙/𝑘𝑘𝑘𝑘 =𝐽𝐽𝑠𝑠𝑠𝑠𝑒𝑒𝑒𝑒𝑟𝑟𝑙𝑙𝑙𝑙𝑙𝑙𝑑𝑑𝑜𝑜𝑜𝑜𝑡𝑡𝑎𝑎𝑑𝑑𝑑𝑑𝑑𝑑

Cost function Value

𝐽𝐽𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙𝑙𝑙𝑟𝑟𝑙𝑙/𝑘𝑘𝑘𝑘 9.3384

𝐽𝐽𝑙𝑙𝑟𝑟𝑙𝑙𝑒𝑒𝑟𝑟𝑟𝑟𝑙𝑙/𝑘𝑘𝑘𝑘 11.9618

𝐽𝐽𝑠𝑠𝑠𝑠𝑒𝑒𝑒𝑒𝑟𝑟𝑙𝑙𝑙𝑙𝑙𝑙/𝑘𝑘𝑘𝑘 1.9915

cost functions of the example showed

22Phase 2Driving-style assessment: summing up

Page 23: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Based on the proposed profiling cost functions, drivers can be compared

Driver 1 Driver 20

10

20

30

40

50

60

70

80

Cos

t fun

ctio

n [k

m-1

]

Longitudinal

Driver 1 Driver 2

Driver

0

10

20

30

40

50

60

70

80Lateral

Driver 1 Driver 20

10

20

30

40

50

60

70

80Speeding

23Phase 2Driving-style assessment: summing up

Page 24: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

By taking the median value, it is possible to compare the drivers’ behavior

Driver comparison

1.0 2.1 3.1

0.0

3.3

6.5

6.4

20.8

35.3

Speeding

Lateral

Longitudinal

Driver 1

Driver 2

The wider the triangle, the more hazardous the

driver is

24Phase 2Driving-style assessment: summing up

Page 25: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Goal 2: add the info of whether (and for how long) the driver is using the phone

Goal 1: design a set of safety-oriented cost functions for profiling the driving behavior

25Phase 34D driving-style assessment: add phone use dimension

Page 26: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Several tests have been performed:

26Phase 34D driving-style assessment: add phone use dimension

Page 27: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Analyzing three accelerometer/gyro signals separately might be unnecessarily complicated

A single inclusive signal can be derived from them:

𝒂𝒂𝒚𝒚 𝒂𝒂𝒙𝒙

𝒂𝒂𝑯𝑯

𝒂𝒂𝑎𝑎 = 𝑎𝑎𝑥𝑥2 + 𝑎𝑎𝑦𝑦2 + 𝑎𝑎𝑧𝑧2

The acceleration norm 𝑎𝑎 (or gyro norm 𝜔𝜔 ):• can be interpreted as the intensity of all

the acceleration (gyro) signals• is insensitive to the orientation

𝜔𝜔 = 𝜔𝜔𝑥𝑥2 + 𝜔𝜔𝑦𝑦2 + 𝜔𝜔𝑧𝑧2

27Phase 3Phone use detection

Page 28: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Data preprocessing

(filtering)

0 5 10 15 20 250

0.05

0.1

0.15

0.2

Mag

nitu

de a

[m/s

2]

Condition: moving

Using

On passenger Seat

0 5 10 15 20 25

Frequency [Hz]

0

0.05

0.1

0.15

0.2

Mag

nitu

de a

[m/s

2]

Condition: engine on

Useful for classification

Useless for classification

We now have to filter data and select subjective features….

Phase 3Phone use detection: SVM-based classification

The data preprocessing phase usually consists in filtering the signals in order to enhance the classification performance

Page 29: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

A classification problem can be set-up with Support Vector Machine (SVM)

Why SVM?• Good performance

• Can be easily run online in a smartphone

• Not a big storage is required• Not biased by outliers• Avoid curse of dimensionality• Easily interpretable

29Phase 3Phone use detection: SVM-based classification

Page 30: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Once acceleration and gyro norms are debiased

[r

ad/s

]

[r

ad/s

]

[r

ad/s

]

30Phase 3Phone use detection: SVM-based classification

Page 31: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

0 10 20 30

-5

0

5

|a|

bpf

[m/s

2]

0 10 20 30

-5

0

5

|a|

sbf

[m/s

2]

Using

On passenger seat

On phone support

0 10 20 30

Time [s]

-1

-0.5

0

0.5

1

|| bp

f [r

ad/s

]

0 10 20 30

Time [s]

-1

-0.5

0

0.5

1

|| lp

f [r

ad/s

]

Variance of the signals

Features can be extracted from the filtered signals subjective step!!!!

31Phase 3Phone use detection: SVM-based classification

Page 32: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Selection of the most performing set of features

𝑇𝑇𝑜𝑜𝑎𝑎𝑜𝑜𝑑𝑑𝑑𝑑𝑑𝑑 𝑎𝑎𝑎𝑎𝑑𝑑𝑜𝑜𝑜𝑜𝑜𝑜𝑡𝑡𝑜𝑚𝑚

𝑀𝑀𝑑𝑑𝑎𝑎𝑑𝑑𝑉𝑉𝑎𝑎𝑜𝑜 𝑎𝑎 𝐵𝐵𝐵𝐵𝐵𝐵

𝑉𝑉𝑎𝑎𝑜𝑜 𝑎𝑎 𝑆𝑆𝐵𝐵𝐵𝐵

𝑁𝑁𝑙𝑙𝑙𝑙𝑙𝑙 = �𝑘𝑘=1

𝑙𝑙𝑑𝑑𝑘𝑘

= �𝑘𝑘=1

55𝑘𝑘

= 31

SVMFeature

combination

𝑆𝑆𝑑𝑑𝑎𝑎𝑑𝑑𝑑𝑑𝑡𝑡𝑑𝑑𝑑𝑑𝑓𝑓𝑑𝑑𝑎𝑎𝑡𝑡𝑓𝑓𝑜𝑜𝑑𝑑𝑜𝑜

𝑉𝑉𝑎𝑎𝑜𝑜( 𝑎𝑎 𝐵𝐵𝐵𝐵𝐵𝐵)

𝑉𝑉𝑎𝑎𝑜𝑜( 𝑎𝑎 𝑆𝑆𝐵𝐵𝐵𝐵)

𝑉𝑉𝑎𝑎𝑜𝑜 𝜔𝜔 𝐵𝐵𝐵𝐵𝐵𝐵

𝑉𝑉𝑎𝑎𝑜𝑜 𝜔𝜔 𝐿𝐿𝐵𝐵𝐵𝐵

Test all possible combinations

32Phase 3Phone use detection: SVM-based classification

Page 33: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

33

Data preprocessing

(filtering)𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑𝑎𝑎𝑎𝑎1

𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑𝑎𝑎𝑎𝑎𝑙𝑙

Data preprocessing

(filtering)

Statistical moment extraction

Statistical moment extraction

𝑆𝑆𝑑𝑑𝑎𝑎𝑑𝑑𝑑𝑑𝑡𝑡𝑑𝑑𝑑𝑑𝑓𝑓𝑑𝑑𝑎𝑎𝑡𝑡𝑓𝑓𝑜𝑜𝑑𝑑𝑜𝑜Fe

atur

es se

lect

ion

Classification algorithm

𝑇𝑇𝑜𝑜𝑎𝑎𝑜𝑜𝑑𝑑𝑑𝑑𝑑𝑑𝑎𝑎𝑎𝑎𝑑𝑑𝑜𝑜𝑜𝑜𝑜𝑜𝑡𝑡𝑜𝑚𝑚

In nearly all classification approaches, the overall approach is:

Can this process be automated?

Phase 3Phone use detection: approach

Page 34: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

0 5 10 15 20 250

0.05

0.1

0.15

0.2

Mag

nitu

de a

[m/s

2]

Condition: moving

Using

On passenger Seat

0 5 10 15 20 25

Frequency [Hz]

0

0.05

0.1

0.15

0.2

Mag

nitu

de a

[m/s

2]

Condition: engine on

Useful for classification

Useless for classification

Spectral analysis can reveal the most informative harmonics

Phase 3Phone use detection: initial data

Let’s go back to the initial data….

Page 35: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Cepstrum is defined as the inverse Fourier transform of the logarithm of the spectrum of the signal (Bogert et al, 1963; Lawers & De Moor, IEEE CSL 2017)

𝐹𝐹 𝐹𝐹−1log𝑦𝑦 𝑑𝑑𝑦𝑦

0 10 20 30 40

Lag [samples]

-0.5

0

0.5

1

1.5

2

cy

c|a|

c| |

0 2 4 6 8 100

10

20

30

|a|

0 2 4 6 8 10

Time [s]

0

1

2

||

Phase 3Phone use detection: ceptrum-based classification

Page 36: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

According to Martin (IEEE TSP 2000), cepstrum coefficients can be used as features to cluster time-series

Given two data generating systems (𝑀𝑀, 𝑀𝑀′), a metric based on the cepstrumcoefficients can be formulated as (Martin’s distance)

𝑑𝑑 𝑀𝑀,𝑀𝑀′ = �𝑙𝑙=1

𝑑𝑑 𝑑𝑑𝑙𝑙 − 𝑑𝑑𝑙𝑙′ 2

12

• 𝑑𝑑 is low if 𝑀𝑀 and 𝑀𝑀′ have similar cepstrum coefficients (similar spectra)• 𝑑𝑑 is high if 𝑀𝑀 and 𝑀𝑀′ have different cepstrum coefficients (different

spectra)

Idea: why don’t we design a classification algorithm which performs the classification online based on the learned cepstrum?

Phase 3Phone use detection: ceptrum-based classification

Page 37: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

To do this, we have designed fierClass

• Training

�Γ 𝜔𝜔 =𝑘𝑘𝑁𝑁

�𝑙𝑙=1

𝑘𝑘

Γi(𝜔𝜔)

where:• 𝑁𝑁 is the dataset length• 𝑘𝑘 is the window length• Γi(𝜔𝜔) is the spectrum evaluated in the i-th window of dimension 𝑘𝑘

1. The averaged spectrum �Γ 𝜔𝜔 is computed

Phase 3Phone use detection: ceptrum-based classification

Page 38: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

fierClassTraining

0 10 20 30 40 50 60

Frequency [Hz]

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

Mag

nitu

de

( )�

2. The cepstrum coefficients are computed from the averaged spectrum �Γ 𝜔𝜔

0 10 20 30 40

Lag [samples]

0

0.5

1

1.5

2

2.5

Cep

stru

m c

oeffi

cien

ts

Cepstrum coefficients are computed for all the classes and all the signals

Page 39: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

fierClassPrediction

• Prediction

1. Given a testing set, we compute the cepstrum coefficients on a sliding window of dimensions 𝑘𝑘

0 20 40 60 80 1005

10

15

|a| [

m/s

2]

0 20 40 60 80 100

Time [s]

0

2

4

|| [

rad/

s]

0 10 20 30 40

Lag [samples]

-0.5

0

0.5

1

1.5

2

cy

c|a|

c| |

Page 40: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

fierClassPrediction

2. Cepstrum computed on the testing data is compared with all the 𝑎𝑎trained cepstrum according to the Martin’s distance:

𝑑𝑑 𝐶𝐶𝑎𝑎𝑎𝑎𝑜𝑜𝑜𝑜1,𝑇𝑇𝑑𝑑𝑜𝑜𝑡𝑡 = �𝑙𝑙=1

𝑙𝑙

𝑑𝑑 𝑑𝑑𝐶𝐶𝑙𝑙𝑟𝑟𝑠𝑠𝑠𝑠1𝑙𝑙 − 𝑑𝑑𝑇𝑇𝑒𝑒𝑠𝑠𝑙𝑙𝑛𝑛2

12

𝑑𝑑 𝐶𝐶𝑎𝑎𝑎𝑎𝑜𝑜𝑜𝑜𝑙𝑙 ,𝑇𝑇𝑑𝑑𝑜𝑜𝑡𝑡 = �𝑙𝑙=1

𝑙𝑙

𝑑𝑑 𝑑𝑑𝐶𝐶𝑙𝑙𝑟𝑟𝑠𝑠𝑠𝑠𝑙𝑙𝑙𝑙 − 𝑑𝑑𝑇𝑇𝑒𝑒𝑠𝑠𝑙𝑙𝑛𝑛2

12

Page 41: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Classifier performance are compared in terms of standard classification indexes…

Case 1 Case 2

Case 2

Case 1

FP

TP

TN

FN

Confusion Matrix

Rows: True Data

True positive

False positive True negative

False negative

Columns: Predicted data

𝐴𝐴𝑑𝑑𝑑𝑑𝑓𝑓𝑜𝑜𝑎𝑎𝑑𝑑𝑦𝑦 =𝑇𝑇𝑇𝑇 + 𝑇𝑇𝑁𝑁𝑇𝑇 + 𝑁𝑁

𝑆𝑆𝑑𝑑𝑑𝑑𝑜𝑜𝑜𝑜𝑡𝑡𝑜𝑜𝑣𝑣𝑜𝑜𝑡𝑡𝑦𝑦 =𝑇𝑇𝑇𝑇𝑇𝑇

𝑆𝑆𝑆𝑆𝑑𝑑𝑑𝑑𝑜𝑜𝑓𝑓𝑜𝑜𝑑𝑑𝑜𝑜𝑡𝑡𝑦𝑦 =𝑇𝑇𝑁𝑁𝑁𝑁

41Phase 3Phone use detection: classification performance

Page 42: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

520 540 560 580 600 620 640 660 680

Time [s]

No

Yes

Usi

ng fl

ag

Trained SVM

Using label

Prediction

A spike

…and also in terms of dynamic performance

The number of spikes is a signature of how the model is

sensitive to instant outliers

42Phase 3Phone use detection: classification performance

Page 43: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Once tuned, the classifiers were tested against different data

0 100 200 300 400 500 600 700

No

Yes

Usi

ng F

lag

[-]

Online Validation Using label

SVM

0 100 200 300 400 500 600 700

Time [s]

No

Yes

Usi

ng F

lag

[-]

Using label

fierClass - |a| window=10 [s], t=3

Phase 3Phone use detection: classifiers’ comparison

Page 44: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

The designed classifiers (SVM and fierClass) run at 150 [Hz] (max IMU sampling frequency), though the real app logs data at 1 [Hz]

The prediction can be undersampled by evaluating its mean over each second

𝑈𝑈𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑% =1

𝑓𝑓𝑠𝑠𝑟𝑟𝑘𝑘𝑠𝑠𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙�𝑙𝑙=0

𝑓𝑓𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑙𝑙𝑠𝑠𝑛𝑛𝑠𝑠

𝑓𝑓𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑𝑓𝑓𝑙𝑙𝑟𝑟𝑙𝑙(𝑜𝑜)

𝑈𝑈𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑𝑙𝑙𝑙𝑙𝑟𝑟𝑒𝑒𝑟𝑟𝑠𝑠𝑟𝑟𝑘𝑘𝑠𝑠𝑙𝑙𝑒𝑒𝑟𝑟 = �0 𝑓𝑓𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑% < 0.51 𝑓𝑓𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑% ≥ 0.5

Phase 3Phone use detection: classifiers’ comparison

Page 45: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Final performance

Classifier Features used Accuracy[%]

Sensitivity[%]

Specificity[%]

Steady rise[s]

Steady fall[s]

# Spikes[-]

SVM(benchmark)

• Variance 𝜔𝜔 𝐵𝐵𝐵𝐵𝐵𝐵 99.41 99.51 99.156 1.67 6.2 0

fierClass |𝑎𝑎| 3th order cepstrumcoefficients

97.396 96.84 99.057 4.667 5 0

fierClass |𝜔𝜔| 3th order cepstrumcoefficients

98.152 98.576 97.009 2 4.2 0

Phase 3Phone use detection: classifiers’ comparison

Page 46: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

…we finally conclude proposing a new approach

Data fusion

𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑𝑎𝑎𝑎𝑎1

𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑𝑎𝑎𝑎𝑎𝑙𝑙

… Clustering

fierClass

Cepstrum Metric𝑇𝑇𝑜𝑜𝑎𝑎𝑜𝑜𝑑𝑑𝑑𝑑𝑑𝑑𝑎𝑎𝑎𝑎𝑑𝑑𝑜𝑜𝑜𝑜𝑜𝑜𝑡𝑡𝑜𝑚𝑚

…in which the most time-consuming part is completely automated

Phase 3Phone use detection: comparison of the approaches

Page 47: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

Drivers can be profiled based on their phone use in terms of

• how often

𝑈𝑈𝑜𝑜𝑑𝑑𝑓𝑓𝑟𝑟𝑒𝑒𝑓𝑓 = �# 𝑆𝑆𝑑𝑑𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑑𝑑𝑠𝑠𝑙𝑙𝑟𝑟𝑟𝑟𝑙𝑙

𝑈𝑈𝑜𝑜𝑑𝑑𝑘𝑘𝑒𝑒𝑟𝑟𝑙𝑙−𝑙𝑙𝑙𝑙𝑘𝑘𝑒𝑒 =1

𝑈𝑈𝑜𝑜𝑑𝑑𝑓𝑓𝑟𝑟𝑒𝑒𝑓𝑓� 𝑡𝑡𝑆𝑆𝑒𝑒𝑠𝑠𝑠𝑠𝑙𝑙𝑙𝑙𝑙𝑙𝑒𝑒𝑛𝑛𝑒𝑒 − 𝑡𝑡𝑆𝑆𝑒𝑒𝑠𝑠𝑠𝑠𝑙𝑙𝑙𝑙𝑙𝑙𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠

• how long

47Phase 3Phone use detection: new risk-index

Page 48: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Mara Tanelli – MoRE on Automotive, May 28th 2018

• Phone use detection is possible by means of a proper signal processing and a simple machine learning classifier

• Phone use detection can be adapted to fit the same sampling rate of the smartphone app by creating an intensity index 𝑈𝑈𝑜𝑜𝑜𝑜𝑑𝑑𝑑𝑑%

• Two classification approaches have been tested:• SVM (classical)• Cepstrum based promising results and more objective procedure

• Current work: find a cepstrum-based approach that can mix multiple signals to get better performance (idea: work on signal convolution)

48Concluding remarks & outlook

Page 49: Classification and learning for advanced driving-style ... · 5/28/2018  · driving-style assessment Mara Tanelli Politecnico di Milano. mara.tanelli@polimi.it. Modena, 28/05/2018

Thank you

Mara TanelliJoint work with:Simone Gelmini, Silvia Strada, Sergio Savaresi