This repo contains the code and data for image classification tutorial in tensorflow. It is a fork of this repo and is based on this CodeLab by Google as well as this tutorial is quite helpful. For a quick video walkthrough of the process check out this information-packed YouTube video.
Training data is availabe in tf_files/data
directory. There are 2 sub-directories for 2 categories pre-populated. If you need additional categories, create additional sub-directories, like, for example
tf_files/data/iron_man
tf_files/data/wonder_woman
and then put your images in them.
These will be used for training. After training the tf_files
directory will have the classifier.
Just type
bash ./train.sh $PWD/tf_files
And it will do everything for you !
Just type for a single guess
bash ./guess.sh $PWD/tf_files $PWD/test_data/images00.jpg
To guess an entire directory
bash ./guessDir.sh $PWD/tf_files $PWD/test_data $PWD/classified
Ps. Make sure the directory $PWD/classified exists. It can be empty.
$ bash guess.sh $PWD/tf_files $PWD/test_data/images00.jpg
elsa (score = 0.99636)
darth vader (score = 0.00364)
Use an absolute file path for classifier and images because the script dos not support relative path (volume mounting)
Make your own classifier for scientists, then post a clone of this repo with your retrained model in it. (you can name it retrained_graph.pb and it will be around 80 MB. If it's too big for GitHub, upload it to DropBox and post the link to it in your README)
Credit goes to Xblaster & @sirajology for the majority of this code. I've merely customized it for the training data.