Coder Social home page Coder Social logo

aldente0630 / state-farm-detection Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 45.58 MB

State Farm Distracted Driver Detection via Image Classification

Jupyter Notebook 99.65% Python 0.34% Shell 0.01%
image-classification tensorflow2 albumentations tensorflow-hub tensorflow-addons wandb

state-farm-detection's Introduction

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.

state-farm-detection's People

Contributors

aldente0630 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ayoubkochbati

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.