Skip to content

aakashb95/car-detection

Repository files navigation

Car make, model and year detection

Udacity's Microsoft Azure Scholarship Project Showcasing Challenge:

Upload a car photo, identify it's model, make and the year in which it was manufactured.

cmm1 Images uploaded are neither stored nor re-used for model training.

Dataset

Car make and model detection using Stanford dataset which was cleaned up and put on kaggle:

https://www.kaggle.com/jutrera/stanford-car-dataset-by-classes-folder

The dataset consists of 16k+ images and has 196 distinct labels.

Architecture used: ResNext50_32x4d using fastai API

Author:

Aakash Bakhle

App trial:

Google one of the cars from the car_names in sidebar. Download any image and upload for model to predict.

https://caridentifier.azurewebsites.net/

P.S: Link maynot be available always as free tier does not support systems with higher RAM.

Running app on Microsoft Azure App service:

This service is not free and works only on S3 or P1v2 and above instances. Pricing can be found here

You need a free-tier/paid subscription with Microsoft Azure at https://portal.azure.com/

  1. Search/look for 'App Services'

  2. Click 'Create App Service'

  3. Fill details. Create a new resource group with any name.

    Select Docker Container (Region, Linux Plan and SKU Size come by default) and click next : image

  4. From 'Image Source' dropdown, choose Docker Hub. After filling everything, click 'Review+create': image

  5. Click 'Create'. It takes about 5 minutes. Once done click 'Go to Resource'.

  6. Select 'Configuration' in the 'Settings' tab on the left side pane.: image

  7. Click 'New Application Setting' image

  8. Fill in data as given below and click OK: image

  9. Click 'Save' and then Click 'Continue' for the Service to restart: image

  10. Head to the 'Overview' tab in the side pane and launch the URL: image

  11. Google one of the cars from the car_names in sidebar. Download any image and upload for model to predict. image

  12. Play around! image

Running the app on local system:

I assume you have miniconda/anaconda installed and your system has at least 2GB RAM.

Due to GitHub's upload limits, the model file can be found here

Clone this repo, place the model file in the same folder.

Install dependencies

conda create --name demo
conda install pip
pip install -r requirements.txt

Running the app

streamlit run app.py

Streamlit outputs localhost url. Open it and follow steps 11 and 12 from Azure Deployment above.

Known issues:

  1. Since source dataset mostly has images of front and side face of cars, model struggles to identify images taken of car's rear.
  2. Model gets confused between cars from the same manufacturers.

Further scope of improvement

  1. More images of different cars captured from different angles.
  2. Multi label, Multi car data in a single image, in low resolution for a generic use case.
  3. More data augmentation and deeper understanding of working of CNNs.
  4. Better usage of pretrained models.

Files

stanford_car_model_dataset_fastai.ipynb : Contains the main code to train the model. It is specific to google colab

app.py: Contains streamlit code to deploy model on localhost.

labels.csv: List of car names from the original dataset

Dockerfile: The dockerfile given has been built and pushed to dockerhub

Releases

No releases published

Packages

No packages published

Languages