The Rise of the Machines
In recent decade we are witnessing the resurrection of interest in neural networks due to advances in computing hardware such as GPU accelerators and availability of large data sets such as Facebook, YouTube etc. for training those networks. As a result there are a great number of research articles and practical applications emerged in the filed of artificial intelligence that found fruitful usage at Google, Facebook, Amazon etc.
Meet TensorFlow Library
As a forerunner in the filed of applied machine learning Google has developed and open sourced TensorFlow software machine learning library that is accessible for all to tackle the problems in computer vision, natural speech processing and more. If you find this information interesting then following steps will help you to start playing with this library. The library is written in C++ with APIs available in C++ and Python. Actually most education resources that are available online for TensorFlow use Python.
Installation Is Fast
Tensor Flow is developed with Linux and OS X in mind and struggles on Windows. That is why the steps below taken from official manual were run on Ubuntu 15.10.
- Open terminal in Ubuntu/ Linux 64 bit and install pip package management system for Python
$ sudo apt-get install python-pip python-dev
- Since I had no GPU on my 64 bit machine I chose this binary
# Ubuntu/Linux 64-bit, CPU only, Python 2.7 $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc2-cp27-none-linux_x86_64.whl
- Now let’s install TensorFlow library. Be prepared it will take a while
# Python 2 $ sudo pip install --upgrade $TF_BINARY_URL
- If installation went flawlessly which it was in my case it is possible to test it typing
- When you’ll see ‘>>>’ it means Python interpreter is running and you can play with it
>>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow! I've made it so far.') >>> sess = tf.Session() >>> print(sess.run(hello)) Hello, TensorFlow! I've made it so far. >>> a = tf.constant(10) >>> b = tf.constant(32) >>> print(sess.run(a + b)) 42
Hot update: TensorFlow 0.12 available on Windows 7/10
Today we announced native Windows support in TensorFlow 0.12, with packages for Python 3.5. If you have installed the 64-bit version of Python 3.5 (either from Python.org or Anaconda), you can install TensorFlow with a single command:
C:\> pip install tensorflow
How to Use It?
If you want to get a feeling of what TensorFlow is capable of first hand then try to follow the Image Recognition official tutorial or do the steps below to recognize your most favorite image (do not try it with this one). TensorFlow Inception v-3 model will try to recognize the image provided by you and emit the caption for the image from the highest to lowest probability. For example, if you provide an image of Italian Alps then the result will be something along these lines.
alp (score = 0.73395) valley, vale (score = 0.18973) cliff, drop, drop-off (score = 0.00309) promontory, headland, head, foreland (score = 0.00171) lakeside, lakeshore (score = 0.00154)
Try It yourself
- The models and examples generally installed at this path
- To figure out the exact location use this directive for python 2.7 (change ‘python’ to ‘python3’ for Python 3)
$ python -c 'import os; import inspect; import tensorflow; print(os.path.dirname(inspect.getfile(tensorflow)))'
- For Image Recognition you need to run classify_image.py script which can be found at this path
- Place the image in JPEG format you want to be recognized anywhere you like. In my case it was at this destination
- Then run Inception v-3 model on that image this way. Pay attention that ‘– -image_file’ argument is there to indicate the path to the image
$ python /usr/local/lib/python2.7/dist-packages/tensorflow/models/image/imagenet/classify_image.py --image_file /home/me/Pictures/image.jpg
Teach Yourself Machine Learning In Ten Years
So you like what you did with TensorFlow and you want to learn the subject in more depth. Congratulations, since there are more resources than you can digest in your lifetime. What I personally found useful for me so far are.
1. Start with the TensorFlow site itself where you can find tutorials, guides and APIs description.
2. If you need a more thorough introduction to Machine Learning try to get helped by Udacity free courses on the subject
- Deep Learning by Google course which make use of TensorFlow with Python
3. If you are like me and likes books and rigorous theoretical background then this book by Michael Nielsen is just for you.
4. Machine Learning Mastery site by Jason Brownlee is definitely a place to visit
5. If you are an expert in the filed of Machine Learning then maybe you’ll find this peculiar blog by Chris Olah from Google Brain Team useful.
More Posts Are Expected
Stay in touch.
One thought on “Machine Learning For All”