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.
- Download/Clone this repo (
git clone https://github.com/fabianmax/car-classification.git
) - Copy Images into data/images folder
- Copy Model into model folder
- Execute docker-compose file (
docker-compose up
) - 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
|-- ...
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
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
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)
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)