Skip to content

aaronnat23/Car-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stanford Car Classification

A image classification program that uses Google's Machine Learning library, Tensorflow and a pre-trained Deep Learning Convolutional Neural Network model called Inception V3.

This model has been pre-trained for the ImageNet Large Visual Recognition Challenge using the data from 2012, and it can differentiate between 1,000 different classes, like Dalmatian, dishwasher etc. The program applies Transfer Learning to this existing model and re-trains it to classify a new set of images.

Dependencies

Dataset

We use the Cars Dataset, which 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.

You can get it from Cars Dataset:

$ cd Car-Recognition
$ wget http://imagenet.stanford.edu/internal/car196/cars_train.tgz
$ wget http://imagenet.stanford.edu/internal/car196/cars_test.tgz
$ wget --no-check-certificate https://ai.stanford.edu/~jkrause/cars/car_devkit.tgz

Pre-Processing Image

-add cars_train, cars_test and car_devkit files to this folder

 python pre-process.py 
  • To split train dataset by train/valid/test
  • We augmented the color of each images to generate 2 more images.
  • This is done to increase the number of train dataset for each class.
  • Each original image was converted to from RGB to BGR and BGR to HSV respectively.

Train Dataset

python train.py \
  --bottleneck_dir=logs/bottlenecks \
  --how_many_training_steps=100000 \
  --model_dir=inception \
  --summaries_dir=logs/training_summaries/basic \
  --output_graph=logs/trained_graph.pb \
  --output_labels=logs/trained_labels.txt \
  --image_dir=./data/train
  • to train the dataset
  • the inception model file will be dowloaded once the code runs
  • images are augmented in different distortions like crops, scales, and flips.

Test Dataset

download trained model files here and save to logs folder of the main directory https://drive.google.com/drive/folders/1UJFZ4DdFAVerVFvLWqbtFE7tMInd51Ir?usp=sharing

python classify.py path/to/image 
  • to test single image

Test acc:

62.34%

  • The more complex model (ex. InceptionV3) the less accurate results are. This is understanable due to bias/variance problem.

Results

  • Results of images from test dataset
  • The final results display confidence score for all cars from highest to lowest

Screenshot
BMW X3 SUV 2012 (score = 0.60578)
Bentley Continental Flying Spur Sedan 2007 (score = 0.02981)
BMW X5 SUV 2007 (score = 0.02563)
Mercedes-Benz E-Class Sedan 2012 (score = 0.02369)
Audi V8 Sedan 1994 (score = 0.02163)
BMW 3 Series Sedan 2012 (score = 0.01933)
Audi S6 Sedan 2011 (score = 0.01916)

Screenshot
Audi TT Hatchback 2011 (score = 0.41686)
Audi R8 Coupe 2012 (score = 0.08508)
Audi TT RS Coupe 2012 (score = 0.08176)
Jaguar XK XKR 2012 (score = 0.07689)
Bentley Continental GT Coupe 2007 (score = 0.04783)
Porsche Panamera Sedan 2012 (score = 0.02808)
Bentley Continental Supersports Conv. Convertible 2012 (score = 0.01938)

Screenshot
Lamborghini Reventon Coupe 2008 (score = 0.95508)
Fisker Karma Sedan 2012 (score = 0.01009)
Ford GT Coupe 2006 (score = 0.00693)
Lamborghini Aventador Coupe 2012 (score = 0.00500)
Ferrari FF Coupe 2012 (score = 0.00405)
Bugatti Veyron 16.4 Coupe 2009 (score = 0.00378)
Chevrolet Corvette ZR1 2012 (score = 0.00233)

Screenshot
Porsche Panamera Sedan 2012 (score = 0.21820)
Ford GT Coupe 2006 (score = 0.16311)
Jaguar XK XKR 2012 (score = 0.09361)
Hyundai Veloster Hatchback 2012 (score = 0.05442)
Eagle Talon Hatchback 1998 (score = 0.04111)
Aston Martin Virage Coupe 2012 (score = 0.03734)
Bugatti Veyron 16.4 Coupe 2009 (score = 0.03222)

About

classifying cars

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages