text Poets.ipynb的Tensorflow
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text Poets.ipynb的Tensorflow相关的知识,希望对你有一定的参考价值。
{"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":[]}]}
以上是关于text Poets.ipynb的Tensorflow的主要内容,如果未能解决你的问题,请参考以下文章