Giter Club home page Giter Club logo

intro_deep_learning_tensorflow_tutorial's Introduction

Introductory deep learning tutorial with Tensorflow

1. Goal

In this tutorial, we are going to build three deep networks, including a DNN, a CNN, and an RNN using Tensorflow to classify the MNIST dataset. We aim to understand the architectures of these basic deep learning models, their difference, and how they handle input data differently.

Programming environment:

  • MacOS X (10.14)
  • Tensorflow 1.8
  • Python3

Install Tensorflow on MacOS X

See Section 2 below to setup the environement and install Tensorflow on MacOS X.

Tutorial and source code

The notebook and the source code of the tutorial can be found in notebook and source_code, respectively.

This tutorial is inspired by Tensorflow-Examples by Aymeric Damien

2. Setup environment and install Tensorflow on MacOS

2.1. Python3 installed?

Although Python 2 is installed by default on Apple computers, Python 3 is not. But it's worth a check before we move on. You can check by running these command on Terminal:

$ python --version
Python 2.7.10
$ python3 --version
python3: command not found

An error message should be returned for the latter. Otherwise, you have python3 already installed on your computer.

2.2. Install Xcode and Homebrew

$ xcode-select --install
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Check if Homebrew installed correctly:

$ brew doctor
Your system is ready to brew.

2.3. Install Python 3

The most recent Python release, which is 3.7 at this point in 2018. However, there has been some errors using Tensorflow with this version. Therefore, Python 3.6 is advisable.

$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

Check the version of Python 3 we just installed:

$ python3 --version
Python 3.6.5

2.4. Anaconda

We are going to install Tensorflow with Virtualenv. Virtualenv is a virtual Python environment isolated from other Python development, incapable of interfering with or being affected by other Python programs on the same machine. During the Virtualenv installation process, you will install not only TensorFlow but also all the packages that TensorFlow requires.

In Anaconda, you may use conda to create such a virtual environment.

Download the most recent release Anaconda from https://repo.anaconda.com/archive/Anaconda3-5.3.1-MacOSX-x86_64.sh

Install Anaconda

$ bash Anaconda3-5.3.1-MacOSX-x86_64.sh

Note there will be some questions during the installing process we need to take care of. You may also need to modify your PATH:

export PATH=$HOME/anaconda/bin:$PATH

to your .bash_profile

Create a conda environment named tensorflow:

(start new terminal)
$ conda create -n tensorflow pip python=3.6

Activate the conda environment tensorflow:

$ source activate tensorflow
(tensorflow)$  # Your prompt should change

Install TensorFlow inside your conda environment using the command below. Here, I aim to install CPU-only Tensorflow version 1.8. Note, as of version 1.2, TensorFlow no longer provides GPU support on Mac OS X.

(tensorflow)$ pip install --ignore-installed --upgrade \
 https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl

Validate the installed tensorflow:

(tensorflow)$ python3
(enter the following command)
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!

intro_deep_learning_tensorflow_tutorial's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.