Giter Club home page Giter Club logo

medp1030 / keras-gates-vs-bezos-image-classifier Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jrjames83/keras-gates-vs-bezos-image-classifier

0.0 1.0 0.0 44.37 MB

Hours of step by step training using keras to do image classification using convnets from scratch, transfer learning and fine tuning. We also review visual similarity strategies and handle 2 use cases: Jeff Bezos vs Bill Gates, then Border Collie vs Yellow Lab. Not an academic treatise, just hands on fun and really good explanations about how to get productive real fast!

License: MIT License

Jupyter Notebook 99.73% Python 0.27%

keras-gates-vs-bezos-image-classifier's Introduction

Jeff Bezos vs Bill Gates (scratch convnet accuracy tops out around 80%)

We're going to classify images, folks. Instead of the lame dogs and cats, which are basically imagenet categories, we're doing to 2 similar dudes that look very similar (caucasion, over 50, wealthy, etc....). Fire up your conda enviorment, install some packages and let's get on our way :)

Border Collie or Yellow Labrador? (scratch convnet accuracy of 90%!)

Since it's challenging to get our validation acuracy over 80% for the bezos vs gates dataset, we move onto a binary classification problem using more distinct subject matter. Is it a border collie, or a yellow labrador? Some adventures in this dataset:

  • deep dive into keras generator properties (filesnames, classes)
  • confusion matrix overview using sklearn
  • analyzing misclassified photos

Misc Topics We Talk About

  • Using Keras to train a convnet from scratch to classify images of Bill Gates or Jeff Bezos (binary classification)
  • Using the Generator Utilities Keras provides to avoid reading image data into RAM and also applying transformations to images
  • Comparing the bottleneck feature gen strategy using VGG16 with the scratch convnet and why the imagenet weights didn't really provide for much of an advantage
  • Differences in performance between taking the first 50 images google served as validation data, vs taking a large, random subset. The dangers of small data!

Details about my enviorment (sorry, no requirements.txt)

Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:52:12) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
>>> import keras
Using TensorFlow backend.
>>> keras.__version__
'2.0.2'

You'll need firefox along with selenium webdriver to get this working. Again, use Conda as a package manager and it should be OK, at least on Mac :/

Videos and brief descriptions

  • First Video: downloading the images, getting a convnet working from scratch with around 75% validation accuracy

Keras Bezos Gates Part 1

  • Second Video: using a pretrained feature extractor VGG16 to genreate better features, which we'll feed into a MLP (not a conv network).

Keras Bezos Gates Part 2

  • Third Video: here we delve into further issues around training and validation set splitting and also step through a basic python script to split our images up into training and validation sets. I also reflect a bit on these issues

Keras Bezos Gates Part 3

  • Fourth Video: we switch gears and move onto a better dataset to apply our incremental learning stragies (scratch convnet --> transfer learning). I also move to a windows machine with a gtx1080ti card

Keras Bezos Gates Part 4

  • Fifth Video: using our validation generator, but tweaking it to generate ordered predictions and hacking some code together to check out some images and view the images behind some inaccurately classified predictions. We also introduce the confusion matrix

Keras Bezos Gates Part 5

  • Sixth Video: using our border collie vs yellow lab model, we begin working on a new problem, "image similarity". We create a new model from our traind one which outputs 96d vectors for each image, then use some numpy to create a cosine similarity matrix. Finally we spot check the data and find some really cool results!

Keras Bezos Gates Part 5

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.