RoboFlow

RoboFlow is a semi-automated TensorFlow image classification explorer in a python command line app.

View on GitHub

RoboFlow

jump to: RoboFlow | Help | DetailedHelp

Purpose & Goal

RoboFlow was created to get a better sense for TensorFlow’s image classifier by making it easier to gather 1000s of similar images by hashtag (such as “#robot” or “#robotart”) to serve as re/training examples, and to enable easy testing of different TensorFlow hyperparameter settings for creating classifiers. specifically, tagged images are downloaded (your choice of Imgur API or Webstagram) and then sorted, according to a ‘confidencemin’ variable, into labeled sub-directories, which are periodically ‘harvested’ to retrain TensorFlow to create new classifiers.

roboflow start

downloads sources (imgur api or webstagram)

as of now, choose in the config file from two useful (and randomly non-responsive) sources:
Imgur API (much quicker, fewer tags, requires you get a free API key) or
webstagram (slower, more tags, no API key required)

‘BASETAG’ concept

because you can use roboflow for many separate classifiers, you need to pick a term for the broad master classification or theme of your classifier (such as ‘robots’, or ‘birds’, or whatever) so that images, classifier models and more can be stored separately under that BASETAG directory. You will do this in either the guided or advanced usages (see below).

Bootstrapping

There is an initial bootstrap stage in which you must manually sort a minimum number of images to allow the first retraining to create the first classifier per basetag. This tool will help you download 1000s of images pretty easily. After that first manual sorting, subsequent cycles of downloading, classifying/auto-sorting, and harvesting sorted images into the training_photos/labeled_directories for another cycle of retraining is waaaaay more automated.

hint: you can skip this step with a 1.4 gb download of robot images to place into training_photos/

https://drive.google.com/file/d/1zvTq5vKqME7sW9O8lEtgn-Wosoavc2gi/view?usp=sharing

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

NOTE: the primary script is

roboflow.py

As a shortcut, add an alias in your .bash_profile to launch roboflow quickly:

alias roboflow="cd path/to/dir/roboflow/;python roboflow.py"

PREREQUISITES

software

Installing

First, you must install and test TensorFlow. Follow instructions at

https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/

or

https://www.tensorflow.org/install/

Next, install the RoboFlow files contained in this git repository.
Make sure to ‘cd’ into your TensorFlow directory at the same level as “tf_files” and “scripts” first.
Then clone the RoboFlow git repository with:

git clone https://github.com/mariochampion/roboflow

FINALLY and CRITICALLY, you must change one line in TensorFlow’s scripts/retrain.py file.
(see https://github.com/mariochampion/roboflow/issues/3)
simply go to the literal last line of retrain.py’s main() function, around line 1144 and add

############################################
# this line added because stdout not available / no return from main
# See https://github.com/tensorflow/tensorflow/issues/3047 
f.write(str("_acc"+str(test_accuracy*100)[:5]) + '\n')

Your directories should look like this:

├── tensorflow
|  ├── roboflow
|  ├── scripts
|  ├── tf_files
|  |  ├── bottlenecks
|  |  ├── models
|  |  ├── testing_photos
|  |  |  ├── [autogenerated basetag dirs...]
|  |  ├── training_photos
|  |  |  ├── [autogenerated basetag dirs...]
|  |  ├── training_summaries
|  |  |  ├── [autogenerated basetag dirs...]

Et voila, you are ready to explore!

Guided usage:

python roboflow.py

Advanced usage:

python roboflow.py [basetag] [imagequantity] [searchtag] [optional flowsteps]

for example:

python roboflow.py robots 200 robotart classify

Help: (or read the help docs online)

python roboflow.py --help

and dont forget to explore the config file.


Built With

  • Python 2.7 - The programming language
  • TensorFlow - An open-source software library for Machine Intelligence

Contributing

I am very open to issues and pull requests. Looking for a place to start helping?
https://github.com/mariochampion/roboflow/issues

Authors

Contributions, Issues, and Pull requests Welcome!

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details

Acknowledgments

  • Google’s TensorFlow-for-poets2
  • Imgur API (altho originally from Webstagram )
  • StackExchange
  • Twilio sms/python tools