Code Monkey home page Code Monkey logo

cv-city-classifier's Introduction

README - Computer Vision City Classifier

Overview

This Computer Vision algorithm receives a street-level picture and is able to predict the city it has been shot in.

Data

We used a not public database called Mapillary, for which we have been granted a special academic permission.

The database had initially a total of 1.5 million pictures and it was imbalanced over the 19 different cities.

The pictures have been shot every few seconds from some vehicles moving through the streets of the cities, pretty much like Google Maps.

This is why we decided to keep only one frame every 80 in order not to have overfitting on the particular characteristics of some streets and on particular vehicles that could have stayed in front of the camera for a while, showing up in 40 frames in a row for example.

After this reduction we undersampled in order to balance the dataset, resulting in 2000 images per city.

Moreover, we noticed that in the lower part of every picture the dashboard of the vehicle was visible, and this would have damaged the quality of the algorithm, generating a bias on the particular vehicle model, so we cropped off a rectangle from the lower part of every picture.

Algorithm

As a first step, we started out with a classification model based on 3 cities: Paris, Goa and Sao Paulo. We observed the quality of a baseline model such as Random Forest and the improvement obtained through the implementation of a deep learning model. Predicting on the pictures test set, the accuracy witnessed a raise from 80% to 95% thanks to LeNet transfer learning.

Thrilled by the results, we enriched the program with various additional steps: not only enlarging the dataset to 19 cities, but also performing an Anomaly Detection through Autoencoders, resulting in an overall accuracy rate of 91% on the 19 cities application, predicting on the test set.

Moved by insatiable curiosity, we exploited the lime interpreter package in order to have a better clue of the criteria with which the various sections of the images influence the algorithm, and not tired after all this, we had some fun attempting a GAN generation in order to fulfil the dream of a hybrid city, with, for example, the streets of Berlin, the architecture of Paris and the traffic lights of San Francisco. Don't worry, you will find the results of this experiment on our application webpage.

Lastly, we felt the need to deliver some interactive and enjoyable product to the world, and therefore we deployed, thanks to Heroku, a web application able to perform the prediction on an arbitrary image, not taken anymore from the test set, but from Google Street View for example.

Usage

If you want to try out the web application, uploading a street-level picture randomly captured with Google Street View, while having a look at the GAN generated images in the meantime, just click on the link and have fun!

Created by:

  • Daniel Saban
  • Sagi Elfassi
  • Arad Ben Haim
  • Itamar Bergfreund
  • Dor Meir

cv-city-classifier's People

Contributors

danielsaban avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.