Vehicle-Identification

Vehicle Identification

logo

Overview

Welcome to the <img src=’images/CTRL-ALT-DEFEAT-SMALL_edited.png’ width=12% height=10% /> GitHub Machine Learning project page.

This is our final team project for the UNC Chapel Hill Data Analytics Course

GitHub Application

Vehicle Identification

General Information

Team Name:

CTRL ALT DEFEAT

Team Logo:

<img src=’images/CTRL-ALT-DEFEAT-SMALL_edited.png’ width=14% height=12% />

Team Members:

Harsh Patel
Jill Hughes
Logan Murphy
Mihai Anghel

Selected Project Topic

The following link will take you to our draft presentation created in Google Slides. The file was saved and uploaded to GitHub as a PDF to allow easier access for viewers.

Vehicle Image Recognition

Tableau Presentation

The project outline can also be viewed in Tableau via this hyperlink.

Business Applications for Vehicle Image Recognition

The project topic was selected for its potential use in smart transportation applications that focus on the monitoring of traffic flow, automated parking systems, and security enforcement. Adding physical characteristics, with existing systems that track traffic patterns that include type, velocity, direction and position, (Vehicular Ad Hoc Networks - VANETs), would advance the information provided for use in additional applications.

Initial Dataset

Our initial dataset sourced from Kaggle was this Vehicle Detection Image Set.

This dataset was used for our model and it had the binary purpose of determining if an image contained a vehicle or not.

The vehicle images in the set specifically showed the rear part of cars, which allowed the model to easily be trained & recognize a vehcile after certain features - in this case the tail lights.

Here are a few examples of the images which this dataset contained:

3 17 2

The model produced good results as can be seen from the following Training and Validation graph:

slack-imgs

With these results, our team was happy to push onto a more intricate dataset, using the Stanford dataset for the remainder of our project as explained below.

Source Data Chosen

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__.

Dataset Source: https://ai.stanford.edu/~jkrause/cars/car_dataset.html
Number of Images: 16,185

3D Object Representations for Fine-Grained Categorization
Jonathan Krause, Michael Stark, Jia Deng, Li Fei-Fei
4th IEEE Workshop on 3D Representation and Recognition, at ICCV 2013 (3dRR-13). Sydney, Australia. Dec. 8, 2013.

Project Goal

Our Project Goal is to create an Image Recognition Model, with the simplest form of the Model recognizing whether or not a vehicle is present in a photo from our data set.

Future Goals

After Course Completion

Our next goal we will build on the Model so that it can determine whether or not the vehicle in the image is a BMW or another brand of vehicle.

Additional Goals for this project, with added complexity and continued development, are to determine the make and model of targeted vehicles.

The final iteration will have a multidude of potential real world uses. Law enforcement and amber alert application integration are just two of the myriad of examples.

Questions the team hopes to answer with the data:

  1. Can we take a dataset containing thousands of images and create a model using machine learning in order to identify whether or not a vehicle is present in an image?

  2. Can our prototype machine learning model identify the make, model and year of a targeted vehicle in an image?


GOAL:

Create a Image Recognition Model, using the simplest form of the Model, that will recognize whether or not a vehicle is present in a photo from our data set.

Description of the data exploration analysis phase of the project:

The data exploration phase of this project was a challenge for our team. The raw data from Stanford University came in MatLab format, which had to be processed for analysis in a Pandas DataFrame. We will be evaluating the images to determine what features we want to capture for the dataset and then store into database tables.

The following outlines the steps that were taken to get things crackalakin’

Due to the metadata being written in Matlab, which is not a familiar format for the team like csv, it was converted into a DataFrame and then loaded into our AWS Database.

A) In order to be able to load and read the metadata files, we found an example of how to extract the data from MatLab and convert it into Python DataFrames. Then we used SQLAlchemy to upload the DataFrames into the PostgreSQL database. :arrow_right: stanford_readdata.ipynb

B) Create AWS Buckets to hold images from both the cars-train and cars-test datasets
Note: Uploaded the images to each AWS Bucket using AWS’s upload tool.

<img src=’images/Buckets2.png’ width=70% height=35%/>

C) Creation of AWS PostgreSQL Database

<img src=’images/Database2.png’ width=70% height=35%/>

D) Running Train/Test Machine Model on Data Set

1) In a new Python file, we start with the DataFrames, populated from the Cars Database. 2) We send in the DataFrame, and loop through the Training data, pulling the image from the location in the Dataframe. 3) Send it through our Model, and Train our Model. 4) Once the Model is trained, we repeat the steps with our Testing data and determine our accuracy.

Our Model uses multiple layers to make the Model rescale the images and be able to identify them. vehicle/nonvehicle model

Decision-making process and explanation of model choice

Neural Networks vs. Random Forest Classifier

Database

Note: You will not be able to reach these links without proper authorization

PostgreSQL is the database we intend to use hosted on Amazon Web Services, AWS .


Database population: <img src=’images/Label_count.png’ width=40% height=30% /> <img src=’images/Image_count.png’ width=40% height=30% />

<img src=’images/DBTableExamples.png’ width=45% height=30% />

Dashboard

We will present our project in Tableau Dashboard for our final deliverable.
We will present our application prototype that we plan on completing in a future release.
We will also integrate D3.js for a fully functioning and interactive dashboard.

Results


The following screenshot shows successful output for the make, model and year of the vehicles and how many times they were identified once the model completed its run.

ModelTestResults

Below we have the overall training & validation accuracy, as well as the loss.

image

It is clear that the overall accuracy is low but the Model is functioning. Our objective moving forward with this dataset (Stanford) is accuracy improvement.

The next section will summarize the reasons our model’s accuracy for validation was low and why the validation loss was so high.

Summary

Reasons for unfavorable results:

As per the above results , our model didn’t perform in-line with the initial dataset. The validation loss was much higher, and the model’s accuracy was low. Overall, this outcome occured because our team did not consider the many differences in the datasets going into the process using the Stanford dataset.

Differences to consider:

The high complexity of training a neural network with image classification made it difficult for our model to adjust and perform accurately on the new dataset.

The Stanford dataset included over 16,000 images of cars split into 196 different classes. The files in this set were much larger in size, displayed cars from multiple points of view and had significantly visible differences in color, light spots and reflections. This made it much harder for our model to train and be able to perform as well as before with the previous dataset. Other factors which impaired our model were foreign objects/characteristics in the images from this subsequent dataset such as other cars, people and distance depth of images.

The difference between a relatively small in size, well cropped image of the rear of a car showing tail-lights and a larger image file, with a zoomed out car next to a building with an abundance of color created hiccups in the model’s ability to properly process and accurately provide desired results.

Moreover, the higher resolution of the images in the Stanford dataset required more processing power to convert into the model. With more pixels (and objects in the images) our model was not able to make ends meet. It found it difficult to train on a specific common denominator (which in the initial dataset was the tail-lights) in order to realize accurate results. Without being able to focus on a characteristic, the overload of data caused our model to not perform as how we expected to at the beginning of our journey in this project.

Recommendation for future analysis:

Anything the team would have done differently:

Understand the complexity of the dataset we chose, in order to be able to confidently produce the accurate outcome we desired as our goal for the project.

Final Word

Although our final results were not what we expected using the Stanford dataset, we learned a lot throughout the lifetime of this project. We understand the implications which require consideration moving forward. This knowledge will be useful not only in the instance of this project, but for any future assignment in the field we embark on.

Thank you for your time and reading our project details. Please let us know if you need any additional information.

Harsh Patel, Jill Hughes, Logan Murphy, Mihai Anghel