Skip to content

mueller-stephan/car-classification

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 98.2%
  • Python 1.8%