Skip to content

Repository files navigation

Machine learning based driver behaviour using CAN bus data

Overview

A vast amount of CAN bus data is generated by every moving vehicle. In this project, those data are exploited to a greater advantage of identifying the driver behaviour at any point of time with the help of machine learning algorithms. In particular, eight CAN signals which are listed below were used to serve the purpose. Two models are built for this purpose. A successful attempt has been made to built a road classification model using those eight CAN signals in order to identify the road in which the vehicle is moving, with the GPS information as the ground truth. The Support Vector Classifier (SVC), Decision Tree and Random Forest algorithms were used to classify the type of road. Different pre-processing techniques and statistical features were tried to finalise the best method for the input data. The optimal performance with an an accuracy and F1 score of 0.97 was obtained when CAN signals sampled at 250 milliseconds were pre-processed using techniques like scaling or normalisation before giving it as input to the Random Forest algorithm with 150 estimators.

The successful result of the road classification model had been utilised on the datasets of a single model car driven by 49 drivers. The driver behaviour had been identified using clustering algorithms; namely Kmeans and Gaussian Mixture Model (GMM), due to non-availability of the ground truth. Clustering of normal and aggressive behaviour was done for each road type and is compared with the performance of clustering the entire dataset. Since the ground truth labels were unavailable for the datasets utilised for driver behaviour model, cluster validation was done using threshold values of lateral and longitudinal acceleration signals as the reference values. The labels obtained using the clustering algorithms were checked against the threshold values, and the cluster was decided aggressive if the majority of the samples satisfy the aggressive behaviour's threshold values. Clustering done on four driver's dataset reveal that the GMM algorithm either outperformed the Kmeans algorithm or almost equally performed in terms of F1 scores calculated based on the threshold values in most of the cases. Also, applying the standardisation technique like scaling helped the algorithms to identify the aggressive samples better.


Data

This project was impemented as part of my master thesis and the dataset used is private, and hence the data is not included here. Same set of signals were used for both the road classification and driver behaviour clustering models. The signals were sampled at 250ms (milli seconds).

Signals

  1. Speed (Kilometer/hour)
  2. Revolutions per second (Hertz)
  3. Longitudinal acceleration (Meter/second2)
  4. Lateral acceleration (Meter/second2)
  5. Yaw rate (Arc/second)
  6. Gas pedal pressure (Percent)
  7. Brake pedal pressure (Bar)
  8. Current gear (-)

Part 1 - Road classification model

Pre-processing techniques

  1. Ground truth - Found the type of road in which vehicle is moving using the GPS location. The location information is then cross referenced with OpenStreetMap to find the different types of roads. Later they were merged to three types namely: Residential, Motorway, Connecting roads.
  2. Data cleaning
  3. Data normalization

Algorithms

  1. Support Vector Classifier (SVC)
  2. Decision Tree
  3. Random Forest

Evaluation method

  1. Accuracy
  2. F1-score

Part 2 - Driver behaviour clustering

Pre-processing techniques

  1. Data cleaning
  2. Data normalization

Algorithms

  1. Kmeans
  2. Gaussian Mixture Model (GMM)

Evaluation method

Due to the absence of labelled data, the following thresholds of longitudinal and lateral acceleration signals were used to find the normal and aggressive data points which were then compared with the results of the clustering algorithms. Though this is not the best solution, I believe it is a good start for unlabelled data.

Signals Normal Aggressive
Longitudinal acceleration (m/s2) -3 to 3 ≥ 3 or ≤ -3
Lateral acceleration (m/s2) -1 to 1 ≥ 1 or ≤ -1

About

Classifies the road type and clusters different driver behaviours (driving normally or abnormally) based on each road type using CAN Bus Data

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages