Google released the open source depth learning tool TensorFlow.
HTTP://TENSORFLOW.ORG/TUTORIALS/MNIST/BEGINNERS/INDEX.MD trial According to the official tutorial.
The operating system is Ubuntu 14.04, 64 bits, Python 2.7, and has enough Python packages installed.
1. Installation
1.1 Reference Documentation Http://tensorflow.org/get_started/os_setup.md#binary_installation
1.2 with PIP installation, need to use agents, or not even, this is the local SSH to the VPS out.
sudo pip install HTTPS://STORAGE.GOOGLEAPIS.COM/TENSORFLOW/LINUX/CPU/TENSORFLOW-0.5.0-CP27-NONE-LINUX_X86_64.WHL- -proxy http://127.0.0.1:3128
1.3 Note that my py2.7 has installed enough packages, such as Python-dev,numpy,swig and so on. If you encounter a problem with a missing package, install the required package first.
2. The first demo,test.py
------------------------------
Import TensorFlow as TF
Hello = tf.constant (' Hello, tensorflow! ')
Sess = tf. Session ()
Print Sess.run (hello)
A = Tf.constant (10)
b = Tf.constant (32)
Print Sess.run (a+b)
------------------------------
3. Mnist handwriting recognition
3.1 Download the database
In http://yann.lecun.com/exdb/mnist/download the 4 gz files mentioned above, put them in a local directory such as/tmp/mnist
3.2 Download input_data.py, put in/home/tim/test directory Https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/g3doc /tutorials/mnist/input_data.py
3.3 Create the file test_tensor_flow_mnist.py in the/home/tim/test directory, which reads as follows
-----------------------
#!/usr/bin/env python
Import Input_data
Import TensorFlow as TF
Mnist = Input_data.read_data_sets ("/tmp/mnist", One_hot=true)
x = Tf.placeholder ("float", [None, 784])
W = tf. Variable (Tf.zeros ([784,10]))
b = tf. Variable (Tf.zeros ([10]))
y = Tf.nn.softmax (Tf.matmul (x,w) + b)
Y_ = Tf.placeholder ("float", [none,10])
Cross_entropy =-tf.reduce_sum (Y_*tf.log (y))
Train_step = Tf.train.GradientDescentOptimizer (0.01). Minimize (Cross_entropy)
init = Tf.initialize_all_variables ()
Sess = tf. Session ()
Sess.run (INIT)
For I in range (1000):
Batch_xs, Batch_ys = Mnist.train.next_batch (100)
Sess.run (Train_step, Feed_dict={x:batch_xs, Y_: Batch_ys})
Correct_prediction = Tf.equal (Tf.argmax (y,1), Tf.argmax (y_,1))
accuracy = Tf.reduce_mean (Tf.cast (correct_prediction, "float"))
Print Sess.run (accuracy, feed_dict={x:mnist.test.images, Y_: Mnist.test.labels})
-----------------------
3.4 Run. It takes about a few seconds and the output is about 91%.
4. About version
4.1 pip version
Pip 1.5.4 from/usr/lib/python2.7/dist-packages (Python 2.7)
4.2 Already installed Python packs
Some are installed with Easy_install, most of which are pip-mounted.
Pip Freeze
jinja2==2.7.2
markupsafe==0.18
mysql-python==1.2.3
pam==0.4.2
pillow==2.3.0
twisted-core==13.2.0
twisted-web==13.2.0
adium-theme-ubuntu==0.3.4
apt-xapian-index==0.45
argparse==1.2.1
beautifulsoup4==4.2.1
chardet==2.0.1
colorama==0.2.5
command-not-found==0.3
cvxopt==1.1.4
debtagshw==0.1
decorator==3.4.0
defer==1.0.6
dirspec==13.10
duplicity==0.6.23
fp-growth==0.1.2
html5lib==0.999
httplib2==0.8
ipython==1.2.1
joblib==0.7.1
lockfile==0.8
lxml==3.3.3
matplotlib==1.4.3
nose==1.3.1
numexpr==2.2.2
numpy==1.9.2
oauthlib==0.6.1
oneconf==0.3.7
openpyxl==1.7.0
pandas==0.13.1
patsy==0.2.1
pexpect==3.1
piston-mini-client==0.7.5
pyopenssl==0.13
pycrypto==2.6.1
pycups==1.9.66
pycurl==7.19.3
pygobject==3.12.0
pygraphviz==1.2
pyparsing==2.0.3
pyserial==2.6
pysmbc==1.0.14.1
python-apt==0.9.3.5
python-dateutil==2.4.2
Python-debian==0.1.21-nmu2ubuntu2
pytz==2012c
pyxdg==0.25
pyzmq==14.0.1
reportlab==3.0
requests==2.2.1
scipy==0.13.3
sessioninstaller==0.0.0
simplegeneric==0.8.1
simplejson==3.3.1
six==1.10.0
software-center-aptd-plugins==0.0.0
ssh-import-id==3.21
statsmodels==0.5.0
sympy==0.7.4.1
system-service==0.1.6
tables==3.1.1
tensorflow==0.5.0
tornado==3.1.1
unity-lens-photos==1.0
urllib3==1.7.1
vboxapi==1.0
wheel==0.24.0
wsgiref==0.1.2
Xdiagnose==3.6.3build2
xlrd==0.9.2
xlwt==0.7.5
zope.interface==4.0.5