Created
March 5, 2018 02:01
-
-
Save bourdakos1/817611ebfe0d72a027ced9b072ec5c87 to your computer and use it in GitHub Desktop.
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
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Tensorflow for Poets.ipynb","version":"0.3.2","views":{},"default_view":{},"provenance":[],"collapsed_sections":[]},"kernelspec":{"name":"python2","display_name":"Python 2"},"accelerator":"GPU"},"cells":[{"metadata":{"id":"4Z-Ubvx9yE0I","colab_type":"text"},"cell_type":"markdown","source":["# TensorFlow For Poets"]},{"metadata":{"id":"41HfrvUNvQxW","colab_type":"code","colab":{"autoexec":{"startup":false,"wait_interval":0}}},"cell_type":"code","source":["!wget http://download.tensorflow.org/example_images/flower_photos.tgz\n","!tar xzf flower_photos.tgz\n","!wget https://raw.githubusercontent.com/tensorflow/tensorflow/r1.1/tensorflow/examples/image_retraining/retrain.py"],"execution_count":0,"outputs":[]},{"metadata":{"id":"po0YZxMcu2nh","colab_type":"code","colab":{"autoexec":{"startup":false,"wait_interval":0}}},"cell_type":"code","source":["import os\n","import argparse\n","import tensorflow as tf\n","from IPython.display import Image\n","\n","import retrain"],"execution_count":0,"outputs":[]},{"metadata":{"id":"k-5EydSMu2nm","colab_type":"code","colab":{"autoexec":{"startup":false,"wait_interval":0}}},"cell_type":"code","source":["FLAGS = argparse.Namespace()\n","\n","FLAGS.image_dir = \"flower_photos\"\n","FLAGS.output_graph = 'retrained_graph.pb'\n","FLAGS.output_labels = 'output_labels.txt'\n","FLAGS.summaries_dir = '.\\\\summaries'\n","FLAGS.how_many_training_steps = 4000\n","FLAGS.learning_rate = 0.01\n","FLAGS.testing_percentage = 10\n","FLAGS.validation_percentage = 10\n","FLAGS.eval_step_interval = 10\n","FLAGS.train_batch_size = 100\n","FLAGS.test_batch_size = -1\n","FLAGS.validation_batch_size = 100\n","FLAGS.print_misclassified_test_images = False\n","FLAGS.model_dir = \"inception\"\n","FLAGS.bottleneck_dir = \"bottlenecks\"\n","FLAGS.final_tensor_name = \"final_result\"\n","FLAGS.flip_left_right = False\n","FLAGS.random_crop = 0\n","FLAGS.random_scale = 0\n","FLAGS.random_brightness = 0"],"execution_count":0,"outputs":[]},{"metadata":{"id":"-jG-nKhyu2no","colab_type":"code","colab":{"autoexec":{"startup":false,"wait_interval":0}}},"cell_type":"code","source":["retrain.FLAGS = FLAGS\n","tf.app.run(main=retrain.main)"],"execution_count":0,"outputs":[]},{"metadata":{"id":"u1X9xvQz3R_C","colab_type":"text"},"cell_type":"markdown","source":["# Downloading the Model"]},{"metadata":{"id":"slsjFShT2l-2","colab_type":"text"},"cell_type":"markdown","source":["_**Note:** This doesn't seem to work in safari, but there are [alternatives](https://colab.research.google.com/notebooks/io.ipynb)._"]},{"metadata":{"id":"uZu-2sepzK6r","colab_type":"code","colab":{"autoexec":{"startup":false,"wait_interval":0}}},"cell_type":"code","source":["from google.colab import files\n","files.download(\"retrained_graph.pb\")"],"execution_count":0,"outputs":[]}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment