Introduction

This project delves into image classification models specifically classifying car models, leveraging the comprehensive Stanford Cars Dataset.

The Stanford Cars Dataset is a benchmark in the field, offering a diverse collection of over 16,000 car images spanning 196 different classes, each representing a unique car model. This rich dataset not only poses a significant challenge due to the diversity in vehicle appearances but also provides an excellent opportunity to develop and fine-tune machine learning models for accurate classification.

Goals

The primary objective is to design a robust and efficient car model classifier that can accurately identify and categorize car models from images.

This will be done using a ResNet34 architecture, a robust convolutional neural network (CNN) as it can generalize well to large datasets by learning the residual differences in each new layer

Work Done

In this project, the Fastai library was used for developing a car model classifier using the Stanford Cars Dataset. The initial steps involved the preparation of dataset loaders specifically tailored for the Stanford Cars Dataset, ensuring seamless loading of both training and testing data. Initially I was contemplating the implementation of a distinct regression output layer for car make prediction, but then I went ahead with a single classification layer for all classes separately to avoid preprocessing complexities. Instead, all labels were one-hot encoded, paving the way for a more streamlined classification process.

Then I imported the ResNet34 architecture, to serve as the backbone for the model. To facilitate fine-tuning, the last layers of ResNet34 were modified to align with the classification task at hand. The process begin with an initial fine-tuning stage where the learning rate was dynamically determined using the "get learning rate" step. The model was fine-tuned for three epochs, with all layers frozen except the last.

Following this, another learning rate determination step was executed, leading to a subsequent fine-tuning phase spanning five epochs in which all layers were unfrozen, leading to a 70% accuracy for the car model classification task. 


Results

Some of the images in the test set were challenging even for a human to distinguish easily. Even then, the model performed pretty well!

Even though only 70% accuracy was achieved, the wrong predictions were of cars/models pretty similar to the actual car.

A hugging face demo of the model running can be seen here. It should be noted that the model will only output classes and models in the dataset. So if there is no image of a particular car in the Stanford image dataset, it won't work properly.

Contact me!

πŸ“ž(404) 388-3944    πŸ“Atlanta, GA, 30309   πŸ“§bhushan.pawaskar@hotmail.com

Β© Copyright 2023 Bhushan Pawaskar - All Rights Reserved