TensorFlow Examples
TensorFlow Tutorial with popular machine learning algorithms implementation. This tutorial was designed for easily diving into TensorFlow, through examples.
It is suitable for beginners who want to find clear and concise examples about TensorFlow. For readability, the tutorial includes both notebook and code with explanations.
Note: If you are using older TensorFlow version (before 0.12), please have a look here
Tutorial index
0 - Prerequisite
1 - Introduction
2 - Basic Models
- Nearest Neighbor (notebook) (code)
- Linear Regression (notebook) (code)
- Logistic Regression (notebook) (code)
3 - Neural Networks
- Multilayer Perceptron (notebook) (code)
- Convolutional Neural Network (notebook) (code)
- Recurrent Neural Network (LSTM) (notebook) (code)
- Bidirectional Recurrent Neural Network (LSTM) (notebook) (code)
- Dynamic Recurrent Neural Network (LSTM) (code)
- AutoEncoder (notebook) (code)
4 - Utilities
- Save and Restore a model (notebook) (code)
- Tensorboard - Graph and loss visualization (notebook) (code)
- Tensorboard - Advanced visualization (notebook) (code)
5 - Multi GPU
Dataset
Some examples require MNIST dataset for training and testing. Don't worry, this dataset will automatically be downloaded when running examples (with input_data.py). MNIST is a database of handwritten digits, for a quick description of that dataset, you can check this notebook.
Official Website: http://yann.lecun.com/exdb/mnist/
More Examples
The following examples are coming from TFLearn, a library that provides a simplified interface for TensorFlow. You can have a look, there are many examples and pre-built operations and layers.
Tutorials
- TFLearn Quickstart. Learn the basics of TFLearn through a concrete machine learning task. Build and train a deep neural network classifier.
Basics
- Linear Regression. Implement a linear regression using TFLearn.
- Logical Operators. Implement logical operators with TFLearn (also includes a usage of 'merge').
- Weights Persistence. Save and Restore a model.
- Fine-Tuning. Fine-Tune a pre-trained model on a new task.
- Using HDF5. Use HDF5 to handle large datasets.
- Using DASK. Use DASK to handle large datasets.
Computer Vision
- Multi-layer perceptron. A multi-layer perceptron implementation for MNIST classification task.
- Convolutional Network (MNIST). A Convolutional neural network implementation for classifying MNIST dataset.
- Convolutional Network (CIFAR-10). A Convolutional neural network implementation for classifying CIFAR-10 dataset.
- Network in Network. 'Network in Network' implementation for classifying CIFAR-10 dataset.
- Alexnet. Apply Alexnet to Oxford Flowers 17 classification task.
- VGGNet. Apply VGG Network to Oxford Flowers 17 classification task.
- VGGNet Finetuning (Fast Training). Use a pre-trained VGG Network and retrain it on your own data, for fast training.
- RNN Pixels. Use RNN (over sequence of pixels) to classify images.
- Highway Network. Highway Network implementation for classifying MNIST dataset.
- Highway Convolutional Network. Highway Convolutional Network implementation for classifying MNIST dataset.
- Residual Network (MNIST). A bottleneck residual network applied to MNIST classification task.
- Residual Network (CIFAR-10). A residual network applied to CIFAR-10 classification task.
- Google Inception (v3). Google's Inception v3 network applied to Oxford Flowers 17 classification task.
- Auto Encoder. An auto encoder applied to MNIST handwritten digits.
Natural Language Processing
- Recurrent Neural Network (LSTM). Apply an LSTM to IMDB sentiment dataset classification task.
- Bi-Directional RNN (LSTM). Apply a bi-directional LSTM to IMDB sentiment dataset classification task.
- Dynamic RNN (LSTM). Apply a dynamic LSTM to classify variable length text from IMDB dataset.
- City Name Generation. Generates new US-cities name, using LSTM network.
- Shakespeare Scripts Generation. Generates new Shakespeare scripts, using LSTM network.
- Seq2seq. Pedagogical example of seq2seq reccurent network. See this repo for full instructions.
- CNN Seq. Apply a 1-D convolutional network to classify sequence of words from IMDB sentiment dataset.
Reinforcement Learning
- Atari Pacman 1-step Q-Learning. Teach a machine to play Atari games (Pacman by default) using 1-step Q-learning.
Others
- Recommender - Wide & Deep Network. Pedagogical example of wide & deep networks for recommender systems.
Notebooks
- Spiral Classification Problem. TFLearn implementation of spiral classification problem from Stanford CS231n.
Extending TensorFlow
- Layers. Use TFLearn layers along with TensorFlow.
- Trainer. Use TFLearn trainer class to train any TensorFlow graph.
- Built-in Ops. Use TFLearn built-in operations along with TensorFlow.
- Summaries. Use TFLearn summarizers along with TensorFlow.
- Variables. Use TFLearn variables along with TensorFlow.
Dependencies
tensorflow 1.0alpha
numpy
matplotlib
cuda
tflearn (if using tflearn examples)
For more details about TensorFlow installation, you can check TensorFlow Installation Guide