Driver Distraction Classification using CNN, Vanilla Model and VGG Pretrained model
Driver Distraction Monitoring This notebook is for the classification of driver behavior. We will do image pre-processing and use Deep learning CNN for identifying the behavior of the driver. Which is necessary for handling the unexpected road accident.
Nowadays vehicles are increasing exponentially. We need to be extra careful about the road incident. As there are a couple of things around you, which can distract the driving. We can use this model and implement a smart system, which will monitor driver activities at the time of driving and can alert him about the activities. It will reduce the number of roads accidents and will increase road safety.
State Farm Distracted Driver Detection has divided driving behavior into 10 classes. CLASS Description
C0 Safe Driving
C1 Texting - Right
C2 Talking On The Phone - Right
C3 Texting- left
C4 Talking on the Phone- left
C5 Operating The Radio
C6 Drinking
C7 Reaching Behind
C8 Hair And Makeup
C9 Talking To Passenger
We will implement a deep learning model, which will predict the driver activities at the time of driving.
Data Augmentation is the technique to generate new sample from the existing sample. So, you can reduce generalization error. It will genrerate natrual sample. There are number of features, which can help you in data agumentation.
rotation_range : is a value in degrees (0-180), a range within which to randomly rotate pictures.
height_shift_range : Constructor control the amount of horizontal and vertical shift respectively.
width_shift_range : Constructor control the amount of horizontal and vertical shift respectively.
shear_range : Shear Intensity (Shear angle in counter-clockwise direction in degrees)
zoom_range : Range for random zoom
horizontal_flip : Randomly filp of input image in horizontally. But we can't use in our case. It can chane the class of images.
fill_mode : Points outside the boundaries of the input image are filled according to the given mode. (default Nearest)

Deep learning CNN models to train and test, each input image will pass it through a series of convolution layers with filters (Kernals), Pooling, fully connected layers (FC) and apply Softmax function to classify an object with probabilistic values between 0 and 1. The below figure is a complete flow of CNN to process an input image and classifies the objects based on values.

we'll develop the model with a total of 4 Convolutional layers, then a Flatten layer and then 2 Dense layers. we'll use the optimizer as rmsprop, and loss as categorical_crossentropy.

Here we have augmenting the previous model classifier, we have used the data on which I want to train the model. The folder train includes the images I need. I'll generate more images using ImageDataGenerator and split the training data into 80% train and 20% validation split.

Transfer Learning is another interesting paradigm to prevent overfitting. Transfer Learning works by training a network on a big dataset such as ImageNet [12] and then using those weights as the initial weights in a new classification task. Typically, just the weights in convolutional layers are copied, rather than the entire network including fully-connected layers.





