Skip to content

State Farm Distracted Driver Detection via Image Classification

Notifications You must be signed in to change notification settings

aldente0630/state-farm-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

State Farm Distracted Driver Detection

Goals

  • Experiment with various modern deep learning techniques from the paper, Bag of Tricks for Image Classification with Convolutional Neural Networks through an image classification task.
  • Build a high-speed and efficient data pipeline using the TFRecord file format, Dataset API, and the albumentations library.
  • Explain the model via Grad-CAM and host it using TF Serving or SageMaker to enable real-time inference.
  • (Optional) Effectively manage experiments through the wandb library.

Requirements

  • The dataset can be downloaded from this Kaggle competition.
  • In addition to the Anaconda libraries, you need to install tensorflow, tensorflow-addons, tensorflow-hub, albumentations and wandb.

Experimental Setup

  • EfficientNet-B0 was used as the base model. On top of that, fully connected layers and dropout layers were added.
  • The batch size was set to 32, the number of epochs was set to 500, and an early stopping option was applied.
  • A Cosine Decay Schedule with Restarts was used. In this case, the initial learning rate was set to 0.001 and the first decay step was set to 1,000.
  • The images were resized to 224 x 224 and image data augmentation through rotation, scaling, and shifting was applied. Below are examples of data augmentation.

Augmentation

Experiment Result

  • The evaluation criterion for this Kaggle competition is multi-class logarithmic loss.
  • As the validation set, 25% of the images were randomly assigned. However, in the case of the 5-fold CV ensemble, the dataset was divided into 5 equal parts.
Treatment Public Score Private Score
RAdam 1.0260 0.6792
AdamW 0.9117 0.7140
RAdam + SWA 1.1547 0.7527
RAdam + Mixup 0.8331 0.6423
RAdam + Label Smoothing (0.1) 0.9047 0.7891
RAdam + Mixup + TTA (3 times) 0.7434 0.5777
RAdam + Mixup + TTA + 5-fold CV Ensemble (OOF) 0.6877 0.5419
Pseudo Labeling (> 0.9) + RAdam + Mixup + TTA + 5-fold CV Ensemble 0.6504 0.5169

Model Explainability with Grad-CAM

  • 20 samples were randomly selected from the test set and visualized using the Grad-CAM technique. Labels shown are predicted. Grad-CAM

Model Serving

TF Serving

  • You need to download and run the Docker image via scripts/run.sh file. Then, you can test model inference through a locally hosted TF Serving.

SageMaker

  • SageMaker allows you to train TensorFlow models and deploy endpoints for serving. You can also use the SageMaker Estimator's Pipe mode to train a model without downloading a dataset directly.

Releases

No releases published

Packages

No packages published

Languages