• Stars
    star
    330
  • Rank 127,657 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A generic image detection program that uses Google's Machine Learning library, Tensorflow and a pre-trained Deep Learning Convolutional Neural Network model called Inception.

tensorflow-image-detection icon

tensorflow-image-detection Patreon donate button

A generic image detection program that uses Google's Machine Learning library, Tensorflow and a pre-trained Deep Learning Convolutional Neural Network model called Inception.

This model has been pre-trained for the ImageNet Large Visual Recognition Challenge using the data from 2012, and it can differentiate between 1,000 different classes, like Dalmatian, dishwasher etc. The program applies Transfer Learning to this existing model and re-trains it to classify a new set of images.

This is a generic setup and can be used to classify almost any kind of image. I created a small demo that classifies two image data sets - cat and dog images, and returns a prediction score denoting the possibility of it being an image of a cat or a dog.


Installation

Make sure you have Python 3 installed, then install Tensorflow on your system, and clone this repo.


Usage

Prepare the image data sets

In order to start the transfer learning process, a folder named training_dataset needs to be created in the root of the project folder. This folder will contain the image data sets for all the subjects, for whom the classification is to be performed.

Create the training_dataset folder and add the images for all the data sets in the following manner -

/
|
|
---- /training_dataset
|    |
|    |
|    ---- /cat
|    |    cat1.jpg
|    |    cat2.jpg
|    |    ...
|    |
|    |
|    ---- /dog
|         dog1.jpg
|         dog2.jpg
|         ...
|
|     

This enables classification of images between the cat and dog data sets.

Make sure to include multiple variants of the subject (side profiles, zoomed in images etc.), the more the images, the better is the result.

Initiate transfer learning

Go to the project directory and run -

$ bash train.sh

This script installs the Inception model and initiates the re-training process for the specified image data sets.

Once the process is complete, it will return a training accuracy somewhere between 85% - 100%.

The training summaries, retrained graphs and retrained labels will be saved in a folder named tf_files.

Classify objects

python3 classify.py

This opens up the file dialog using which you can select your input file.

Once the input file is selected, the classifier will output the predictions for each data set. A prediction score between 0.8 to 1 is considered to be optimal.


Results


Contributors


Arun Michael Dsouza


Royal Bhati


Support

If you'd like to help support the development of the project, please consider backing me on Patreon -


License

MIT License

Copyright (c) 2017 Arun Michael Dsouza

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

All training dataset and input images have been taken from freepik.com.

More Repositories

1

react-image-appear

ReactJS component to make images appear with transition as they load.
JavaScript
281
star
2

CSS-Mint

Lightweight and simple to use UI Kit. Fully responsive, just 3KB gzipped.
CSS
212
star
3

joypad.js

JavaScript library that lets you connect and use various gaming controllers with browsers that support the Gamepad API. Less than 5KB in size with zero dependencies and support for button press, axis movement events and vibration play effect.
JavaScript
152
star
4

ng-youtube-embed

AngularJS module to embed Youtube videos with support for Youtube player parameters and JavaScript API for iframe embeds. Superlight (less than 5KB) and easy to use! Supports Youtube video URLs and IDs. No 3rd party JS dependencies.
JavaScript
143
star
5

ng-image-appear

AngularJS Module to make images appear with transition as they load.
JavaScript
121
star
6

picla

jQuery plugin that converts Alt-texts into simple image labels
JavaScript
95
star
7

pineapple-sass

A must-have Sass mixin library for all your Sassy needs
CSS
46
star
8

bootstrap-football-homepage

A minimal Bootstrap 3 one page Theme for Football lovers
HTML
39
star
9

ng-textarea-enter

Execute a function on pressing the enter key in a textarea.
JavaScript
37
star
10

D_Pad

Drumming App built with Processing 2, for Desktop/Mobile Environments.
Processing
25
star
11

Zeta

Zeta is a command interpreter built purely in C for Windows OS
C
11
star
12

JSConf-belgium-2017-talk

Slides and demos for my JSConf Belgium 2017 talk.
JavaScript
7
star
13

meteor-discussion-board

Discussion Board app built with Meteor js
JavaScript
6
star
14

arunmichaeldsouza.com

My Personal Website
JavaScript
5
star
15

tuneshuffle

Web-based localised music player. Start a server locally, ask your friends to join in, share and stream music together!
JavaScript
5
star
16

JSConf-iceland-2018-talk

Slides for my JSConf Iceland 2018 talk.
3
star
17

node-instagram-app

Simple app built with Node to display popular images from Instagram
CSS
3
star
18

javascript-and-friends-2020-talk

Slides for my JavaScript & Friends Conference 2020 talk.
3
star
19

javascript-30-course

Solutions for the JavaScript 30 Day Challenge by Wes Bos
HTML
3
star
20

viewport-ratio-js

Script to get ratio of visible area of selected elements in the viewport.
JavaScript
2
star
21

simple-node-server

Simplest node server to serve static files using express
JavaScript
2
star
22

react-foundations

Playing around with React JS
JavaScript
1
star
23

javascript-foundations

JS algorithmic practice problems
JavaScript
1
star
24

isomorphic-react

Experimenting with Isomorphic ReactJS
JavaScript
1
star
25

es-foundations

Playing around with ECMAScript - ES6, ES8
JavaScript
1
star