distracted-driver-detection
distracted-driver-detection copied to clipboard
Predicting the likelihood of what the driver is doing in each of the pictures in the dataset.
Detecting Distracted Drivers
The objective of this work is to successfully predict the likelihood of what a driver is doing in each of the pictures in the dataset1.
The data consists on a set of images, each taken in a car where the driver is doing some action (e.g. texting, talking on the phone, doing their makeup). These are some examples:

The images are labeled following a set of 10 categories:
| Class | Description |
|---|---|
c0 |
Safe driving. |
c1 |
Texting (right hand). |
c2 |
Talking on the phone (right hand). |
c3 |
Texting (left hand). |
c4 |
Talking on the phone (left hand). |
c5 |
Operating the radio. |
c6 |
Drinking. |
c7 |
Reaching behind. |
c8 |
Hair and makeup. |
c9 |
Talking to passenger(s). |

Running the Code
Dependencies
Python 3.6.1Tensorflow 1.3.0Keras 2.1.2matplotlib 2.0.2numpy 1.12.1
Command-line Execution
-
Simple CNN in Keras
Directory Path:
/src/keras/base-
Train the model:
python train.py [-h] [--bsize BSIZE]Optional arguments:
-h,--helpshow help message and exit --bsize BSIZEprovide batch size for training (default: 40) -
Test the model:
python test.py [-h] -
Predict from an image:
predict.py [-h] [--image IMAGE] [--hide_img]Optional arguments:
-h,--helpshow help message and exit --image IMAGEpath to image --hide_imgdo NOT display image on prediction termination
-
-
CNN with VGG16 Transfered Learning
Directory Path:
/src/keras/vgg-
Extract VGG16 deep features:
python extract_vgg16_features.py [-h] -
Train the model:
python train_top.py [-h] -
Test the model:
python test.py [-h] [--acc] [--cm] [--roc]Optional arguments:
-h,--helpshow help message and exit --accwill calculate loss and accuracy --cmwill plot confusion matrix --rocwill plot roc curve -
Predict from an image:
predict.py [-h] [--image IMAGE] [--hide_img]Optional arguments:
-h,--helpshow help message and exit --image IMAGEpath to image --hide_imgdo NOT display image on prediction termination
Note: Since the notebooks may not all be fully updated yet, the best way to run these programs is using the python scripts.
-
1: This dataset is available on Kaggle, under the State Farm competition Distracted Driver Detection.