Computer Vision on Predicting Car Feature How might we automate the process of recognizing the details of the vehicles from images, including make and model?
Given a dataset of distinct car images, can you automatically recognize the car model and make?
We use the Cars Dataset, which contains 16,185 images of 196 classes of cars. The Cars dataset contains 16,185 images of 196 classes of cars. The data is split into 8,144 training images and 8,041 testing images, where each class has been split roughly in a 50-50 split. Classes are typically at the level of Make, Model, Year, e.g. 2012 Tesla Model S or 2012 BMW M3 coupe.
Training images can be downloaded here.
Testing images can be downloaded here.
A devkit, including class labels for training images and bounding boxes for all images, can be downloaded here.
Download fine-tuning imagenet pre-trained model for theano and tensorflow backend here.
First download all the data needed from the link above and then split and assign them into train, test, and valid. You can see the preprocessing code in img_annot_preprocessing.ipynb
Then create a custom layer for BatchNormalization. I am using Resnet-152 as a fine-tuning method to do car recognition. Learns a set of weights and biases used for scaling the input data. You can access the layer code here scale_layer.py
Then I created Resnet-152 pre-trained model. Model Schema and layer naming follow that of the original Caffe implementation https://github.com/KaimingHe/deep-residual-networks. I put the code in model_resnet152.py (.py) instead of Jupyter so that I can import it easily for my next code.
And the I trained the data using the model to get the best accuracy. After some loopings I decided to use model.46-0.99.hdf5 model on epoch 46. You can find the code here train.ipynb.
val_acc | val_loss |
---|---|
And after some training, finally I tested the data using the trained model for random 20 data in test dataset. Before that I also created a util.py to make it easier for me importing the model inside any code. Here's the code demo_test.ipynb and save the output in the results.json. I also visualize the output below.
I run almost my entire code using Google Colab, here's the link to my drive and Colab https://drive.google.com/open?id=1rMQeVOWd7l_YxrXTy-eE6onfwcVU6v9F