Neural Network for Automobile Recognition / Identification

Last year after Covid19 lockdown was partly lifted, Autoly AutoCare Management gave approval to the Artificial Intelligence & Data Science division to learn how to effectively implement the Machine Learning algorithm in our AutoCare Servicing Mobile Platform.  Our team has since then trained a Neural Network to recognize vehicles by a photo and created inhouse easy demonstrations for internal evaluation. To be later integrate into our www.Autoly.in #MakeInIndia’s only Digital AutoCare Platform where users can communicate directly with Autoly Crew Mechanics. Available to Indian Customers on Android and iOS devices for Urgent Repairs, Regular Services and Preventive Maintenance.

Neural Network for Automobile Recognition / Identification
Neural Network for Automobile Recognition / Identification

Our DataSet

Starting for this task from the assorted Dataset we found online. Certain dataset classes contain a lot of errors. Some models are typically difficult to tell apart for even the general public. So we identified the best classes from the dataset which were then cleaned. During the training, the data was built  up by revolution, mirroring and meddling around with colour shades.

Base Versions

We used feature extractors of models which are among the best performing on the ImageNet dataset  (ResNet50, Inception V3 and Exception). First, our team simply connected the outputs and collected some layers on the top. This approach only gave average accuracy on the test.

Autoly AutoCare’s Method

Our team tried to research how an individual identifies a vehicle in the street. The obvious factor to tell about an automobile is the body shape. Most have unique design and distinct features. And recognizing the particular version always takes a few minutes. Sometimes it may take several minutes for limited vehicle versions. In our case study, we examined the features like the shape of the radiator grill or headlights. These features are very distinctive for Indian vehicle manufacturers. The shape of the doors and windows are also important factors to identify automobile Make & Model. And the other data about the body category and the manufacturer is definitely useful.

As it is a sequence, we decided to try Long Short-Term Memory Networks (LSTM). It should take the concatenated feature vector yielded by pre-trained vehicle Models and predict body build on the primary step, manufacturer on the second and model on the third. And it should be two-way because the sequence probably works in the opposite direction as well. At the top of that, another Long Short-Term Memory Networks (LSTM) should collect these projections together and yield the concluding forecast of automobile Make and Model. This approach raised the test accuracy significantly, and we got above 70% on the test.

No doubt, LSTM may be a bit of overkill here. The sequence is brief, therefore a normal Recurrent Neural Network (RNN) should do exactly as well. However LSTM is simply to implement in Keras and barely adds a significant lag to the overall evaluation time, so it wasn’t of the highest priority to try and replace the LSTM.

Fine-Tuning

Next, we tend to get rid of the redundant option of the network that would overfit to, just like the characteristics of the background. Dropout layers didn’t facilitate a lot, so we tend to use another ready-made implementation provided by the ImageAI library. When applying the Yolo model to detect an automobile on the image and crop it accordingly on the pre-processing step, it gave us another 10% of test accuracy.

The last step was by removing all dropout layers which gave us 5% more. It shocked us initially, however we think that since we got rid of almost the majority of the background once the detection step, the network could infer almost always only relevant options from the input. So the dropouts probably became more damaging than beneficial afterwards.

Architecture

The following architecture diagram was finalised by our Autoly AutoCare’s AI team.

Our team has since then trained a Neural Network to recognise vehicles by a photo. All PoC development was carried out in Python Notebooks with Keras
Our team has since then trained a Neural Network to recognise vehicles by a photo. All PoC development was carried out in Python Notebooks with Keras

Project Analysis

The final result, for now, is above 85% of Top 1 accuracy and 95% of top 5 accuracy. Top 1 accuracy implies that a prediction with the best score is correct and top 5 accuracy implies that the correct answer is among the predictions with top 5 scores.

  • Most of the errors the Neural Network makes are simple to create. As an example, the newer generation is confused with the previous generation.
  • Some errors suggest that the Neural Network takes colour excessively into account.
  • It's compelling how the Neural Network behaves when it sees a Vehicle model that was not in the training set.
  • At first, the Neural Network encountered some results where a person was detected as a car.

In general, it seems that the Neural Network correctly captures the idea of ​​a car in a photograph. A Sports automobile is scarcely confused with a Sport Utility Vehicle (SUV), and a Convertible can most likely be mistaken for other Convertible variants of similar type.

A lot of issues can go away if the Autoly AutoCare Team will use a larger dataset. And that's what we will be working on in future.

Also, we can't facilitate but think that the functionality we get from the last layers of Pre-Trained Deep Learning Models could also be too general. It might happen that if we use the previous layers, we might get good results. This was not easy to verify during development on a local machine because the previous layers are abundantly larger than the previous one and need a lot more memory. So we  plan to move to a Cloud Platform like Google Cloud Platform by the end of 2020.

Development Stack

All PoC development was carried out in Python Notebooks with Keras and deployed using Flask and Docker. You can find the code on GitHub.

#AUTOLY_IN #NeuralNetworks #ArtificialIntelligence #AI #MachineLearning #DeepLearning #EmergingTech #BigData #DataScience #PredictiveAnalytics #DataLiteracy #Algorithms #Coding #DEVCommunity #100DaysOfCode #ImageAI #Automobile #AutoCare #Dataset  #ResNet50 #InceptionV3 #Exception #Platform #LSTM #RNN #Architecture #Normalisation #Library #Development #Stack #Python #Keras #Flask #Docker

Comments