Git Product home page Git Product logo

car-classification's Introduction

Car Classification using Transfer Learning in TensorFlow 2.x

This repository containes code and documentation for a series of blog posts I wrote together with Stephan Müller and Dominique Lade for our STATWORX blog.

The series was originally inspired by this reddit post. If you want to reproduce the results, please find the data available here or alternatively go to the original GitHub repo.

How to use this Repo?

  1. Download/Clone this repo (git clone https://github.com/fabianmax/car-classification.git)
  2. Copy Images into data/images folder
  3. Copy Model into model folder
  4. Execute docker-compose file (docker-compose up)
  5. Open http://localhost:8050/ and start playing! (open http://localhost:8050/)

Note: At the end your folder structure should be similar to this one:

.
+-- car_classifier
+-- dashboard
+-- data   
|   +-- images
|       +-- carbrand1_carmodel1_...._.jpg
|       +-- carbrand2_carmodel2_...._.jpg
|       +-- carbrand3_carmodel3_...._.jpg
+-- model
|   +-- saved_model.pb
|   +-- classes.pickle
|   +-- variables
|      +-- variables.index
|       +-- variables.data-00001-of-00002
|       +-- variables.data-00000-of-00002
|-- ...

Part 1: Transfer Learning using ResNet50V2 in TensorFlow

In this blog, we have applied transfer learning using the ResNet50V2 to classify the car model from images of cars. Our model achieves 70% categorical accuracy over 300 classes. We found unfreezing the entire base model and using a small learning rate to achieve the best results.

Link to full blog post on STATWORX.com

Part 2: Deploying TensorFlow Models in Docker using TensorFlow Serving

In this blog post, we have served a TensorFlow model for image recognition using TensorFlow Serving. To do so, we first saved the model using the SavedModel format. Next, we started the TensorFlow Serving server in a Docker container. Finally, we showed how to request predictions from the model using the API endpoints and a correct specified request body.

Link to full blog post on STATWORX.com

Part 3: Explainability of Deep Learning Models with Grad-CAM

We discussed multiple approaches to explain CNN classifier outputs. We introduced Grad-CAM in detail by discussing the code and looking at examples for the car model classifier. Most notably, the discriminatory regions highlighted by the Grad-CAM procedure are always focussed on the car and never on the backgrounds of the images. The result shows that the model works as we expect and indeed uses specific parts of the car to discriminate between different models.

Link to full blog post on STATWORX.com (coming soon)

Part 4: Integrating Deep Learning Models with Dash

In this blog post, we'll transform our machine learning predictions and explanations into a fun and exciting game. We present the user an image of a car. The user has to guess what kind of car model and brand it is - the machine learning model will do the same. After 5 rounds, we'll evaluate who is better in prediction the car brand - the user or the model.

Link to full blog post on STATWORX.com (coming soon)

car-classification's People

Contributors

dominiquelade avatar fabianmax avatar mueller-stephan avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.