Last active
February 7, 2017 06:45
-
-
Save tfaris/b315d0aa21ea833d2371905613b176e5 to your computer and use it in GitHub Desktop.
Tensorflow+Inception transfer learning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Might be missing some steps... putting this together as I go | |
docker run -it tensorflow/tensorflow bash | |
### | |
apt-get update | |
apt-get install python-virtualenv nano | |
mkdir ~/src && cd ~/src | |
virtualenv tensorflow_retrain | |
source ./tensorflow_retrain/bin/activate | |
# Installs tensorflow 0.11, which I know works... | |
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl | |
pip install --ignore-installed --upgrade $TF_BINARY_URL | |
# Grab the tf 0.11 version of the Inception v3 retrain script | |
curl https://raw.githubusercontent.com/tensorflow/tensorflow/r0.11/tensorflow/examples/image_retraining/retrain.py > retrain.py | |
cd ~/ | |
# Grab example images of flowers... | |
curl -O http://download.tensorflow.org/example_images/flower_photos.tgz | |
tar xzf flower_photos.tgz | |
python src/retrain.py --image_dir ~/flower_photos | |
# Get a script example that uses the newly retrained model to classify a given image... | |
curl https://raw.githubusercontent.com/eldor4do/Tensorflow-Examples/76b04c85194ca01ab8641ddb033e0b10b5419426/retraining-example.py>classify_example.py | |
# Get an image of some flower(s). This one is a bouquet of roses. | |
# Drop it in /tmp/imagenet/flower.jpg because that's where the script is looking | |
curl http://i.imgur.com/FqaRuTn.jpg>/tmp/imagenet/flower.jpg | |
python classify_example.py | |
# $ roses (score = 0.57438) | |
# $ tulips (score = 0.26628) | |
# $ sunflowers (score = 0.13434) | |
# $ daisy (score = 0.02266) | |
# $ dandelion (score = 0.00235) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment